Skip to contentSkip to conversation

syscalls: make atime-sensitive tests more robust by extending sleep to 1.5s

PATCH In review Li Wang via ltp 2 participants 3 messages Nov 10, 2025 – Nov 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls: make atime-sensitive tests more robust by extending sleep to 1.5s

These two atime-sensitive tests can still occasionally (< 0.1% probability) fail on fast or virtualized environments (e.g. tmpfs, containers, high load) because the comparison relies on second-level st_atime and the two accesses can land within the same wall-clock second despite a 1.001s delay.

Increase the sleep window from ~1.001s to 1.5s in the following tests to reduce false negatives caused by second-boundary races and scheduler jitter:

=== error logs ===

mount03.c:140: TFAIL: st.st_atime(1750804951) < atime(1750804951)

lstat03.c:38: TFAIL: Expect: file_stat->st_atime != symb_stat->st_atime lstat03.c:39: TFAIL: Expect: file_stat->st_mtime != symb_stat->st_mtime lstat03.c:40: TFAIL: Expect: file_stat->st_ctime != symb_stat->st_ctime

Fixes ff60156bc02f ("mount03: flip to the next second before doing the access")
---
 testcases/kernel/syscalls/lstat/lstat03.c | 2 +-
 testcases/kernel/syscalls/mount/mount03.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/lstat/lstat03.c +1 -1
index a0ff4dc9b..9438e2920 100644
@@ -70,7 +70,7 @@ static void setup(void)
 	SAFE_CLOSE(fd);
 
 	/* change st_atime / st_mtime / st_ctime */
-	usleep(1001000);
+	usleep(1500000);
 
 	SAFE_SYMLINK(FILENAME, SYMBNAME);
 }
testcases/kernel/syscalls/mount/mount03.c +1 -1
index 98be3dc0a..8dd6f3eed 100644
@@ -120,7 +120,7 @@ static void test_file_dir_noatime(int update_fatime, int update_datime)
 	SAFE_CLOSEDIR(test_dir);
 	dir_atime = dir_st.st_atime;
 
-	usleep(1001000);
+	usleep(1500000);
 
 	SAFE_READ(0, otfd, readbuf, sizeof(readbuf));
 	SAFE_FSTAT(otfd, &st);
Signature · 5 lines
2.51.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp