aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-10-25 01:27:10 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2017-10-25 01:27:10 +0100
commite921c7e5a670ccc758bf58d82065d224a98671d9 (patch)
tree225436b18b34036a655f3e3fbfc60b0660be0627
parent03ca5c55f9d12eba4f4adb1dfaddfb079cbe6b42 (diff)
downloadgcc-e921c7e5a670ccc758bf58d82065d224a98671d9.zip
gcc-e921c7e5a670ccc758bf58d82065d224a98671d9.tar.gz
gcc-e921c7e5a670ccc758bf58d82065d224a98671d9.tar.bz2
PR libstdc++/82706 fix test for case where operations succeed
PR libstdc++/82706 * testsuite/27_io/filesystem/operations/permissions.cc: Fix test. From-SVN: r254067
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc14
2 files changed, 16 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 4bcfbb2..dadec85 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-25 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/82706
+ * testsuite/27_io/filesystem/operations/permissions.cc: Fix test.
+
2017-10-24 François Dumont <fdumont@gcc.gnu.org>
* testsuite/lib/libstdc++.exp (check_v3_target_normal_mode): Add
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc
index 97b7a78..e190e88 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc
@@ -86,9 +86,10 @@ test03()
create_symlink(f.path, p);
std::error_code ec = make_error_code(std::errc::no_such_file_or_directory);
- std::error_code ec2 = make_error_code(std::errc::invalid_argument);
permissions(p, perms::owner_all,
perm_options::replace|perm_options::nofollow, ec);
+ bool caught = false;
+ std::error_code ec2;
try
{
permissions(p, perms::owner_all,
@@ -96,11 +97,18 @@ test03()
}
catch (const std::filesystem::filesystem_error& ex)
{
+ caught = true;
ec2 = ex.code();
VERIFY( ex.path1() == p );
}
// Both calls should succeed, or both should fail with same error:
- VERIFY( ec == ec2 );
+ if (ec)
+ {
+ VERIFY( caught );
+ VERIFY( ec == ec2 );
+ }
+ else
+ VERIFY( !caught );
remove(p);
}
@@ -114,9 +122,9 @@ test04()
create_symlink(__gnu_test::nonexistent_path(), p);
std::error_code ec = make_error_code(std::errc::no_such_file_or_directory);
- std::error_code ec2 = make_error_code(std::errc::invalid_argument);
permissions(p, perms::owner_all, ec);
VERIFY( ec );
+ std::error_code ec2;
try
{
permissions(p, perms::owner_all);