diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2016-01-10 01:44:04 +0100 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2016-01-10 01:51:27 +0100 |
commit | d44ae88199ebf44fe721c06621a7ffc442fa34be (patch) | |
tree | b4b9d5590a1889dcee548528881a7b6c82762461 /tests/misc | |
parent | 3d7b822e4a660e6804963d8e5ac0cdca2aeb3497 (diff) | |
download | coreutils-d44ae88199ebf44fe721c06621a7ffc442fa34be.tar.xz |
tests: fix races wrt output files of background processes
At least the false positive in tail-2/follow-stdin.sh could be seen
on a 4-core i5 system with -j8. Fix similar cases. too.
* tests/tail-2/follow-stdin.sh: Empty the 'out' file in each iteration.
Otherwise, under heavy system load, 'check_tail_output' would see the
expected output from the previous round before tail would have the
chance to come up in the background.
While at it, move the creation of the 'exp' file out of the loop.
* tests/dd/stats.sh: Empty the output file of the background process
here, too.
* tests/misc/cat-buf.sh: Likewise.
* tests/misc/stdbuf.sh: Likewise.
* tests/tail-2/wait.sh: Likewise.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/cat-buf.sh | 1 | ||||
-rwxr-xr-x | tests/misc/stdbuf.sh | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/tests/misc/cat-buf.sh b/tests/misc/cat-buf.sh index f12bb5bc1..a6960b566 100755 --- a/tests/misc/cat-buf.sh +++ b/tests/misc/cat-buf.sh @@ -35,6 +35,7 @@ cat_buf_1() { local delay="$1" + > out || framework_failure_ dd count=1 if=fifo > out & pid=$! (echo 1; sleep $delay; echo 2) | cat -v > fifo wait $pid diff --git a/tests/misc/stdbuf.sh b/tests/misc/stdbuf.sh index a5331deff..7b9aed503 100755 --- a/tests/misc/stdbuf.sh +++ b/tests/misc/stdbuf.sh @@ -66,6 +66,7 @@ stdbuf_linebuffer() local delay="$1" printf '1\n' > exp + > out || framework_failure_ dd count=1 if=fifo > out 2> err & pid=$! (printf '1\n'; sleep $delay; printf '2\n') | stdbuf -oL uniq > fifo wait $pid @@ -80,6 +81,7 @@ stdbuf_unbuffer() # Ensure un buffering stdout takes effect printf '1\n' > exp + > out || framework_failure_ dd count=1 if=fifo > out 2> err & pid=$! (printf '1\n'; sleep $delay; printf '2\n') | stdbuf -o0 uniq > fifo wait $pid |