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 <zhiwei.liang@zliang.me>
This commit is contained in:
Zhiwei Liang authored and Sylvestre Ledru committed 2026-10-08 15:03:28 +02:00
1 parent db40b66b7f
commit 48b4093d63
1 file changed
+4
+4
View File
@@ -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")