From: Alexandre Oliva <oliva@adacore.com>
To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: [PATCH] libstdc++: testsuite: skip fs space tests if not available
Date: Wed, 22 Jun 2022 03:27:25 -0300 [thread overview]
Message-ID: <oredzh9prm.fsf@lxoliva.fsfla.org> (raw)
The do_space function is defined in ways that are useful, or that fail
immediately, depending on various macros. When it fails immediately,
the filesystem space.cc tests fail noisily, but the fail is entirely
expected.
Define HAVE_SPACE in the space.cc tests, according to the macros that
select implementations of do_space, and use it to skip tests that are
expected to fail.
Regstrapped on x86_64-linux-gnu, also tested with a cross to
aarch64-rtems6. Ok to install?
for libstdc++-v3/ChangeLog
* testsuite/27_io/filesystem/operations/space.cc: Skip the
test if the feature is unavailable.
* testsuite/experimental/filesystem/operations/space.cc:
Likewise.
---
.../testsuite/27_io/filesystem/operations/space.cc | 10 ++++++++++
.../experimental/filesystem/operations/space.cc | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc
index 05997cac1dfa4..029d65655b1a7 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc
@@ -24,6 +24,13 @@
#include <testsuite_fs.h>
#include <testsuite_hooks.h>
+#if defined (_GLIBCXX_HAVE_SYS_STATVFS_H) \
+ || defined (_GLIBCXX_FILESYSTEM_IS_WINDOWS)
+# define HAVE_SPACE 1
+#else
+# define HAVE_SPACE 0
+#endif
+
bool check(std::filesystem::space_info const& s)
{
const std::uintmax_t err = -1;
@@ -59,6 +66,9 @@ test02()
int
main()
{
+ if (!HAVE_SPACE)
+ return 0;
+
test01();
test02();
}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
index 10ee0f06871df..83868dea9b5e3 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
@@ -25,6 +25,13 @@
#include <testsuite_fs.h>
#include <testsuite_hooks.h>
+#if defined (_GLIBCXX_HAVE_SYS_STATVFS_H) \
+ || defined (_GLIBCXX_FILESYSTEM_IS_WINDOWS)
+# define HAVE_SPACE 1
+#else
+# define HAVE_SPACE 0
+#endif
+
namespace fs = std::experimental::filesystem;
bool check(fs::space_info const& s)
@@ -60,6 +67,9 @@ test02()
int
main()
{
+ if (!HAVE_SPACE)
+ return 0;
+
test01();
test02();
}
--
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 <https://stallmansupport.org>
next reply other threads:[~2022-06-22 6:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 6:27 Alexandre Oliva [this message]
2022-06-22 9:46 ` Jonathan Wakely
2022-06-23 11:06 ` Alexandre Oliva
2022-06-23 11:31 ` Jonathan Wakely
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=oredzh9prm.fsf@lxoliva.fsfla.org \
--to=oliva@adacore.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).