[libcxx-commits] [PATCH] D133124: [libc++][lit][AIX] Enable test case last_write_time.pass.cpp for AIX

Xing Xue via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 16 12:23:05 PDT 2022


xingxue updated this revision to Diff 460846.
xingxue added a comment.

Addressed comments:

- always define `before_epoch_time` & friends to reduce the scope of the workaround.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133124/new/

https://reviews.llvm.org/D133124

Files:
  libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp


Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -8,8 +8,6 @@
 
 // UNSUPPORTED: c++03
 
-// XFAIL: LIBCXX-AIX-FIXME
-
 // The string reported on errors changed, which makes those tests fail when run
 // against already-released libc++'s.
 // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.15|11.0}}
@@ -93,6 +91,9 @@
 static int lstat(const char *path, StatT *buf) {
   return stat_file(path, buf, FILE_FLAG_OPEN_REPARSE_POINT);
 }
+#elif defined(_AIX)
+using TimeSpec = st_timespec_t;
+using StatT = struct stat;
 #else
 using TimeSpec = timespec;
 using StatT = struct stat;
@@ -475,6 +476,7 @@
     const file_time_type past_time = now - Minutes(3) - Sec(42) - SubSec(17);
     const file_time_type before_epoch_time =
         epoch_time - Minutes(3) - Sec(42) - SubSec(17);
+    (void)before_epoch_time;
     // FreeBSD has a bug in their utimes implementation where the time is not update
     // when the number of seconds is '-1'.
 #if defined(__FreeBSD__) || defined(__NetBSD__)
@@ -482,6 +484,7 @@
         epoch_time - Sec(2) - SubSec(17);
 #else
     const file_time_type just_before_epoch_time = epoch_time - SubSec(17);
+    (void)just_before_epoch_time;
 #endif
 
     struct TestCase {
@@ -494,12 +497,19 @@
         {"file, future_time", file, future_time},
         {"dir, future_time", dir, future_time},
         {"file, past_time", file, past_time},
-        {"dir, past_time", dir, past_time},
+        {"dir, past_time", dir, past_time}
+        // Exclude file time types of before epoch time from testing on AIX
+        // because AIX system call utimensat() does not accept the times
+        // parameter having a negative tv_sec or tv_nsec field.
+#if !defined(_AIX)
+        ,
         {"file, before_epoch_time", file, before_epoch_time},
         {"dir, before_epoch_time", dir, before_epoch_time},
         {"file, just_before_epoch_time", file, just_before_epoch_time},
         {"dir, just_before_epoch_time", dir, just_before_epoch_time}
+#endif
     };
+
     for (const auto& TC : cases) {
         const auto old_times = GetTimes(TC.p);
         file_time_type old_time;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133124.460846.patch
Type: text/x-patch
Size: 2461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220916/1a929c04/attachment.bin>


More information about the libcxx-commits mailing list