mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #3029 from hbina/hbina-test_ls_order_time-is-flaky
test_ls: Do not rely on the system time of metadata'access time
This commit is contained in:
commit
16b397a648
1 changed files with 6 additions and 9 deletions
|
@ -1327,17 +1327,14 @@ fn test_ls_order_time() {
|
||||||
// So the order should be 2 3 4 1
|
// So the order should be 2 3 4 1
|
||||||
for arg in &["-u", "--time=atime", "--time=access", "--time=use"] {
|
for arg in &["-u", "--time=atime", "--time=access", "--time=use"] {
|
||||||
let result = scene.ucmd().arg("-t").arg(arg).succeeds();
|
let result = scene.ucmd().arg("-t").arg(arg).succeeds();
|
||||||
let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap();
|
at.open("test-3").metadata().unwrap().accessed().unwrap();
|
||||||
let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap();
|
at.open("test-4").metadata().unwrap().accessed().unwrap();
|
||||||
|
|
||||||
// It seems to be dependent on the platform whether the access time is actually set
|
// It seems to be dependent on the platform whether the access time is actually set
|
||||||
if file3_access > file4_access {
|
#[cfg(unix)]
|
||||||
result.stdout_only("test-3\ntest-4\ntest-2\ntest-1\n");
|
result.stdout_only("test-3\ntest-4\ntest-2\ntest-1\n");
|
||||||
} else {
|
#[cfg(windows)]
|
||||||
// Access time does not seem to be set on Windows and some other
|
result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n");
|
||||||
// systems so the order is 4 3 2 1
|
|
||||||
result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// test-2 had the last ctime change when the permissions were set
|
// test-2 had the last ctime change when the permissions were set
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue