From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 96C57384144D; Tue, 21 Jun 2022 00:08:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96C57384144D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] libstdc++: testsuite: test symlnks ifdef _GLIBCXX_HAVE_SYMLINK X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: b99549b5d895911fe4a0ef12b6f90652208c728d X-Git-Newrev: 5c032f0fe0601f45839d2a00c0960edf8e15f600 Message-Id: <20220621000851.96C57384144D@sourceware.org> Date: Tue, 21 Jun 2022 00:08:51 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2022 00:08:51 -0000 https://gcc.gnu.org/g:5c032f0fe0601f45839d2a00c0960edf8e15f600 commit 5c032f0fe0601f45839d2a00c0960edf8e15f600 Author: Alexandre Oliva Date: Mon Jun 20 20:03:05 2022 -0300 libstdc++: testsuite: test symlnks ifdef _GLIBCXX_HAVE_SYMLINK Several filesystem tests expect to be able to create symlinks even when !defined (_GLIBCXX_HAVE_SYMLINK), and fail predictably, reducing the amount of testing of other filesystem features. They are already skipped for mingw targets. I've extended the skipping to other targets in which _GLIBCXX_HAVE_SYMLINK is undefined. for libstdc++-v3/ChangeLog * testsuite/27_io/filesystem/operations/canonical.cc (test03): Only create symlinks when _GLIBCXX_HAVE_SYMLINK is defined. * testsuite/27_io/filesystem/operations/copy.cc (test02): Likewise. * testsuite/27_io/filesystem/operations/create_directories.cc (test04): Likewise. * testsuite/27_io/filesystem/operations/create_directory.cc (test01): Likewise. * testsuite/27_io/filesystem/operations/permissions.cc (test03, test04): Likewise. * testsuite/27_io/filesystem/operations/read_symlink.cc (test01): Likewise. * testsuite/27_io/filesystem/operations/remove.cc (test01): Likewise. * testsuite/27_io/filesystem/operations/remove_all.cc (test01): Likewise. * testsuite/27_io/filesystem/operations/rename.cc (test_symlinks): Likewise. * testsuite/27_io/filesystem/operations/symlink_status.cc (test01, test02): Likewise. * testsuite/27_io/filesystem/operations/weakly_canonical.cc (test01): Likewise. * testsuite/experimental/filesystem/iterators/recursive_directory_itreator.cc (test06): Likewise. * testsuite/experimental/filesystem/operations/copy.cc (test01): Likewise. * testsuite/experimental/filesystem/operations/create_directories.cc (test04): Likewise. * testsuite/experimental/filesystem/operations/create_directory.cc (test01): Likewise. * testsuite/experimental/filesystem/operations/permissions.cc (test03, test04): Likewise. * testsuite/experimental/filesystem/operations/read_symlink.cc (test01): Likewise. * testsuite/experimental/filesystem/operations/remove.cc (test01): Likewise. * testsuite/experimental/filesystem/operations/remove_all.cc (test01): Likewise. * testsuite/experimental/filesystem/operations/rename.cc (test01): Likewise. Diff: --- libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc | 2 ++ libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc | 3 ++- .../testsuite/27_io/filesystem/operations/create_directories.cc | 3 ++- .../testsuite/27_io/filesystem/operations/create_directory.cc | 3 ++- libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc | 4 ++++ libstdc++-v3/testsuite/27_io/filesystem/operations/read_symlink.cc | 2 ++ libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc | 3 ++- libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc | 3 ++- libstdc++-v3/testsuite/27_io/filesystem/operations/rename.cc | 3 ++- libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc | 4 ++++ .../testsuite/27_io/filesystem/operations/weakly_canonical.cc | 3 ++- .../experimental/filesystem/iterators/recursive_directory_iterator.cc | 3 ++- libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc | 3 ++- .../experimental/filesystem/operations/create_directories.cc | 3 ++- .../testsuite/experimental/filesystem/operations/create_directory.cc | 3 ++- .../testsuite/experimental/filesystem/operations/permissions.cc | 4 ++++ .../testsuite/experimental/filesystem/operations/read_symlink.cc | 2 ++ libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc | 3 ++- .../testsuite/experimental/filesystem/operations/remove_all.cc | 3 ++- libstdc++-v3/testsuite/experimental/filesystem/operations/rename.cc | 3 ++- 20 files changed, 46 insertions(+), 14 deletions(-) diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc index bc7ef0de2b7..1ae23dadac5 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc @@ -114,6 +114,8 @@ test03() #if defined(__MINGW32__) || defined(__MINGW64__) // No symlink support const fs::path baz = dir/"foo\\\\..\\bar///"; +#elif !defined (_GLIBCXX_HAVE_SYMLINK) + const fs::path baz = dir/"foo//../bar///"; #else fs::create_symlink("../bar", foo/"baz"); const fs::path baz = dir/"foo//./baz///"; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc index f3081f4b64e..575d32d34fc 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc @@ -66,7 +66,8 @@ test01() void test02() { -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support return; #endif diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc index 4a7ba1fcb49..3b9b893ad8e 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc @@ -148,7 +148,8 @@ test03() void test04() { -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // no symlinks #else // PR libstdc++/101510 diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc index 90f98302c00..e10a4c854f0 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc @@ -70,7 +70,8 @@ test01() VERIFY( e.path1() == f ); } -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // no symlinks #else // PR libstdc++/101510 create_directory on an existing symlink to a directory diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc index deed759be80..9e7c5fc7e48 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc @@ -76,6 +76,7 @@ test02() void test03() { +#ifdef _GLIBCXX_HAVE_SYMLINK using std::filesystem::perms; using std::filesystem::perm_options; @@ -111,11 +112,13 @@ test03() VERIFY( !caught ); remove(p); +#endif } void test04() { +#ifdef _GLIBCXX_HAVE_SYMLINK using perms = std::filesystem::perms; auto p = __gnu_test::nonexistent_path(); @@ -137,6 +140,7 @@ test04() VERIFY( ec == ec2 ); remove(p); +#endif } void diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/read_symlink.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/read_symlink.cc index 68bbab33bc9..feb9e4f3fe0 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/read_symlink.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/read_symlink.cc @@ -28,6 +28,7 @@ namespace fs = std::filesystem; void test01() { +#ifdef _GLIBCXX_HAVE_SYMLINK auto p = __gnu_test::nonexistent_path(); std::error_code ec; @@ -42,6 +43,7 @@ test01() VERIFY( result == tgt ); remove(p); +#endif } int diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc index 26f2d548f82..2b094868e4c 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc @@ -41,7 +41,8 @@ test01() VERIFY( !ec ); VERIFY( !n ); -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support #else auto link = __gnu_test::nonexistent_path(); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc index 943d85c0cc2..45b29d6bb7a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc @@ -41,7 +41,8 @@ test01() VERIFY( !ec ); VERIFY( n == 0 ); -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support #else auto link = __gnu_test::nonexistent_path(); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/rename.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/rename.cc index f23a2862a0b..936e3060412 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/rename.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/rename.cc @@ -75,7 +75,8 @@ test01() void test_symlinks() { -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support #else std::error_code ec; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc index ef973b7807b..7ed91fa986c 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc @@ -39,6 +39,7 @@ test01() fs::file_status st2 = fs::symlink_status(dot); VERIFY( st2.type() == fs::file_type::directory ); +#ifdef _GLIBCXX_HAVE_SYMLINK fs::path link = __gnu_test::nonexistent_path(); create_directory_symlink(dot, link); __gnu_test::scoped_file l(link, __gnu_test::scoped_file::adopt_file); @@ -49,6 +50,7 @@ test01() st2 = fs::symlink_status(link, ec); VERIFY( !ec ); VERIFY( st2.type() == fs::file_type::symlink ); +#endif } void @@ -68,6 +70,7 @@ test02() void test03() { +#ifdef _GLIBCXX_HAVE_SYMLINK if (!__gnu_test::permissions_are_testable()) return; @@ -111,6 +114,7 @@ test03() VERIFY( st2.type() == fs::file_type::symlink ); fs::permissions(dir, fs::perms::owner_all, ec); +#endif } void diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/weakly_canonical.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/weakly_canonical.cc index 244b753f84d..38c5e76497d 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/weakly_canonical.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/weakly_canonical.cc @@ -39,7 +39,8 @@ test01() fs::create_directory(bar/"baz"); fs::path p; -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support #else fs::create_symlink("../bar", foo/"bar"); 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 a201415921c..be27237b42c 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc @@ -188,7 +188,8 @@ test05() void test06() { -#if !(defined __MINGW32__ || defined __MINGW64__) +#if !(defined __MINGW32__ || defined __MINGW64__) \ + && defined _GLIBCXX_HAVE_SYMLINK auto p = __gnu_test::nonexistent_path(); create_directories(p/"d1/d2"); create_directory_symlink("d1", p/"link"); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc index ca38328c5da..6d95801e34f 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc @@ -67,7 +67,8 @@ test01() void test02() { -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support return; #endif diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc index 03060c6cbb3..9e29bd978fb 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc @@ -147,7 +147,8 @@ test03() void test04() { -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // no symlinks #else // PR libstdc++/101510 diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc index 67e5fddca00..dc1e518fe08 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc @@ -69,7 +69,8 @@ test01() VERIFY( e.path1() == f ); } -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // no symlinks #else // PR libstdc++/101510 create_directory on an existing symlink to a directory diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc index 833aa13dd15..1cb318a7c37 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/permissions.cc @@ -72,6 +72,7 @@ test02() void test03() { +#ifdef _GLIBCXX_HAVE_SYMLINK using perms = std::experimental::filesystem::perms; __gnu_test::scoped_file f; @@ -95,11 +96,13 @@ test03() VERIFY( ec == ec2 ); remove(p); +#endif } void test04() { +#ifdef _GLIBCXX_HAVE_SYMLINK using perms = std::experimental::filesystem::perms; auto p = __gnu_test::nonexistent_path(); @@ -120,6 +123,7 @@ test04() VERIFY( ec == ec2 ); remove(p); +#endif } void diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/read_symlink.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/read_symlink.cc index 75dae3eac51..90e92f1201c 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/read_symlink.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/read_symlink.cc @@ -29,6 +29,7 @@ namespace fs = std::experimental::filesystem; void test01() { +#ifdef _GLIBCXX_HAVE_SYMLINK auto p = __gnu_test::nonexistent_path(); std::error_code ec; @@ -43,6 +44,7 @@ test01() VERIFY( result == tgt ); remove(p); +#endif } int diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc index c01f140ee59..29a24f1bd58 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc @@ -42,7 +42,8 @@ test01() VERIFY( !ec ); VERIFY( !n ); -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support return; #else diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc index 4b0ce85cf97..7165ddfb85c 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc @@ -42,7 +42,8 @@ test01() VERIFY( !ec ); VERIFY( n == 0 ); -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support #else auto link = __gnu_test::nonexistent_path(); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/rename.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/rename.cc index 46776e80994..520d48ef8d8 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/rename.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/rename.cc @@ -75,7 +75,8 @@ test01() void test_symlinks() { -#if defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__MINGW32__) || defined(__MINGW64__) \ + || !defined (_GLIBCXX_HAVE_SYMLINK) // No symlink support #else std::error_code ec;