From e89abc80ea43065a726ade191b810af53ec6158a Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Mon, 31 Jan 2022 22:25:05 +0100 Subject: [PATCH] test: fix flaky uv_fs_lutime test (#3424) Disable `atime` testing for symlink as this test is dependant on a race condition on some OSes (Linux is one) as `lstat` updates the `atime`. As both `mtime` and `atime` are set by the same syscall, barring an eventual kernel bug, this test does not omit any error case. --- test/test-fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test-fs.c b/test/test-fs.c index aecf10f9..c879f629 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -851,7 +851,12 @@ static void check_utime(const char* path, #endif st_atim = s->st_atim.tv_sec + s->st_atim.tv_nsec / 1e9; st_mtim = s->st_mtim.tv_sec + s->st_mtim.tv_nsec / 1e9; - ASSERT_DOUBLE_EQ(st_atim, atime); + /* + * Linux does not allow reading reliably the atime of a symlink + * since readlink() can update it + */ + if (!test_lutime) + ASSERT_DOUBLE_EQ(st_atim, atime); ASSERT_DOUBLE_EQ(st_mtim, mtime); }