Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62767 - in branches/filesystem3: boost/filesystem/v2 libs/filesystem/v3/test
From: bdawes_at_[hidden]
Date: 2010-06-10 17:02:32


Author: bemandawes
Date: 2010-06-10 17:02:31 EDT (Thu, 10 Jun 2010)
New Revision: 62767
URL: http://svn.boost.org/trac/boost/changeset/62767

Log:
All tests passing on Windows, gcc + msvc. Changed convenience_test to eliminate chance of test directory name race condition when multiple tests run together.
Text files modified:
   branches/filesystem3/boost/filesystem/v2/fstream.hpp | 4 +-
   branches/filesystem3/libs/filesystem/v3/test/convenience_test.cpp | 75 +++++++++++++++++++++------------------
   2 files changed, 43 insertions(+), 36 deletions(-)

Modified: branches/filesystem3/boost/filesystem/v2/fstream.hpp
==============================================================================
--- branches/filesystem3/boost/filesystem/v2/fstream.hpp (original)
+++ branches/filesystem3/boost/filesystem/v2/fstream.hpp 2010-06-10 17:02:31 EDT (Thu, 10 Jun 2010)
@@ -39,9 +39,9 @@
       // C++98 does not supply a wchar_t open, so try to get an equivalent
       // narrow char name based on the short, so-called 8.3, name.
       // Not needed for Dinkumware 405 and later as they do supply wchar_t open.
- BOOST_FILESYSTEM2_DECL bool create_file_api( const std::wstring & ph,
+ BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph,
         std::ios_base::openmode mode ); // true if succeeds
