From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fx601.security-mail.net (smtpout140.security-mail.net [85.31.212.146]) by sourceware.org (Postfix) with ESMTPS id 0F9353864821 for ; Tue, 20 Jul 2021 14:12:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0F9353864821 Received: from localhost (localhost [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 19FEE3ACCB8 for ; Tue, 20 Jul 2021 16:12:18 +0200 (CEST) Received: from fx601 (localhost [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 28B8B3ACCBD; Tue, 20 Jul 2021 16:12:17 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx601.security-mail.net (Postfix) with ESMTPS id B71C73ACC9A; Tue, 20 Jul 2021 16:12:16 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id A0F9327E0A42; Tue, 20 Jul 2021 16:12:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 8A5FB27E0A2F; Tue, 20 Jul 2021 16:12:16 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AEfwYWQA9Mcx; Tue, 20 Jul 2021 16:12:16 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 799F227E09A1; Tue, 20 Jul 2021 16:12:16 +0200 (CEST) X-Virus-Scanned: E-securemail, by Secumail Secumail-id: <163ce.60f6d9c0.b602c.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 8A5FB27E0A2F Date: Tue, 20 Jul 2021 16:12:16 +0200 (CEST) From: Marc Poulhies To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Cc: Luc Michel Message-ID: <1855720815.793351.1626790336484.JavaMail.zimbra@kalray.eu> Subject: libstdc++: Fix testsuite for skipping gdb tests on remote/non-native target MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=secu_ba856843e617a2558aff282cabeae45f_part1 X-Originating-IP: [192.168.40.202] X-Mailer: Zimbra 9.0.0_GA_3990 (ZimbraWebClient - FF88 (Linux)/9.0.0_GA_3990) Thread-Index: IrSSEUX4DnBF1EiLGPi1DCexzazdSQ== Thread-Topic: libstdc++: Fix testsuite for skipping gdb tests on remote/non-native target X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 20 Jul 2021 14:12:21 -0000 This message is in MIME format. --secu_ba856843e617a2558aff282cabeae45f_part1 Content-Type: text/plain; charset=utf-8 This fixes an incorrect invocation of gdb on remote targets where DejaGNU would try to run host's gdb in remote target simulator. gdb-test skips the testing when target is remote or non native but the gdb version check function does not. libstdc++-v3/ChangeLog: * testsuite/lib/gdb-test.exp (gdb_batch_check): Exit if non native or remote target. --secu_ba856843e617a2558aff282cabeae45f_part1 Content-Type: text/plain; name=patch.txt Content-Disposition: attachment; filename=patch.txt commit 0c4ae4ff46b1d7633f1e06f57d348b5817b8f640 Author: Jonathan Wakely Date: Tue Jul 20 12:35:37 2021 libstdc++: Add more tests for filesystem::create_directory [PR101510] Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/101510 * src/c++17/fs_ops.cc (create_dir): Adjust whitespace. * testsuite/27_io/filesystem/operations/create_directory.cc: Test creating directory with name of existing symlink to directory. * testsuite/experimental/filesystem/operations/create_directory.cc: Likewise. diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc index 66207ae5e44..cec76446f06 100644 --- a/libstdc++-v3/src/c++17/fs_ops.cc +++ b/libstdc++-v3/src/c++17/fs_ops.cc @@ -577,8 +577,7 @@ namespace { bool created = false; #ifdef _GLIBCXX_HAVE_SYS_STAT_H - posix::mode_t mode - = static_cast>(perm); + posix::mode_t mode = static_cast>(perm); if (posix::mkdir(p.c_str(), mode)) { const int err = errno; 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 a0e50471275..256621481d7 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc @@ -54,6 +54,33 @@ test01() b = create_directory(p); VERIFY( !b ); + auto f = p/"file"; + std::ofstream{f} << "create file"; + b = create_directory(f, ec); + VERIFY( ec == std::errc::file_exists ); + VERIFY( !b ); + try + { + create_directory(f); + VERIFY( false ); + } + catch (const fs::filesystem_error& e) + { + VERIFY( e.code() == std::errc::file_exists ); + VERIFY( e.path1() == f ); + } + + // PR libstdc++/101510 create_directory on an existing symlink to a directory + fs::create_directory(p/"dir"); + auto link = p/"link"; + fs::create_directory_symlink("dir", link); + ec = bad_ec; + b = fs::create_directory(link, ec); + VERIFY( !b ); + VERIFY( !ec ); + b = fs::create_directory(link); + VERIFY( !b ); + remove_all(p, ec); } diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc index ee2a74b8803..39f95b61a45 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc @@ -46,12 +46,40 @@ test01() VERIFY( exists(p) ); // Test existing path (libstdc++/71036). + ec = make_error_code(std::errc::invalid_argument); b = create_directory(p, ec); VERIFY( !ec ); VERIFY( !b ); b = create_directory(p); VERIFY( !b ); + auto f = p/"file"; + std::ofstream{f} << "create file"; + b = create_directory(f, ec); + VERIFY( ec == std::errc::file_exists ); + VERIFY( !b ); + try + { + create_directory(f); + VERIFY( false ); + } + catch (const fs::filesystem_error& e) + { + VERIFY( e.code() == std::errc::file_exists ); + VERIFY( e.path1() == f ); + } + + // PR libstdc++/101510 create_directory on an existing symlink to a directory + fs::create_directory(p/"dir"); + auto link = p/"link"; + fs::create_directory_symlink("dir", link); + ec = make_error_code(std::errc::invalid_argument); + b = fs::create_directory(link, ec); + VERIFY( !b ); + VERIFY( !ec ); + b = fs::create_directory(link); + VERIFY( !b ); + remove_all(p, ec); } --secu_ba856843e617a2558aff282cabeae45f_part1--