summaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-01-05 21:18:10 +0000
committerEric Fiselier <eric@efcs.ca>2019-01-05 21:18:10 +0000
commitbb8d2e9faa23520634585941d8159db82e0b67d0 (patch)
tree4f1334021b171cd45894963adc89a8459ed019a6 /libcxx
parent48231c08ebefec2be35745f22790e1c2b710bc8f (diff)
Fix flaky symlink access time test.
last_write_time(sym, new_time) changes the modification time of the file referenced by the symlink. But reading through the symlink may change the symlinks's access time. This meant the previous test that checked that the symlinks access time was unchanged was incorrect and made the test flaky. This patch removes this test (there really is no non-flaky way to test that the new access time coorisponds to the time at which the symlink was last dereferenced). This should unflake the test.
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
index 11152e6ab1d..bf0096acff1 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -125,7 +125,7 @@ TimeSpec LastAccessTime(path const& p) { return GetTimes(p).access; }
TimeSpec LastWriteTime(path const& p) { return GetTimes(p).write; }
-std::pair<TimeSpec, TimeSpec> GetSymlinkTimes(path const& p) {
+Times GetSymlinkTimes(path const& p) {
StatT st;
if (::lstat(p.c_str(), &st) == -1) {
std::error_code ec(errno, std::generic_category());
@@ -136,7 +136,10 @@ std::pair<TimeSpec, TimeSpec> GetSymlinkTimes(path const& p) {
std::exit(EXIT_FAILURE);
#endif
}
- return {extract_atime(st), extract_mtime(st)};
+ Times res;
+ res.access = extract_atime(st);
+ res.write = extract_mtime(st);
+ return res;
}
namespace {
@@ -500,9 +503,8 @@ TEST_CASE(last_write_time_symlink_test)
TEST_CHECK(CompareTime(LastWriteTime(file), new_time));
TEST_CHECK(CompareTime(LastAccessTime(sym), old_times.access));
- std::pair<TimeSpec, TimeSpec> sym_times = GetSymlinkTimes(sym);
- TEST_CHECK(CompareTime(sym_times.first, old_sym_times.first));
- TEST_CHECK(CompareTime(sym_times.second, old_sym_times.second));
+ Times sym_times = GetSymlinkTimes(sym);
+ TEST_CHECK(CompareTime(sym_times.write, old_sym_times.write));
}