- BOOST_FILESYSTEM2_DECL std::string narrow_path_api(
+ BOOST_FILESYSTEM_DECL std::string narrow_path_api(
         const std::wstring & ph ); // return is empty if fails
 
       inline std::string path_proxy( const std::wstring & file_ph,

Modified: branches/filesystem3/libs/filesystem/v3/test/convenience_test.cpp
==============================================================================
--- branches/filesystem3/libs/filesystem/v3/test/convenience_test.cpp (original)
+++ branches/filesystem3/libs/filesystem/v3/test/convenience_test.cpp 2010-06-10 17:02:31 EDT (Thu, 10 Jun 2010)
@@ -55,22 +55,27 @@
   BOOST_TEST(!fs::create_directories("")); // should be harmless
   BOOST_TEST(!fs::create_directories("/")); // ditto
 
- fs::remove_all("xx"); // make sure slate is blank
- BOOST_TEST(!fs::exists("xx")); // reality check
+ path unique_dir = fs::unique_path(); // unique name in case tests running in parallel
+ path unique_yy = unique_dir / "yy";
+ path unique_yya = unique_dir / "yya";
+ path unique_yy_zz = unique_dir / "yy" / "zz";
+
+ fs::remove_all(unique_dir); // make sure slate is blank
+ BOOST_TEST(!fs::exists(unique_dir)); // reality check
+
+ BOOST_TEST(fs::create_directories(unique_dir));
+ BOOST_TEST(fs::exists(unique_dir));
+ BOOST_TEST(fs::is_directory(unique_dir));
+
+ BOOST_TEST(fs::create_directories(unique_yy_zz));
+ BOOST_TEST(fs::exists(unique_dir));
+ BOOST_TEST(fs::exists(unique_yy));
+ BOOST_TEST(fs::exists(unique_yy_zz));
+ BOOST_TEST(fs::is_directory(unique_dir));
+ BOOST_TEST(fs::is_directory(unique_yy));
+ BOOST_TEST(fs::is_directory(unique_yy_zz));
 
- BOOST_TEST(fs::create_directories("xx"));
- BOOST_TEST(fs::exists("xx"));
- BOOST_TEST(fs::is_directory("xx"));
-
- BOOST_TEST(fs::create_directories("xx/yy/zz"));
- BOOST_TEST(fs::exists("xx"));
- BOOST_TEST(fs::exists("xx/yy"));
- BOOST_TEST(fs::exists("xx/yy/zz"));
- BOOST_TEST(fs::is_directory("xx"));
- BOOST_TEST(fs::is_directory("xx/yy"));
- BOOST_TEST(fs::is_directory("xx/yy/zz"));
-
- path is_a_file("xx/uu");
+ path is_a_file(unique_dir / "uu");
   {
     std::ofstream f(is_a_file.string().c_str());
     BOOST_TEST(!!f);
@@ -89,63 +94,63 @@
   BOOST_TEST(throws_fs_error(
     boost::bind(create_recursive_iterator, "/no-such-path")));
 
- fs::remove("xx/uu");
+ fs::remove(unique_dir / "uu");
 
 #ifdef BOOST_WINDOWS_API
   // These tests depends on ordering of directory entries, and that's guaranteed
   // on Windows but not necessarily on other operating systems
   {
- std::ofstream f("xx/yya");
+ std::ofstream f(unique_yya.string().c_str());
     BOOST_TEST(!!f);
   }
 
- for (it = fs::recursive_directory_iterator("xx");
+ for (it = fs::recursive_directory_iterator(unique_dir);
         it != fs::recursive_directory_iterator(); ++it)
     { std::cout << it->path() << '\n'; }
 
- it = fs::recursive_directory_iterator("xx");
- BOOST_TEST(it->path() == "xx/yy");
+ it = fs::recursive_directory_iterator(unique_dir);
+ BOOST_TEST(it->path() == unique_yy);
   BOOST_TEST(it.level() == 0);
   ++it;
- BOOST_TEST(it->path() == "xx/yy/zz");
+ BOOST_TEST(it->path() == unique_yy_zz);
   BOOST_TEST(it.level() == 1);
   it.pop();
- BOOST_TEST(it->path() == "xx/yya");
+ BOOST_TEST(it->path() == unique_yya);
   BOOST_TEST(it.level() == 0);
   it++;
   BOOST_TEST(it == fs::recursive_directory_iterator());
 
- it = fs::recursive_directory_iterator("xx");
- BOOST_TEST(it->path() == "xx/yy");
+ it = fs::recursive_directory_iterator(unique_dir);
+ BOOST_TEST(it->path() == unique_yy);
   it.no_push();
   ++it;
- BOOST_TEST(it->path() == "xx/yya");
+ BOOST_TEST(it->path() == unique_yya);
   ++it;
   BOOST_TEST(it == fs::recursive_directory_iterator());
 
- fs::remove("xx/yya");
+ fs::remove(unique_yya);
 #endif
 
- it = fs::recursive_directory_iterator("xx/yy/zz");
+ it = fs::recursive_directory_iterator(unique_yy_zz);
   BOOST_TEST(it == fs::recursive_directory_iterator());
   
- it = fs::recursive_directory_iterator("xx");
- BOOST_TEST(it->path() == "xx/yy");
+ it = fs::recursive_directory_iterator(unique_dir);
+ BOOST_TEST(it->path() == unique_yy);
   BOOST_TEST(it.level() == 0);
   ++it;
- BOOST_TEST(it->path() == "xx/yy/zz");
+ BOOST_TEST(it->path() == unique_yy_zz);
   BOOST_TEST(it.level() == 1);
   it++;
   BOOST_TEST(it == fs::recursive_directory_iterator());
 
- it = fs::recursive_directory_iterator("xx");
- BOOST_TEST(it->path() == "xx/yy");
+ it = fs::recursive_directory_iterator(unique_dir);
+ BOOST_TEST(it->path() == unique_yy);
   it.no_push();
   ++it;
   BOOST_TEST(it == fs::recursive_directory_iterator());
 
- it = fs::recursive_directory_iterator("xx");
- BOOST_TEST(it->path() == "xx/yy");
+ it = fs::recursive_directory_iterator(unique_dir);
+ BOOST_TEST(it->path() == unique_yy);
   ++it;
   it.pop();
   BOOST_TEST(it == fs::recursive_directory_iterator());
@@ -157,5 +162,7 @@
     == fs::recursive_directory_iterator());
   BOOST_TEST(ec);
 
+ fs::remove_all(unique_dir); // clean up behind ourselves
+
   return ::boost::report_errors();
 }


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