Skip to content

Commit

Permalink
tests/common/util: Add test which provokes the broken pipe error
Browse files Browse the repository at this point in the history
  • Loading branch information
Joining7943 authored and sylvestre committed Sep 10, 2022
1 parent 70714bc commit e860eb8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/common/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1828,4 +1828,22 @@ mod tests {
println!("TEST SKIPPED (cannot run inside CI)");
}
}

// This error was first detected when running tail so tail is used here but
// should fail with any command that takes piped input.
// See also https://github.com/uutils/coreutils/issues/3895
#[test]
fn test_when_piped_input_then_no_broken_pipe() {
let ts = TestScenario::new("tail");
for i in 0..10000 {
dbg!(i);
let test_string = "a\nb\n";
ts.ucmd()
.args(&["-n", "0"])
.pipe_in(test_string)
.succeeds()
.no_stdout()
.no_stderr();
}
}
}

0 comments on commit e860eb8

Please sign in to comment.