mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
tests/util: Fix intermittent failing uchild tests on macos. The ci can be slow, so increase delay.
Closes #4223
This commit is contained in:
parent
01153a701f
commit
7ef9504952
1 changed files with 15 additions and 25 deletions
|
@ -2548,9 +2548,18 @@ mod tests {
|
||||||
fn test_uchild_when_run_no_wait_with_a_non_blocking_util() {
|
fn test_uchild_when_run_no_wait_with_a_non_blocking_util() {
|
||||||
let ts = TestScenario::new("echo");
|
let ts = TestScenario::new("echo");
|
||||||
let mut child = ts.ucmd().arg("hello world").run_no_wait();
|
let mut child = ts.ucmd().arg("hello world").run_no_wait();
|
||||||
child.delay(500);
|
|
||||||
|
|
||||||
// check `child.is_alive()` is working
|
// check `child.is_alive()` and `child.delay()` is working
|
||||||
|
let mut trials = 10;
|
||||||
|
while child.is_alive() {
|
||||||
|
if trials <= 0 {
|
||||||
|
panic!("Assertion failed: child process is still alive.")
|
||||||
|
}
|
||||||
|
|
||||||
|
child.delay(500);
|
||||||
|
trials -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
assert!(!child.is_alive());
|
assert!(!child.is_alive());
|
||||||
|
|
||||||
// check `child.is_not_alive()` is working
|
// check `child.is_not_alive()` is working
|
||||||
|
@ -2599,9 +2608,9 @@ mod tests {
|
||||||
at.touch("a/empty");
|
at.touch("a/empty");
|
||||||
|
|
||||||
#[cfg(target_vendor = "apple")]
|
#[cfg(target_vendor = "apple")]
|
||||||
let delay: u64 = 1000;
|
let delay: u64 = 2000;
|
||||||
#[cfg(not(target_vendor = "apple"))]
|
#[cfg(not(target_vendor = "apple"))]
|
||||||
let delay: u64 = 500;
|
let delay: u64 = 1000;
|
||||||
|
|
||||||
let yes = if cfg!(windows) { "y\r\n" } else { "y\n" };
|
let yes = if cfg!(windows) { "y\r\n" } else { "y\n" };
|
||||||
|
|
||||||
|
@ -2641,29 +2650,10 @@ mod tests {
|
||||||
.with_exact_output(44, 0)
|
.with_exact_output(44, 0)
|
||||||
.stdout_only(expected);
|
.stdout_only(expected);
|
||||||
|
|
||||||
#[cfg(windows)]
|
let expected = "removed directory 'a'\n";
|
||||||
let expected = "rm: descend into directory 'a'? \
|
|
||||||
rm: remove regular empty file 'a\\empty'? \
|
|
||||||
removed 'a\\empty'\n\
|
|
||||||
rm: remove directory 'a'? \
|
|
||||||
removed directory 'a'\n";
|
|
||||||
#[cfg(unix)]
|
|
||||||
let expected = "rm: descend into directory 'a'? \
|
|
||||||
rm: remove regular empty file 'a/empty'? \
|
|
||||||
removed 'a/empty'\n\
|
|
||||||
rm: remove directory 'a'? \
|
|
||||||
removed directory 'a'\n";
|
|
||||||
|
|
||||||
child.write_in(yes);
|
child.write_in(yes);
|
||||||
child
|
child.wait().unwrap().stdout_only(expected).success();
|
||||||
.delay(delay)
|
|
||||||
.kill()
|
|
||||||
.make_assertion()
|
|
||||||
.is_not_alive()
|
|
||||||
.with_all_output()
|
|
||||||
.stdout_only(expected);
|
|
||||||
|
|
||||||
child.wait().unwrap().no_stdout().no_stderr().success();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "tail")]
|
#[cfg(feature = "tail")]
|
||||||
|
|
Loading…
Reference in a new issue