Merge pull request #2146 from tertsdiepraam/ls/fix_birthtime_test

`ls`: add birth time for windows and attempt to fix tests
This commit is contained in:
Sylvestre Ledru
2021-04-30 18:25:03 +02:00
committed by GitHub
2 changed files with 4 additions and 9 deletions
+1
View File
@@ -1559,6 +1559,7 @@ fn get_system_time(md: &Metadata, config: &Config) -> Option<SystemTime> {
match config.time {
Time::Modification => md.modified().ok(),
Time::Access => md.accessed().ok(),
Time::Birth => md.created().ok(),
_ => None,
}
}
+3 -9
View File
@@ -559,8 +559,6 @@ fn test_ls_long_ctime() {
}
#[test]
#[cfg(not(windows))]
// This test is currently failing on windows
fn test_ls_order_birthtime() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
@@ -570,15 +568,11 @@ fn test_ls_order_birthtime() {
After creating the first file try to sync it.
This ensures the file gets created immediately instead of being saved
inside the OS's IO operation buffer.
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
Without this, both files might accidentally be created at the same time.
*/
at.make_file("test-birthtime-1").sync_all().unwrap();
std::thread::sleep(std::time::Duration::from_millis(1));
at.make_file("test-birthtime-2");
at.touch("test-birthtime-1");
at.make_file("test-birthtime-2").sync_all().unwrap();
at.open("test-birthtime-1");
let result = scene.ucmd().arg("--time=birth").arg("-t").run();