public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [committed] libstdc++: Skip filesystem tests that depend on permissions [PR90787]
Date: Mon, 23 Aug 2021 14:47:52 +0100	[thread overview]
Message-ID: <YSOnCDZaZ88d6KEt@redhat.com> (raw)
In-Reply-To: <YR+5NUP/aXfaRk5O@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

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 <jwakely@redhat.com>
>
>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.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 928 bytes --]

commit bc97e736a5597ac1545b7f9069472117b6caa867
Author: Jonathan Wakely <jwakely@redhat.com>
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;

      reply	other threads:[~2021-08-23 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 14:16 Jonathan Wakely
2021-08-23 13:47 ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YSOnCDZaZ88d6KEt@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).