[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
Thu Sep 1 10:17:20 PDT 2022
xingxue created this revision.
xingxue added reviewers: ldionne, Mordante, philnik, hubert.reinterpretcast, daltenty.
xingxue added a project: LLVM.
Herald added a project: All.
xingxue requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
This patch enables libc++ LIT test case `last_write_time.pass.cpp` for AIX. Because system call `utimensat()` of AIX which is used in the libc++ implementation of `last_write_time()` does not accept the `times` parameter with a negative `tv_sec` or `tv_nsec` field, testing of setting file time to before epoch time is excluded for AIX.
This is the AIX utimensat() man page <https://www.ibm.com/docs/en/aix/7.2?topic=u-utime-utimes-futimens-utimensat-subroutine>.
Repository:
rG LLVM Github Monorepo
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;
@@ -473,6 +474,10 @@
const file_time_type future_time = now + Hours(3) + Sec(42) + SubSec(17);
const file_time_type past_time = now - Minutes(3) - Sec(42) - SubSec(17);
+ // 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)
const file_time_type before_epoch_time =
epoch_time - Minutes(3) - Sec(42) - SubSec(17);
// FreeBSD has a bug in their utimes implementation where the time is not update
@@ -482,6 +487,7 @@
epoch_time - Sec(2) - SubSec(17);
#else
const file_time_type just_before_epoch_time = epoch_time - SubSec(17);
+#endif
#endif
struct TestCase {
@@ -494,11 +500,14 @@
{"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}
+#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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133124.457290.patch
Type: text/x-patch
Size: 2365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220901/15c71b48/attachment-0001.bin>
More information about the libcxx-commits
mailing list