public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] libstdc++: testsuite: skip fs last_write_time tests if not available
Date: Tue, 21 Jun 2022 00:17:04 +0000 (GMT)	[thread overview]
Message-ID: <20220621001704.780B63841464@sourceware.org> (raw)

https://gcc.gnu.org/g:d17aab2d8041c6325a2f2c14a6097041748da886

commit d17aab2d8041c6325a2f2c14a6097041748da886
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jun 20 20:44:03 2022 -0300

    libstdc++: testsuite: skip fs last_write_time tests if not available
    
    The last_write_time functions are defined in ways that are useful, or
    that fail immediately, depending on various macros.  When they fail
    immediately, the filesystem last_write_time.cc tests fail noisily, but
    the fail is entirely expected.
    
    Define HAVE_LWT in the last_write_time.cc tests, according to the
    macros that select implementations of last_write_time, and use it to
    skip tests that are expected to fail.
    
    
    for  libstdc++-v3/ChangeLog
    
            * testsuite/27_io/filesystem/operations/last_write_time.cc:
            Skip the test if the features are unavailable.
            * testsuite/experimental/filesystem/operations/last_write_time.cc:
            Likewise.

Diff:
---
 .../testsuite/27_io/filesystem/operations/last_write_time.cc  | 11 +++++++++++
 .../experimental/filesystem/operations/last_write_time.cc     | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/last_write_time.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/last_write_time.cc
index 7d6468a5124..ecdd45d6ac9 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/operations/last_write_time.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/last_write_time.cc
@@ -33,6 +33,14 @@
 #endif
 #include <stdio.h>
 
+#if (_GLIBCXX_USE_UTIMENSAT \
+     || (_GLIBCXX_USE_UTIME && _GLIBCXX_HAVE_SYS_STAT_H)) \
+  && defined (_GLIBCXX_HAVE_SYS_STAT_H)
+# define HAVE_LWT 1
+#else
+# define HAVE_LWT 0
+#endif
+
 using time_type = std::filesystem::file_time_type;
 
 namespace chrono = std::chrono;
@@ -209,6 +217,9 @@ test02()
 int
 main()
 {
+  if (!HAVE_LWT)
+    return 0;
+
   test01();
   test02();
 }
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/last_write_time.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/last_write_time.cc
index 38fafc392ca..562c1114a7f 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/last_write_time.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/last_write_time.cc
@@ -34,6 +34,14 @@
 #endif
 #include <stdio.h>
 
+#if (_GLIBCXX_USE_UTIMENSAT \
+     || (_GLIBCXX_USE_UTIME && _GLIBCXX_HAVE_SYS_STAT_H)) \
+  && defined (_GLIBCXX_HAVE_SYS_STAT_H)
+# define HAVE_LWT 1
+#else
+# define HAVE_LWT 0
+#endif
+
 using time_type = std::experimental::filesystem::file_time_type;
 
 namespace chrono = std::chrono;
@@ -175,6 +183,9 @@ test02()
 int
 main()
 {
+  if (!HAVE_LWT)
+    return 0;
+
   test01();
   test02();
 }


             reply	other threads:[~2022-06-21  0:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21  0:17 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-22  5:23 Alexandre Oliva
2022-06-21  0:09 Alexandre Oliva

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=20220621001704.780B63841464@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).