diff options
author | Eric Fiselier <eric@efcs.ca> | 2019-01-05 21:18:10 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2019-01-05 21:18:10 +0000 |
commit | 5792cf42b7779b3709cdae1598d388a47bfb446a (patch) | |
tree | 9b337a67735b0e96e3bc77c7f5075a5bd1a4b6e7 /libcxx/test/std | |
parent | 74b936ec980f291df8b6985bd32dcd97a4d7024b (diff) | |
download | bcm5719-llvm-5792cf42b7779b3709cdae1598d388a47bfb446a.tar.gz bcm5719-llvm-5792cf42b7779b3709cdae1598d388a47bfb446a.zip |
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.
llvm-svn: 350478
Diffstat (limited to 'libcxx/test/std')
-rw-r--r-- | libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp | 12 |
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)); } |