Make these tests a little more robust. * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave error_code unset. * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: Check for past-the-end before dereferencing. * testsuite/experimental/filesystem/iterators/ recursive_directory_iterator.cc: Likewise.
Tested powerpc64le-linux, committed to trunk.
commit ff95dc810ac57a0277d62bb122f7912d37a7cfd5 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Nov 15 18:10:52 2017 +0000 Minor improvements to Filesystem tests * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave error_code unset. * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: Check for past-the-end before dereferencing. * testsuite/experimental/filesystem/iterators/ recursive_directory_iterator.cc: Likewise. diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc index c3e6f01670a..9cdbd7aafa0 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc @@ -61,7 +61,6 @@ test01() ec = bad_ec; permissions(p, fs::perms::none, ec); VERIFY( !ec ); - ec = bad_ec; iter = fs::directory_iterator(p, ec); VERIFY( ec ); VERIFY( iter == end(iter) ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc index 1ef450fc907..d41a1506d3b 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc @@ -87,6 +87,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; // should recurse into d1 + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); iter.increment(ec); // should fail to recurse into p/d1/d2 VERIFY( ec ); @@ -99,6 +100,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; // should recurse into d1 + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); ec = bad_ec; iter.increment(ec); // should fail to recurse into p/d1/d2, so skip it diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc index 50cc7d45de8..584cfeed839 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc @@ -56,6 +56,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); ++iter; VERIFY( iter == end(iter) ); @@ -88,6 +89,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; // should recurse into d1 + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); iter.increment(ec); // should fail to recurse into p/d1/d2 VERIFY( ec );