From 48b4093d634bdf4368b8d8be22d4fee6264663f8 Mon Sep 17 00:00:00 2001 From: Zhiwei Liang Date: Thu, 8 Oct 2026 02:11:08 -0400 Subject: [PATCH] test: fix flaky test_chown_no_dereference_symlink_to_dir On the Android emulator, the link's ctime did not change between its creation and `chown -h`, because the file system clock had not ticked. Sleep 100 ms before `chown`, as test_ls_order_time does. Signed-off-by: Zhiwei Liang --- tests/by-util/test_chown.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 34b37e69e..3c5bd190f 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -947,6 +947,10 @@ fn test_chown_no_dereference_symlink_to_dir() { let dir_meta_before = std::fs::metadata(at.plus("dir")).unwrap(); let dir_ctime_before = (dir_meta_before.ctime(), dir_meta_before.ctime_nsec()); + // Let the file system clock move past the link's ctime. On some systems, + // such as the Android emulator, it advances in coarse steps. + std::thread::sleep(std::time::Duration::from_millis(100)); + scene .ucmd() .arg("--no-dereference")