Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions tests/by-util/test_tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2299,28 +2299,28 @@
.stdout_is(expected_stdout);
}

fn wait_for_output(
child: &mut uutests::util::UChild,
expected_stdout: &str,
expected_stderr: &str,
) {
for _ in 0..500 {
if child.stdout_all() == expected_stdout && child.stderr_all() == expected_stderr {
return;
}
child.delay(10);
}
child
.make_assertion()
.with_all_output()
.stdout_is(expected_stdout)
.stderr_is(expected_stderr);
}

#[test]
#[cfg(all(not(target_os = "android"), not(target_os = "freebsd")))] // FIXME: for currently not working platforms
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
fn test_follow_name_truncate2() {
fn wait_for_output(
child: &mut uutests::util::UChild,
expected_stdout: &str,
expected_stderr: &str,
) {
for _ in 0..500 {
if child.stdout_all() == expected_stdout && child.stderr_all() == expected_stderr {
return;
}
child.delay(10);
}
child
.make_assertion()
.with_all_output()
.stdout_is(expected_stdout)
.stderr_is(expected_stderr);
}

// This test triggers a truncate event while `tail --follow=name file` is running.
// $ ((sleep 1 && echo -n "x\nx\nx\n" >> file && sleep 1 && \
// echo -n "x\n" > file &)>/dev/null 2>&1 &) ; tail --follow=name file
Expand Down Expand Up @@ -2383,7 +2383,7 @@
p.make_assertion_with_delay(delay).is_alive();

at.truncate(source, "x\n");
p.delay(delay);
wait_for_output(&mut p, expected_stdout, "");

p.make_assertion().is_alive();
p.kill()
Expand Down Expand Up @@ -5475,11 +5475,11 @@
let mut p = ucmd
.args(&["-s.1", "--max-unchanged-stats=1", follow, "latest.log"])
.run_no_wait();
p.delay(500);
wait_for_output(&mut p, "a\n", "");
at.append("2026-09-01.log", "b\n");
p.delay(500);
wait_for_output(&mut p, "a\nb\n", "");
at.append("2026-09-01.log", "c\n");
p.delay(500);
wait_for_output(&mut p, "a\nb\nc\n", "");
p.kill()
.make_assertion()
.with_all_output()
Expand All @@ -5490,7 +5490,7 @@
#[test]
#[cfg(target_os = "linux")]
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
fn test_follow_name_symlink_retargeted() {

Check warning on line 5493 in tests/by-util/test_tail.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

WARNING: `cspell`: Unknown word 'retargeted' (file:'tests/by-util/test_tail.rs', line:5493)

Check warning on line 5493 in tests/by-util/test_tail.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

WARNING: `cspell`: Unknown word 'retargeted' (file:'tests/by-util/test_tail.rs', line:5493)
// Pointing the link at another file follows that file, as GNU does.
let (at, mut ucmd) = at_and_ucmd!();
at.write("t1", "A\n");
Expand Down
Loading