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

cat: don't flake even on exotic pipe buffer sizes

See also 9995c637aa.

There is a race condition between the writing thread and the command.
It is easily possible that on the developer's machine, the writing
thread is always faster, filling the kernel's buffer of the stdin pipe,
thus succeeding the write. It is also easily possible that on the busy
CI machines, the child command runs first for whatever reason, and exits
early, thus killing the pipe, which causes the later write to fail. This
results in a flaky test. Let's prevent flaky tests.
This commit is contained in:
Ben Wiederhake 2024-02-23 05:02:33 +01:00
parent 9fa808fb5e
commit bcd2d888a1

View file

@ -175,6 +175,7 @@ fn test_piped_to_dev_full() {
s.ucmd()
.set_stdout(dev_full)
.pipe_in_fixture("alpha.txt")
.ignore_stdin_write_error()
.fails()
.stderr_contains("No space left on device");
}
@ -224,6 +225,7 @@ fn test_three_directories_and_file_and_stdin() {
"test_directory3",
])
.pipe_in("stdout bytes")
.ignore_stdin_write_error()
.fails()
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
.stdout_is(