From 967c2e929f49f1c27f3d49807796144363ca2932 Mon Sep 17 00:00:00 2001 From: Will Shuttleworth Date: Wed, 11 Jun 2025 16:10:22 -0400 Subject: [PATCH 1/3] tail: fix test that disables output in bash shell --- tests/by-util/test_tail.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 736182bfee8..851e5900dbf 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -13,6 +13,8 @@ clippy::cast_possible_truncation )] +use nix::sys::signal::{Signal, kill}; +use nix::unistd::Pid; use pretty_assertions::assert_eq; use rand::distr::Alphanumeric; use rstest::rstest; @@ -679,7 +681,7 @@ fn test_follow_invalid_pid() { )); } -// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') This test also breaks tty settings under bash requiring a 'stty sane' or reset. // spell-checker:disable-line +// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') // spell-checker:disable-line // FIXME: FreeBSD: See issue https://github.com/uutils/coreutils/issues/4306 // Fails intermittently in the CI, but couldn't reproduce the failure locally. #[test] @@ -734,7 +736,7 @@ fn test_follow_with_pid() { .stdout_only_fixture("foobar_follow_multiple_appended.expected"); // kill the dummy process and give tail time to notice this - dummy.kill().unwrap(); + kill(Pid::from_raw(i32::try_from(pid).unwrap()), Signal::SIGUSR1).unwrap(); let _ = dummy.wait(); child.delay(DEFAULT_SLEEP_INTERVAL_MILLIS); From bd08230beaeaf79e6ca0f6632cbd804d5dbd150f Mon Sep 17 00:00:00 2001 From: Will Shuttleworth Date: Wed, 11 Jun 2025 17:25:15 -0400 Subject: [PATCH 2/3] tail: fix platform related issues after test change --- tests/by-util/test_tail.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 851e5900dbf..671cc6bf22c 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -13,7 +13,9 @@ clippy::cast_possible_truncation )] +#[cfg(unix)] use nix::sys::signal::{Signal, kill}; +#[cfg(unix)] use nix::unistd::Pid; use pretty_assertions::assert_eq; use rand::distr::Alphanumeric; @@ -696,12 +698,7 @@ fn test_follow_with_pid() { let (at, mut ucmd) = at_and_ucmd!(); - #[cfg(unix)] let dummy_cmd = "sh"; - - #[cfg(windows)] - let dummy_cmd = "cmd"; - let mut dummy = Command::new(dummy_cmd).spawn().unwrap(); let pid = dummy.id(); From 0538f1e73752ebba9fe4a75b26f5ecef50c18a05 Mon Sep 17 00:00:00 2001 From: Will Shuttleworth Date: Wed, 11 Jun 2025 17:47:06 -0400 Subject: [PATCH 3/3] tail: use new imports on same platforms as test they are needed for --- tests/by-util/test_tail.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 671cc6bf22c..e7013328372 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -13,9 +13,19 @@ clippy::cast_possible_truncation )] -#[cfg(unix)] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "android"), + not(target_os = "freebsd") +))] use nix::sys::signal::{Signal, kill}; -#[cfg(unix)] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "android"), + not(target_os = "freebsd") +))] use nix::unistd::Pid; use pretty_assertions::assert_eq; use rand::distr::Alphanumeric;