coreutils
coreutils copied to clipboard
tests: Harden two tests, prevent 4 flaky tests (cat, numfmt, sort, split, tee)
This PR improves the tests:
- Two tests were unnecessarily lax (
test_tee_no_more_writeable_1ignored memory problems, the newtest_check_unique_combinedexercises an input that wasn't possible before clap#2624) - Four tests had the potential to flake: They were writing to the stdin of a process that might have already terminated.
My goal was to find any flaky tests like 9995c637aa5de190ddce0abc4be36d773797f1bc: When we write a large buffer to the stdin of a process that will fail at some point, then a race happens:
- Perhaps the write happens first, and the kernel buffer is large enough to accept it entirely. In that case, the write is successful, and the writer thread terminates normally. This is likely to happen on a developer machine.
- Perhaps the write happens later, and the child process executes first. This will close the pipe. If we then try to write to it, the write will fail. This is unlikely to happen, but not impossible on a busy CI machine.
Arguably, these tests are unlikely to be the cause of any flakiness, but let's fix them anyway: Either it improves the situation, or makes no difference.
Oh look! Other tests which have exactly the same setup (writing to stdin of a process that is failing due to cmdline args) cause real problems.
Let's merge this PR and avoid these problems with cat, numfmt, sort, split, and tee! :)
Oh look! Yet another test has exactly the same setup (writing to stdin of a process that is exiting before reading anything) and causes real problems.
Let's merge this PR and avoid these problems with cat, numfmt, sort, split, and tee! :)