Fix failing filesystem tests on mingw targets
authorJonathan Wakely <jwakely@redhat.com>
Wed, 16 Jan 2019 23:11:10 +0000 (23:11 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 16 Jan 2019 23:11:10 +0000 (23:11 +0000)
* 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

23 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/src/c++17/fs_ops.cc
libstdc++-v3/src/filesystem/ops.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/exists.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/is_empty.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/status.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/weakly_canonical.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/canonical.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc

index d9819eee4adc92ae36e537eecba0ed40ccbc2673..2ed0254425624483d20de9095c4107e400a4142d 100644 (file)
@@ -1,3 +1,47 @@
+2019-01-16  Jonathan Wakely  <jwakely@redhat.com>
+
+       * 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.
+
 2019-02-14  Ulrich Drepper  <drepper@redhat.com>
 
        PR libstdc++/88738
index dc934dd85096c67a0e44bee0759a6174c1d96e1e..3b254b2289f7c12089068859bb32401d6dc32a5f 100644 (file)
@@ -2060,6 +2060,10 @@ GLIBCXX_3.4.26 {
     _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreExt;
     # std::basic_filebuf::open(const wchar_t*, openmode)
     _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4openEPKwSt13_Ios_Openmode;
+    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]EPKwSt13_Ios_Openmode;
+    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4openEPKwSt13_Ios_Openmode;
+    _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEC[12]EPKwSt13_Ios_Openmode;
+    _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EE4openEPKwSt13_Ios_Openmode;
 
     _ZN11__gnu_debug25_Safe_local_iterator_base16_M_attach_singleEPNS_19_Safe_sequence_baseEb;
 
@@ -2122,7 +2126,7 @@ GLIBCXX_3.4.26 {
     _ZNKSt10filesystem4path5_List3endEv;
     _ZNKSt10filesystem4path5_List5beginEv;
     _ZNKSt10filesystem4path7compareERKS0_;
-    _ZNKSt10filesystem4path7compareESt17basic_string_viewIcSt11char_traitsIcEE;
+    _ZNKSt10filesystem4path7compareESt17basic_string_viewI[cw]St11char_traitsI[cw]EE;
     _ZNKSt10filesystem4path9root_*Ev;
     _ZNSt10filesystem10hash_valueERKNS_4pathE;
     _ZNSt10filesystem16filesystem_errorC[12]E*;
@@ -2132,8 +2136,8 @@ GLIBCXX_3.4.26 {
     _ZNSt10filesystem4path1[567]re*;
     _ZNSt10filesystem4path5_ListC1ERKS1_;
     _ZNSt10filesystem4path5_ListC1Ev;
-    _ZNSt10filesystem4path9_M_appendESt17basic_string_viewIcSt11char_traitsIcEE;
-    _ZNSt10filesystem4path9_M_concatESt17basic_string_viewIcSt11char_traitsIcEE;
+    _ZNSt10filesystem4path9_M_appendESt17basic_string_viewI[cw]St11char_traitsI[cw]EE;
+    _ZNSt10filesystem4path9_M_concatESt17basic_string_viewI[cw]St11char_traitsI[cw]EE;
     _ZNSt10filesystem4pathaSERKS0_;
     _ZNSt10filesystem4pathdVERKS0_;
     _ZNSt10filesystem4pathpLERKS0_;
@@ -2148,7 +2152,7 @@ GLIBCXX_3.4.26 {
     _ZNKSt10filesystem7__cxx114path5_List3endEv;
     _ZNKSt10filesystem7__cxx114path5_List5beginEv;
     _ZNKSt10filesystem7__cxx114path7compareERKS1_;
-    _ZNKSt10filesystem7__cxx114path7compareESt17basic_string_viewIcSt11char_traitsIcEE;
+    _ZNKSt10filesystem7__cxx114path7compareESt17basic_string_viewI[cw]St11char_traitsI[cw]EE;
     _ZNKSt10filesystem7__cxx114path9root_*Ev;
     _ZNSt10filesystem7__cxx1110hash_valueERKNS0_4pathE;
     _ZNSt10filesystem7__cxx1116filesystem_errorC[12]E*;
@@ -2158,8 +2162,8 @@ GLIBCXX_3.4.26 {
     _ZNSt10filesystem7__cxx114path1[567]re*;
     _ZNSt10filesystem7__cxx114path5_ListC1ERKS2_;
     _ZNSt10filesystem7__cxx114path5_ListC1Ev;
-    _ZNSt10filesystem7__cxx114path9_M_appendESt17basic_string_viewIcSt11char_traitsIcEE;
-    _ZNSt10filesystem7__cxx114path9_M_concatESt17basic_string_viewIcSt11char_traitsIcEE;
+    _ZNSt10filesystem7__cxx114path9_M_appendESt17basic_string_viewI[cw]St11char_traitsI[cw]EE;
+    _ZNSt10filesystem7__cxx114path9_M_concatESt17basic_string_viewI[cw]St11char_traitsI[cw]EE;
     _ZNSt10filesystem7__cxx114pathaSERKS1_;
     _ZNSt10filesystem7__cxx114pathdVERKS1_;
     _ZNSt10filesystem7__cxx114pathpLERKS1_;
@@ -2221,6 +2225,12 @@ GLIBCXX_3.4.26 {
     _ZNSt10filesystem7__cxx1128recursive_directory_iteratoraSEOS1_;
     _ZNSt10filesystem7__cxx1128recursive_directory_iteratorppEv;
 
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE2EEC1Ev;
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE2EEC1EOS5_;
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE2EEaSEOS5_;
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx1128recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE2EEC1Ev;
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx1128recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE2EEC1EOS6_;
+
     # basic_ostream::operator<<(nullptr_t)
     _ZNSolsEDn;
     _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEDn;
index edd9315980bc95c77cfe9de38f61bcb028fde79a..7ece478b62a7f61fb3d668e5328e767d3136ee72 100644 (file)
@@ -1175,7 +1175,8 @@ bool
 fs::remove(const path& p, error_code& ec) noexcept
 {
 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
-  if (exists(symlink_status(p, ec)))
+  auto st = symlink_status(p, ec);
+  if (exists(st))
     {
       if ((is_directory(p, ec) && RemoveDirectoryW(p.c_str()))
          || DeleteFileW(p.c_str()))
@@ -1186,6 +1187,8 @@ fs::remove(const path& p, error_code& ec) noexcept
       else if (!ec)
        ec.assign((int)GetLastError(), generic_category());
     }
+  else if (status_known(st))
+    ec.clear();
 #else
   if (::remove(p.c_str()) == 0)
     {
index 41850b8fc5757717e926d662b09c4375bc6496d2..36b5d2c24f645c86feca02e92d44c6bbde889d30 100644 (file)
@@ -1045,7 +1045,8 @@ bool
 fs::remove(const path& p, error_code& ec) noexcept
 {
 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
-  if (exists(symlink_status(p, ec)))
+  auto st = symlink_status(p, ec);
+  if (exists(st))
     {
       if ((is_directory(p, ec) && RemoveDirectoryW(p.c_str()))
          || DeleteFileW(p.c_str()))
@@ -1056,6 +1057,8 @@ fs::remove(const path& p, error_code& ec) noexcept
       else if (!ec)
        ec.assign((int)GetLastError(), generic_category());
     }
+  else if (status_known(st))
+    ec.clear();
 #else
   if (::remove(p.c_str()) == 0)
     {
index 8051a4bfb7ac86648d90bd9f240e3543acc57021..75794cca26d9fa79300f64724765d655591d875c 100644 (file)
@@ -52,28 +52,30 @@ test01()
   compare_paths( p2, p );
   VERIFY( !ec );
 
+  const auto root = fs::absolute("/");
+
   ec = bad_ec;
   p = "/";
   p = canonical( p, ec );
-  compare_paths( p, "/" );
+  compare_paths( p, root );
   VERIFY( !ec );
 
   ec = bad_ec;
   p = "/.";
   p = canonical( p, ec );
-  compare_paths( p, "/" );
+  compare_paths( p, root );
   VERIFY( !ec );
 
   ec = bad_ec;
   p = "/..";
   p = canonical( p, ec );
-  compare_paths( p, "/" );
+  compare_paths( p, root );
   VERIFY( !ec );
 
   ec = bad_ec;
   p = "/../.././.";
   p = canonical( p, ec );
-  compare_paths( p, "/" );
+  compare_paths( p, root );
   VERIFY( !ec );
 }
 
@@ -101,7 +103,6 @@ test02()
 #endif
 }
 
-
 void
 test03()
 {
@@ -111,22 +112,28 @@ test03()
   fs::path foo = dir/"foo", bar = dir/"bar";
   fs::create_directory(foo);
   fs::create_directory(bar);
+#if defined(__MINGW32__) || defined(__MINGW64__)
+  // No symlink support
+  const fs::path baz = dir/"foo\\\\..\\bar///";
+#else
   fs::create_symlink("../bar", foo/"baz");
+  const fs::path baz = dir/"foo//./baz///";
+#endif
 
   auto dirc = canonical(dir);
   auto barc = canonical(bar);
 
   auto p1 = fs::canonical(dir/"foo//.///..//./");
   compare_paths( p1, dirc );
-  auto p2 = fs::canonical(dir/"foo//./baz///..//./");
+  auto p2 = fs::canonical(baz/"..//./");
   compare_paths( p2, dirc );
-  auto p3 = fs::canonical(dir/"foo//./baz////./");
+  auto p3 = fs::canonical(baz/"./");
   compare_paths( p3, barc );
-  auto p4 = fs::canonical(dir/"foo//./baz///..//./bar");
+  auto p4 = fs::canonical(baz/"..//./bar");
   compare_paths( p4, barc );
-  auto p5 = fs::canonical(dir/"foo//./baz///..//./bar/");
+  auto p5 = fs::canonical(baz/"..//./bar/");
   compare_paths( p5, p4 );
-  auto p6 = fs::canonical(dir/"foo//./baz///..//./bar/.");
+  auto p6 = fs::canonical(baz/"..//./bar/.");
   compare_paths( p6, p4 );
 
   remove_all(dir);
index 7234e34831fed4de745a1e2e02639522c529a388..b19b0f4d6266f922e5cbd98d9e4f6c5fdf09bb6a 100644 (file)
@@ -67,6 +67,11 @@ test01()
 void
 test02()
 {
+#if defined(__MINGW32__) || defined(__MINGW64__)
+  // No symlink support
+  return;
+#endif
+
   const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
   auto from = __gnu_test::nonexistent_path();
   auto to = __gnu_test::nonexistent_path();
index d248676b82db04de955fcf2c2ae061c1e8427cc0..9ad5ef09f4a8fd0eb5cd308e6a37cea722838940 100644 (file)
@@ -70,6 +70,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);
index df8251e55c2372c34c3c363d75642077b140ec74..0aa5fd5791b9e96b15c5b754dda492b69ade06a6 100644 (file)
@@ -80,6 +80,11 @@ test03()
 void
 test04()
 {
+#if defined(__MINGW32__) || defined(__MINGW64__)
+  // filesystem permissions not supported
+  return;
+#endif
+
   using std::filesystem::perms;
   using std::filesystem::perm_options;
   path p = __gnu_test::nonexistent_path();
index c572a83457683b016d86abba1d95ff649d5fd59c..1e68c9be480c7ee51151694859a1244428c40c01 100644 (file)
@@ -28,6 +28,11 @@ namespace fs = std::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);
index 23d5817acadb0aadf1495972b904475d1141b042..77dd788499fd68fccfdd14879228f5c2487eedaf 100644 (file)
@@ -18,6 +18,7 @@
 // { dg-options "-std=gnu++17" }
 // { dg-do run { target c++17 } }
 // { dg-require-filesystem-ts "" }
+// { dg-xfail-if "permissions not supported" { *-*-mingw* } }
 
 // C++17 30.10.14.26 Permissions [fs.op.permissions]
 
index afe9580fa33ba7c533fee2f8ba1edbad81d49565..f7a5bb3e66371179f66050f94c2673cb2ec915cf 100644 (file)
@@ -42,6 +42,9 @@ test01()
   VERIFY( !ec );
   VERIFY( !n );
 
+#if defined(__MINGW32__) || defined(__MINGW64__)
+  // No symlink support
+#else
   auto link = __gnu_test::nonexistent_path();
   create_symlink(p, link);  // dangling symlink
   ec = bad_ec;
@@ -64,6 +67,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 +77,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 +89,7 @@ test01()
     VERIFY( !n );
     permissions(dir, fs::perms::owner_all, ec);
   }
+#endif
 
   ec = bad_ec;
   n = remove(dir/"a/b", ec);
index 2f2802ff859d5f18fd43aa9fceb31cf6c04f18ad..119dd3dc78301b04a3aca9c0f52ded8b0957aea1 100644 (file)
@@ -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");
index b5ab1b5fd5eb888a7b64a71845a059224bde5ab2..38c0f65370cf0e4642cdd647d39817ec3000261f 100644 (file)
@@ -56,6 +56,11 @@ test02()
 void
 test03()
 {
+#if defined(__MINGW32__) || defined(__MINGW64__)
+  // No permissions support
+  return;
+#endif
+
   fs::path dir = __gnu_test::nonexistent_path();
   fs::create_directory(dir);
   __gnu_test::scoped_file d(dir, __gnu_test::scoped_file::adopt_file);
index e7f1a4ca782f06614eda0c25a338d4c52a985357..9e9233de7a560abab8541a4eadbd431fa6562e51 100644 (file)
@@ -28,6 +28,9 @@ namespace fs = std::filesystem;
 void
 test01()
 {
+  const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
+  std::error_code ec;
+
   auto dir = __gnu_test::nonexistent_path();
   fs::create_directory(dir);
   const auto dirc = canonical(dir);
@@ -35,18 +38,20 @@ test01()
   fs::create_directory(foo);
   fs::create_directory(bar);
   fs::create_directory(bar/"baz");
+  fs::path p;
+
+#if defined(__MINGW32__) || defined(__MINGW64__)
+  // No symlink support
+#else
   fs::create_symlink("../bar", foo/"bar");
 
-  auto p = fs::weakly_canonical(dir/"foo//./bar///../biz/.");
+  p = fs::weakly_canonical(dir/"foo//./bar///../biz/.");
   VERIFY( p == dirc/"biz/" );
   p = fs::weakly_canonical(dir/"foo/.//bar/././baz/.");
   VERIFY( p == dirc/"bar/baz" );
   p = fs::weakly_canonical(fs::current_path()/dir/"bar//../foo/bar/baz");
   VERIFY( p == dirc/"bar/baz" );
 
-  const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
-  std::error_code ec;
-
   ec = bad_ec;
   p = fs::weakly_canonical(dir/"foo//./bar///../biz/.", ec);
   VERIFY( !ec );
@@ -59,6 +64,30 @@ test01()
   p = fs::weakly_canonical(fs::current_path()/dir/"bar//../foo/bar/baz", ec);
   VERIFY( !ec );
   VERIFY( p == dirc/"bar/baz" );
+#endif
+
+  // As above, but using "foo/.." instead of "foo",
+  // because there is no "foo/bar" symlink
+
+  p = fs::weakly_canonical(dir/"./bar///../biz/.");
+  VERIFY( p == dirc/"biz/" );
+  p = fs::weakly_canonical(dir/"foo/.././/bar/././baz/.");
+  VERIFY( p == dirc/"bar/baz" );
+  p = fs::weakly_canonical(fs::current_path()/dir/"bar//../foo/../bar/baz");
+  VERIFY( p == dirc/"bar/baz" );
+
+  ec = bad_ec;
+  p = fs::weakly_canonical(dir/"foo/..//./bar///../biz/.", ec);
+  VERIFY( !ec );
+  VERIFY( p == dirc/"biz/" );
+  ec = bad_ec;
+  p = fs::weakly_canonical(dir/"foo/.././/bar/././baz/.", ec);
+  VERIFY( !ec );
+  VERIFY( p == dirc/"bar/baz" );
+  ec = bad_ec;
+  p = fs::weakly_canonical(fs::current_path()/dir/"bar//../foo/../bar/baz", ec);
+  VERIFY( !ec );
+  VERIFY( p == dirc/"bar/baz" );
 
   fs::remove_all(dir, ec);
 }
index 55572d61cef3f5a49b2b16c75d8ea03c60778855..7fad6c0317d36913b4c85cc8c7e8b2cba96dd9c9 100644 (file)
@@ -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 );
 }
 
index d213398dd52a6975f5fd09ec9fcb36845b85ff38..61028111fc38dca9aa7a62caf979a0af3c5d37b0 100644 (file)
@@ -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);
index 060c3188004a56d0de1058732576b3e0a94d395f..5b3e3783af51ec08e7ab726f073dda053fb508a6 100644 (file)
@@ -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);
index 36123f2422d1cb7f32721e2193ba5359097f36d9..bb29b4760150933f5c416c88094f13e8d55924a4 100644 (file)
@@ -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);
index d3d929db1f91f792366040a841617af1ffc4955c..1168ec78b4c601d3859b116ad1ea42c2be1b947a 100644 (file)
@@ -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);
index a771fd1005c8bd024611d99f49ea90008b0727dc..6d904b2bed7e0ce09a243970ce66e8990ac322bf 100644 (file)
@@ -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]
 
index 606bf7c7781c20bff48e5426b3b30470e9257be7..36672074938c6fe35c19d24bc06da32019d5d1d7 100644 (file)
@@ -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);
index 33f02d416a8d431a1209412652b9fbb5c0ecb1cc..99fb14a71d723f9ac4d59797cad36c3ec35b63b1 100644 (file)
@@ -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");
index 38066edaae4b48f2bc0b5e0288d3aeb13d4ce506..f68937e36f71eecefbe3afe511653df179b2bfb7 100644 (file)
 
 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 );
 }