From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 940513857437 for ; Mon, 23 Aug 2021 13:47:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 940513857437 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-h9DiVZdVMHWiTHvXSugUyw-1; Mon, 23 Aug 2021 09:47:54 -0400 X-MC-Unique: h9DiVZdVMHWiTHvXSugUyw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88DB51932487; Mon, 23 Aug 2021 13:47:53 +0000 (UTC) Received: from localhost (unknown [10.33.36.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 218CD60C0F; Mon, 23 Aug 2021 13:47:52 +0000 (UTC) Date: Mon, 23 Aug 2021 14:47:52 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed] libstdc++: Skip filesystem tests that depend on permissions [PR90787] Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="akc7E0TtfB/vJilE" Content-Disposition: inline X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Mon, 23 Aug 2021 13:48:02 -0000 --akc7E0TtfB/vJilE Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On 20/08/21 15:16 +0100, Jonathan Wakely wrote: >Tests that depend on filesystem permissions FAIL if run on Windows or as >root. Add a helper function to detect those cases, so the tests can skip >those checks gracefully. > >Signed-off-by: Jonathan Wakely > >libstdc++-v3/ChangeLog: > > PR libstdc++/90787 > * testsuite/27_io/filesystem/iterators/directory_iterator.cc: > Use new __gnu_test::permissions_are_testable() function. > * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: > Likewise. > * testsuite/27_io/filesystem/operations/exists.cc: Likewise. > * testsuite/27_io/filesystem/operations/is_empty.cc: Likewise. > * testsuite/27_io/filesystem/operations/remove.cc: Likewise. > * testsuite/27_io/filesystem/operations/remove_all.cc: Likewise. > * testsuite/27_io/filesystem/operations/status.cc: Likewise. > * testsuite/27_io/filesystem/operations/symlink_status.cc: > Likewise. > * testsuite/27_io/filesystem/operations/temp_directory_path.cc: > Likewise. > * testsuite/experimental/filesystem/iterators/directory_iterator.cc: > Likewise. > * testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc: > Likewise. > * testsuite/experimental/filesystem/operations/exists.cc: > Likewise. > * testsuite/experimental/filesystem/operations/is_empty.cc: > Likewise. > * testsuite/experimental/filesystem/operations/remove.cc: > Likewise. > * testsuite/experimental/filesystem/operations/remove_all.cc: > Likewise. > * testsuite/experimental/filesystem/operations/temp_directory_path.cc: > Likewise. > * testsuite/util/testsuite_fs.h (__gnu_test::permissions_are_testable): > New function to guess whether testing permissions will work. This causes new failures for bare metal targets where the path tests run, even though the rest of the filesystem lib isn't supported. That's because I forgot to make the new function inline, so it gets compiled in every filesystem test, and so requires a definition of geteuid even if the function isn't used. Making the new function inline should be sufficient to fix that. Tested powerpc64le-linux. Committed to trunk. --akc7E0TtfB/vJilE Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit bc97e736a5597ac1545b7f9069472117b6caa867 Author: Jonathan Wakely Date: Mon Aug 23 13:05:25 2021 libstdc++: Make permissions_are_testable function inline [PR90787] This function should be inline, so that's it's not emitted in tests that don't use it, to avoid undefined references to geteuid(). libstdc++-v3/ChangeLog: PR libstdc++/90787 * testsuite/util/testsuite_fs.h (permissions_are_testable): Define as inline. diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h index 674b60b83d2..0d32a616840 100644 --- a/libstdc++-v3/testsuite/util/testsuite_fs.h +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h @@ -160,7 +160,7 @@ namespace __gnu_test path_type path; }; - bool + inline bool permissions_are_testable(bool print_msg = true) { bool testable = false; --akc7E0TtfB/vJilE--