Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63412 - in trunk/libs/filesystem: v2/test v3/test
From: bdawes_at_[hidden]
Date: 2010-06-28 14:39:04


Author: bemandawes
Date: 2010-06-28 14:39:03 EDT (Mon, 28 Jun 2010)
New Revision: 63412
URL: http://svn.boost.org/trac/boost/changeset/63412

Log:
Delete file before starting tests, to create more reliable test environment. Always start tests with output, to avoid race condition on a few systems.
Text files modified:
   trunk/libs/filesystem/v2/test/fstream_test.cpp | 18 +++++++-----------
   trunk/libs/filesystem/v3/test/fstream_test.cpp | 18 +++++++-----------
   2 files changed, 14 insertions(+), 22 deletions(-)

Modified: trunk/libs/filesystem/v2/test/fstream_test.cpp
==============================================================================
--- trunk/libs/filesystem/v2/test/fstream_test.cpp (original)
+++ trunk/libs/filesystem/v2/test/fstream_test.cpp 2010-06-28 14:39:03 EDT (Mon, 28 Jun 2010)
@@ -45,21 +45,16 @@
   template< class Path >
   void test( const Path & p )
   {
+ fs::remove( p );
 # if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle open
- {
- std::cout << " in test 1\n";
- fs::filebuf fb;
- fb.open( p, std::ios_base::in );
- BOOST_TEST( fb.is_open() == fs::exists( p ) );
- }
     {
- std::cout << " in test 2\n";
+ std::cout << " in test 1\n";
       fs::filebuf fb1;
       fb1.open( p, std::ios_base::out );
       BOOST_TEST( fb1.is_open() );
     }
     {
- std::cout << " in test 3\n";
+ std::cout << " in test 2\n";
       fs::filebuf fb2;
       fb2.open( p, std::ios_base::in );
       BOOST_TEST( fb2.is_open() );
@@ -70,12 +65,12 @@
       "VC++6.0 does not support boost::filesystem open()\n";
 # endif
     {
- std::cout << " in test 4\n";
+ std::cout << " in test 3\n";
       fs::ifstream tfs( p );
       BOOST_TEST( tfs.is_open() );
     }
     {
- std::cout << " in test 4.1\n";
+ std::cout << " in test 4\n";
       fs::ifstream tfs( p / p.filename() ); // should fail
       BOOST_TEST( !tfs.is_open() );
     }
@@ -147,7 +142,8 @@
     }
 # endif
 
- if ( cleanup ) fs::remove( p );
+ if ( cleanup )
+ fs::remove( p );
 
   } // test
 } // unnamed namespace

Modified: trunk/libs/filesystem/v3/test/fstream_test.cpp
==============================================================================
--- trunk/libs/filesystem/v3/test/fstream_test.cpp (original)
+++ trunk/libs/filesystem/v3/test/fstream_test.cpp 2010-06-28 14:39:03 EDT (Mon, 28 Jun 2010)
@@ -47,31 +47,26 @@
   
   void test(const fs::path & p)
   {
- {
- std::cout << " in test 1\n";
- fs::filebuf fb;
- fb.open(p, std::ios_base::in);
- BOOST_TEST(fb.is_open() == fs::exists(p));
- }
+ fs::remove(p);
     {
- std::cout << " in test 2\n";
+ std::cout << " in test 1\n";
       fs::filebuf fb1;
       fb1.open(p, std::ios_base::out);
       BOOST_TEST(fb1.is_open());
     }
     {
- std::cout << " in test 3\n";
+ std::cout << " in test 2\n";
       fs::filebuf fb2;
       fb2.open(p, std::ios_base::in);
       BOOST_TEST(fb2.is_open());
     }
     {
- std::cout << " in test 4\n";
+ std::cout << " in test 3\n";
       fs::ifstream tfs(p);
       BOOST_TEST(tfs.is_open());
     }
     {
- std::cout << " in test 4.1\n";
+ std::cout << " in test 4\n";
       fs::ifstream tfs(p / p.filename()); // should fail
       BOOST_TEST(!tfs.is_open());
     }
@@ -137,7 +132,8 @@
       BOOST_TEST(tfs.is_open());
     }
 
- if (cleanup) fs::remove(p);
+ if (cleanup)
+ fs::remove(p);
 
   } // test
 } // unnamed namespace


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