From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 1F84A386C585; Wed, 22 Jun 2022 06:13:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F84A386C585 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9B4431160FA; Wed, 22 Jun 2022 02:13:42 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1FXAH7Br29xh; Wed, 22 Jun 2022 02:13:42 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 339991160F1; Wed, 22 Jun 2022 02:13:42 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 25M6DVjd723702 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jun 2022 03:13:31 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: [PATCH] libstdc++: testsuite: test symlnks ifdef _GLIBCXX_HAVE_SYMLINK Organization: Free thinker, does not speak for AdaCore Errors-To: aoliva@lxoliva.fsfla.org Date: Wed, 22 Jun 2022 03:13:31 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2022 06:13:46 -0000 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. Regstrapped on x86_64-linux-gnu, also tested with a cross to aarch64-rtems6. Ok to install? PS: Testing with trunk was somewhat impaired by various changes in the filesystem implementation and tests that cause new failures on rtems6 that I have not (yet?) been able to investigate. A slight variant of this patch, along with a number of patches I'm yet to post, has enabled gcc-11 to pass all filesystem tests. Meaning this might turn out to be an incomplete fix for the problem on mainline, in case remaining failures hide similar but new (compared with gcc-11) occurrences of the problem this attempts to fix. However, it brings strict improvement, so I expect it to be useful to integrate it nevertheless. 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. --- .../27_io/filesystem/operations/canonical.cc | 2 ++ .../testsuite/27_io/filesystem/operations/copy.cc | 3 ++- .../filesystem/operations/create_directories.cc | 3 ++- .../filesystem/operations/create_directory.cc | 3 ++- .../27_io/filesystem/operations/permissions.cc | 4 ++++ .../27_io/filesystem/operations/read_symlink.cc | 2 ++ .../27_io/filesystem/operations/remove.cc | 3 ++- .../27_io/filesystem/operations/remove_all.cc | 3 ++- .../27_io/filesystem/operations/rename.cc | 3 ++- .../27_io/filesystem/operations/symlink_status.cc | 4 ++++ .../filesystem/operations/weakly_canonical.cc | 3 ++- .../iterators/recursive_directory_iterator.cc | 3 ++- .../experimental/filesystem/operations/copy.cc | 3 ++- .../filesystem/operations/create_directories.cc | 3 ++- .../filesystem/operations/create_directory.cc | 3 ++- .../filesystem/operations/permissions.cc | 4 ++++ .../filesystem/operations/read_symlink.cc | 2 ++ .../experimental/filesystem/operations/remove.cc | 3 ++- .../filesystem/operations/remove_all.cc | 3 ++- .../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 bc7ef0de2b716..1ae23dadac517 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 f3081f4b64ebc..575d32d34fc3d 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 4a7ba1fcb4944..3b9b893ad8e2d 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 90f98302c00f8..e10a4c854f032 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 deed759be80e9..9e7c5fc7e485c 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 68bbab33bc9e2..feb9e4f3fe0b6 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 26f2d548f82d5..2b094868e4c03 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 943d85c0cc2e3..45b29d6bb7aa2 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 f23a2862a0b99..936e306041290 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 ef973b7807b8a..7ed91fa986c11 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 244b753f84d1d..38c5e76497da0 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 a201415921cfc..be27237b42c69 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 ca38328c5da15..6d95801e34f7c 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 03060c6cbb33e..9e29bd978fb6a 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 67e5fddca0094..dc1e518fe08aa 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 833aa13dd158b..1cb318a7c3730 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 75dae3eac5108..90e92f1201cdb 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 c01f140ee592a..29a24f1bd581e 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 4b0ce85cf9754..7165ddfb85cce 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 46776e80994e2..520d48ef8d844 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; -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about