summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/experimental/filesystem
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-01-16 23:11:10 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-01-16 23:11:10 +0000
commitedfe833a31a4e34875f30ec5eb8c56da556384d8 (patch)
treeb75c9381a29979c48f823d36c572f16eb55e3871 /libstdc++-v3/testsuite/experimental/filesystem
parenta6804ea9293fc10c85568c475ecdb402106fce8c (diff)
Fix failing filesystem tests on mingw targets
* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Add exports for fstream constructors and open members taking wide strings. Fix patterns for filesystem::path members to match wstring_view parameters. Add exports for shared_ptr members used by directory iterators. * src/c++17/fs_ops.cc (remove(const path&, error_code&)): Clear the error code parameter if the file doesn't exist. * src/filesystem/ops.cc (remove(const path&, error_code&)): Likewise. * testsuite/27_io/filesystem/operations/canonical.cc: Fix expected values for mingw targets, where "/" is not an absolute path. Do not test symlinks on mingw targets. * testsuite/experimental/filesystem/operations/canonical.cc: Likewise. * testsuite/27_io/filesystem/operations/copy.cc: Do not test symlinks on mingw targets. * testsuite/experimental/filesystem/operations/copy.cc: Likewise. * testsuite/27_io/filesystem/operations/create_directories.cc: Check that each component of the path is created. * testsuite/experimental/filesystem/operations/create_directories.cc: Likewise. * testsuite/27_io/filesystem/operations/exists.cc: Do not test permissions on mingw targets. * testsuite/experimental/filesystem/operations/exists.cc: Likewise. * testsuite/27_io/filesystem/operations/is_empty.cc: Likewise. * testsuite/experimental/filesystem/operations/is_empty.cc: Likewise. * testsuite/27_io/filesystem/operations/permissions.cc: XFAIL for mingw targets. * testsuite/experimental/filesystem/operations/permissions.cc: Likewise. * testsuite/27_io/filesystem/operations/remove.cc: Do not test symlinks or permissions on mingw targets. * testsuite/experimental/filesystem/operations/remove.cc: Likewise. * testsuite/27_io/filesystem/operations/remove_all.cc: Do not test symlinks on mingw targets. * testsuite/experimental/filesystem/operations/remove_all.cc: Likewise. * testsuite/27_io/filesystem/operations/status.cc: Do not test permissions on mingw targets. * testsuite/27_io/filesystem/operations/weakly_canonical.cc: Do not test symlinks on mingw targets. * testsuite/experimental/filesystem/operations/space.cc: Fix test for mingw targets. From-SVN: r267991
Diffstat (limited to 'libstdc++-v3/testsuite/experimental/filesystem')
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc10
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc5
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc5
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc5
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc1
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc9
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc17
9 files changed, 49 insertions, 9 deletions
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc
index 55572d61cef..7fad6c0317d 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc
@@ -37,24 +37,26 @@ test01()
canonical( p, ec );
VERIFY( !ec );
+ const auto root = fs::absolute("/");
+
p = "/";
p = canonical( p, ec );
- VERIFY( p == "/" );
+ VERIFY( p == root );
VERIFY( !ec );
p = "/.";
p = canonical( p, ec );
- VERIFY( p == "/" );
+ VERIFY( p == root );
VERIFY( !ec );
p = "/..";
p = canonical( p, ec );
- VERIFY( p == "/" );
+ VERIFY( p == root );
VERIFY( !ec );
p = "/../.././.";
p = canonical( p, ec );
- VERIFY( p == "/" );
+ VERIFY( p == root );
VERIFY( !ec );
}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc
index d213398dd52..61028111fc3 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc
@@ -67,6 +67,11 @@ test01()
void
test02()
{
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // No symlink support
+ return;
+#endif
+
auto from = __gnu_test::nonexistent_path();
auto to = __gnu_test::nonexistent_path();
std::error_code ec, bad = std::make_error_code(std::errc::invalid_argument);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
index 060c3188004..5b3e3783af5 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
@@ -63,6 +63,8 @@ test01()
b = fs::create_directories( p/"./d4/../d5", ec );
VERIFY( !ec );
VERIFY( b );
+ VERIFY( is_directory(p/"d4") );
+ VERIFY( is_directory(p/"d5") );
VERIFY( is_directory(p/"./d4/../d5") );
std::uintmax_t count = remove_all(p, ec);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc
index 36123f2422d..bb29b476015 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc
@@ -74,6 +74,11 @@ test03()
void
test04()
{
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // filesystem permissions not supported
+ return;
+#endif
+
using perms = std::experimental::filesystem::perms;
path p = __gnu_test::nonexistent_path();
create_directory(p);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc
index d3d929db1f9..1168ec78b4c 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc
@@ -28,6 +28,11 @@ namespace fs = std::experimental::filesystem;
void
test01()
{
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // filesystem permissions not supported
+ return;
+#endif
+
auto p = __gnu_test::nonexistent_path();
create_directory(p);
permissions(p, fs::perms::none);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc
index a771fd1005c..6d904b2bed7 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc
@@ -18,6 +18,7 @@
// { dg-options "-DUSE_FILESYSTEM_TS -lstdc++fs" }
// { dg-do run { target c++11 } }
// { dg-require-filesystem-ts "" }
+// { dg-xfail-if "permissions not supported" { *-*-mingw* } }
// 15.26 Permissions [fs.op.permissions]
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
index 606bf7c7781..36672074938 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
@@ -42,6 +42,10 @@ test01()
VERIFY( !ec );
VERIFY( !n );
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // No symlink support
+ return;
+#else
auto link = __gnu_test::nonexistent_path();
create_symlink(p, link); // dangling symlink
ec = bad_ec;
@@ -64,6 +68,7 @@ test01()
VERIFY( !ec );
VERIFY( n );
VERIFY( !exists(symlink_status(p)) );
+#endif
const auto dir = __gnu_test::nonexistent_path();
create_directories(dir/"a/b");
@@ -73,6 +78,9 @@ test01()
VERIFY( !n );
VERIFY( exists(dir/"a/b") );
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // No permissions support
+#else
permissions(dir, fs::perms::none, ec);
if (!ec)
{
@@ -82,6 +90,7 @@ test01()
VERIFY( !n );
permissions(dir, fs::perms::owner_all, ec);
}
+#endif
ec = bad_ec;
n = remove(dir/"a/b", ec);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
index 33f02d416a8..99fb14a71d7 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
@@ -42,6 +42,9 @@ test01()
VERIFY( !ec );
VERIFY( n == 0 );
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // No symlink support
+#else
auto link = __gnu_test::nonexistent_path();
create_symlink(p, link); // dangling symlink
ec = bad_ec;
@@ -58,6 +61,7 @@ test01()
VERIFY( n == 1 );
VERIFY( !exists(symlink_status(link)) ); // The symlink is removed, but
VERIFY( exists(p) ); // its target is not.
+#endif
const auto dir = __gnu_test::nonexistent_path();
create_directories(dir/"a/b/c");
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
index 38066edaae4..f68937e36f7 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
@@ -27,6 +27,12 @@
namespace fs = std::experimental::filesystem;
+bool check(fs::space_info const& s)
+{
+ const std::uintmax_t err = -1;
+ return s.capacity != err || s.free != err || s.available != err;
+}
+
void
test01()
{
@@ -36,17 +42,18 @@ test01()
s = fs::space(root, ec);
VERIFY( !ec );
- s = fs::space(__gnu_test::nonexistent_path(), ec);
- VERIFY( ec );
- VERIFY( s.capacity == static_cast<uintmax_t>(-1) );
- VERIFY( s.free == static_cast<uintmax_t>(-1) );
- VERIFY( s.available == static_cast<uintmax_t>(-1) );
+ s = fs::space(__gnu_test::nonexistent_path()/".", ec);
+ if (ec)
+ VERIFY( ! check(s) );
+ else
+ VERIFY( check(s) );
}
void
test02()
{
fs::space_info s = fs::space(".");
+ VERIFY( check(s) );
VERIFY( s.capacity >= s.free );
}