1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

tail: fix test that disables output in bash shell (#8157)

* tail: fix test that disables output in bash shell

* tail: fix platform related issues after test change

* tail: use new imports on same platforms as test they are needed for
This commit is contained in:
Will Shuttleworth 2025-06-13 03:44:18 -04:00 committed by GitHub
parent 6d44ddea67
commit e5bde07591
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,6 +13,20 @@
clippy::cast_possible_truncation clippy::cast_possible_truncation
)] )]
#[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(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 pretty_assertions::assert_eq;
use rand::distr::Alphanumeric; use rand::distr::Alphanumeric;
use rstest::rstest; use rstest::rstest;
@ -679,7 +693,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 // FIXME: FreeBSD: See issue https://github.com/uutils/coreutils/issues/4306
// Fails intermittently in the CI, but couldn't reproduce the failure locally. // Fails intermittently in the CI, but couldn't reproduce the failure locally.
#[test] #[test]
@ -694,12 +708,7 @@ fn test_follow_with_pid() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
#[cfg(unix)]
let dummy_cmd = "sh"; let dummy_cmd = "sh";
#[cfg(windows)]
let dummy_cmd = "cmd";
let mut dummy = Command::new(dummy_cmd).spawn().unwrap(); let mut dummy = Command::new(dummy_cmd).spawn().unwrap();
let pid = dummy.id(); let pid = dummy.id();
@ -734,7 +743,7 @@ fn test_follow_with_pid() {
.stdout_only_fixture("foobar_follow_multiple_appended.expected"); .stdout_only_fixture("foobar_follow_multiple_appended.expected");
// kill the dummy process and give tail time to notice this // 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(); let _ = dummy.wait();
child.delay(DEFAULT_SLEEP_INTERVAL_MILLIS); child.delay(DEFAULT_SLEEP_INTERVAL_MILLIS);