1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

ls: add birth time for windows and attampt to fix test

This commit is contained in:
Terts Diepraam 2021-04-29 22:23:04 +02:00
parent b89978a4c9
commit d300895d28
2 changed files with 4 additions and 9 deletions

View file

@ -1559,6 +1559,7 @@ fn get_system_time(md: &Metadata, config: &Config) -> Option<SystemTime> {
match config.time { match config.time {
Time::Modification => md.modified().ok(), Time::Modification => md.modified().ok(),
Time::Access => md.accessed().ok(), Time::Access => md.accessed().ok(),
Time::Birth => md.created().ok(),
_ => None, _ => None,
} }
} }

View file

@ -559,8 +559,6 @@ fn test_ls_long_ctime() {
} }
#[test] #[test]
#[cfg(not(windows))]
// This test is currently failing on windows
fn test_ls_order_birthtime() { fn test_ls_order_birthtime() {
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());
let at = &scene.fixtures; let at = &scene.fixtures;
@ -570,15 +568,11 @@ fn test_ls_order_birthtime() {
After creating the first file try to sync it. After creating the first file try to sync it.
This ensures the file gets created immediately instead of being saved This ensures the file gets created immediately instead of being saved
inside the OS's IO operation buffer. inside the OS's IO operation buffer.
Without this, both files might accidentally be created at the same time, Without this, both files might accidentally be created at the same time.
even though we placed a timeout between creating the two.
https://github.com/uutils/coreutils/pull/1986/#issuecomment-828490651
*/ */
at.make_file("test-birthtime-1").sync_all().unwrap(); at.make_file("test-birthtime-1").sync_all().unwrap();
std::thread::sleep(std::time::Duration::from_millis(1)); at.make_file("test-birthtime-2").sync_all().unwrap();
at.make_file("test-birthtime-2"); at.open("test-birthtime-1");
at.touch("test-birthtime-1");
let result = scene.ucmd().arg("--time=birth").arg("-t").run(); let result = scene.ucmd().arg("--time=birth").arg("-t").run();