|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49329 - trunk/libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2008-10-14 12:31:25
Author: bemandawes
Date: 2008-10-14 12:31:24 EDT (Tue, 14 Oct 2008)
New Revision: 49329
URL: http://svn.boost.org/trac/boost/changeset/49329
Log:
Add more error reporting at the create_directory() failure point that seems to be the first sign of test setup problems.
Text files modified:
trunk/libs/filesystem/test/operations_test.cpp | 63 +++++++++++++++++++++++++++------------
1 files changed, 44 insertions(+), 19 deletions(-)
Modified: trunk/libs/filesystem/test/operations_test.cpp
==============================================================================
--- trunk/libs/filesystem/test/operations_test.cpp (original)
+++ trunk/libs/filesystem/test/operations_test.cpp 2008-10-14 12:31:24 EDT (Tue, 14 Oct 2008)
@@ -304,6 +304,7 @@
== "//net/bar/foo" );
// predicate and status tests
+ BOOST_CHECK( fs::exists( "/" ) );
fs::path ng( " no-way, Jose" );
BOOST_CHECK( !fs::exists( ng ) );
BOOST_CHECK( !fs::is_directory( ng ) );
@@ -325,6 +326,49 @@
BOOST_CHECK( !fs::is_symlink( stat ) );
fs::path dir( fs::initial_path<fs::path>() / temp_dir_name );
+
+ if ( fs::exists( dir ) )
+ fs::remove_all( dir ); // remove residue from prior failed tests
+ BOOST_CHECK( !fs::exists( dir ) );
+
+ // create a directory, then check it for consistency
+ // take extra care to report problems, since if this fails
+ // many subsequent tests will fail
+ try
+ {
+ fs::create_directory( dir );
+ }
+
+ catch ( const fs::filesystem_error & x )
+ {
+ std::cout << x.what() << "\n\n"
+ "***** Creating directory " << dir.string() << " failed. *****\n"
+ "***** This is a serious error that will prevent further tests *****\n"
+ "***** from returning useful results. Further testing is aborted. *****\n\n";
+ return 1;
+ }
+
+ catch ( ... )
+ {
+ std::cout << "\n\n"
+ "***** Creating directory " << dir.string() << " failed. *****\n"
+ "***** This is a serious error that will prevent further tests *****\n"
+ "***** from returning useful results. Further testing is aborted. *****\n\n";
+ return 1;
+ }
+
+ BOOST_CHECK( fs::exists( dir ) );
+ BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
+ BOOST_CHECK( fs::is_directory( dir ) );
+ BOOST_CHECK( !fs::is_regular_file( dir ) );
+ BOOST_CHECK( !fs::is_other( dir ) );
+ BOOST_CHECK( !fs::is_symlink( dir ) );
+ stat = fs::status( dir );
+ BOOST_CHECK( fs::exists( stat ) );
+ BOOST_CHECK( fs::is_directory( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
+ BOOST_CHECK( !fs::is_other( stat ) );
+ BOOST_CHECK( !fs::is_symlink( stat ) );
// Windows only tests
if ( platform == "Windows" )
@@ -371,9 +415,6 @@
== fs::initial_path<fs::path>().root_path().string()+"foo" );
} // POSIX
- fs::remove_all( dir ); // in case residue from prior failed tests
- BOOST_CHECK( !fs::exists( dir ) );
-
// the bound functions should throw, so CHECK_EXCEPTION() should return true
BOOST_CHECK( CHECK_EXCEPTION( bad_file_size, ENOENT ) );
@@ -388,22 +429,6 @@
std::cout << "sizeof(boost::uintmax_t) = " << sizeof(boost::uintmax_t) << '\n';
BOOST_CHECK( sizeof( boost::uintmax_t ) >= 8 );
- // create a directory, then check it for consistency
- BOOST_CHECK( fs::create_directory( dir ) );
-
- BOOST_CHECK( fs::exists( dir ) );
- BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
- BOOST_CHECK( fs::is_directory( dir ) );
- BOOST_CHECK( !fs::is_regular_file( dir ) );
- BOOST_CHECK( !fs::is_other( dir ) );
- BOOST_CHECK( !fs::is_symlink( dir ) );
- stat = fs::status( dir );
- BOOST_CHECK( fs::exists( stat ) );
- BOOST_CHECK( fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( !fs::is_symlink( stat ) );
-
// set the current directory, then check it for consistency
fs::path original_dir = fs::current_path<fs::path>();
BOOST_CHECK( dir != original_dir );
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk