From 01eb913c05969182c4aadb51fd98f96355f61575 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 19:37:58 -0700 Subject: [PATCH 1/3] test_install: Add sleeps To ensure timestamps don't match. Fixes #1927. --- tests/by-util/test_install.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 411de61f3..957bb54d5 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,7 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +use std::thread::sleep; #[test] fn test_install_help() { @@ -471,6 +472,7 @@ fn test_install_copy_then_compare_file_with_extra_mode() { let mut file2_meta = at.metadata(file2); let before = FileTime::from_last_modification_time(&file2_meta); + sleep(std::time::Duration::from_millis(1000)); scene .ucmd() @@ -487,6 +489,8 @@ fn test_install_copy_then_compare_file_with_extra_mode() { assert!(before != after_install_sticky); + sleep(std::time::Duration::from_millis(1000)); + // dest file still 1644, so need_copy ought to return `true` scene .ucmd() From ebb4568d5270582edc6da5d91976be2b90604088 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 22:46:57 -0700 Subject: [PATCH 2/3] Forgot to unignore the test --- tests/by-util/test_install.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 957bb54d5..d12dc0b8d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -453,7 +453,6 @@ fn test_install_copy_then_compare_file() { #[test] #[cfg(target_os = "linux")] -#[ignore] fn test_install_copy_then_compare_file_with_extra_mode() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From a655117a5fe3bfe09ed02eae852a519714d603c9 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sun, 28 Mar 2021 00:42:25 -0700 Subject: [PATCH 3/3] `std::thread::sleep` needs target_os Co-authored-by: Sylvestre Ledru --- tests/by-util/test_install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index d12dc0b8d..af48a0e66 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,7 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +#[cfg(target_os = "linux")] use std::thread::sleep; #[test]