summaryrefslogtreecommitdiff
path: root/tests/misc/head-write-error.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2016-11-08 19:57:41 -0600
committerJim Meyering <meyering@fb.com>2016-11-13 17:09:57 -0800
commit4d4d8bccc341941404dc92d0adc057e67014e2ea (patch)
treefaf04706ebd51a3c7e369110fb23bf80b83cef86 /tests/misc/head-write-error.sh
parenteba871cd3237e8b7dcd9552f544b365934767849 (diff)
downloadcoreutils-4d4d8bccc341941404dc92d0adc057e67014e2ea.tar.xz
tests: use "returns_" rather than explicit comparison with "$?"
The previous "returns_"-using change failed to convert many uses of "$?". Convert all but two of the remaining ones. * tests/ls/stat-vs-dirent.sh: Likewise. * tests/misc/head-write-error.sh: Likewise. * tests/misc/nice.sh: Likewise. * tests/misc/nohup.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/sync.sh: Likewise. * tests/tail-2/pid.sh: Likewise. * tests/tail-2/wait.sh: Likewise. Thanks to Bernhard Volker for spotting this.
Diffstat (limited to 'tests/misc/head-write-error.sh')
-rwxr-xr-xtests/misc/head-write-error.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/misc/head-write-error.sh b/tests/misc/head-write-error.sh
index 4c021f520..1e8e566c3 100755
--- a/tests/misc/head-write-error.sh
+++ b/tests/misc/head-write-error.sh
@@ -36,14 +36,13 @@ printf '%s\n' "head: error writing 'standard output'" > exp
for item in lines bytes; do
for N in 0 1; do
# pipe case
- yes | timeout 10s head --$item=-$N > /dev/full 2> errt && fail=1
- test $? = 124 && fail=1
+ yes | returns_ 1 timeout 10s head --$item=-$N > /dev/full 2> errt || fail=1
sed 's/\(head:.*\):.*/\1/' errt > err
compare exp err || fail=1
# seekable case
- timeout 10s head --$item=-$N bigseek > /dev/full 2> errt && fail=1
- test $? = 124 && fail=1
+ returns_ 1 timeout 10s head --$item=-$N bigseek > /dev/full 2> errt \
+ || fail=1
sed 's/\(head:.*\):.*/\1/' errt > err
compare exp err || fail=1
done