diff options
author | Jim Meyering <meyering@fb.com> | 2016-11-08 19:57:41 -0600 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2016-11-13 17:09:57 -0800 |
commit | 4d4d8bccc341941404dc92d0adc057e67014e2ea (patch) | |
tree | faf04706ebd51a3c7e369110fb23bf80b83cef86 /tests/tail-2 | |
parent | eba871cd3237e8b7dcd9552f544b365934767849 (diff) | |
download | coreutils-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/tail-2')
-rwxr-xr-x | tests/tail-2/pid.sh | 6 | ||||
-rwxr-xr-x | tests/tail-2/wait.sh | 18 |
2 files changed, 8 insertions, 16 deletions
diff --git a/tests/tail-2/pid.sh b/tests/tail-2/pid.sh index 9e73b8448..ba67b46a6 100755 --- a/tests/tail-2/pid.sh +++ b/tests/tail-2/pid.sh @@ -31,8 +31,7 @@ for mode in '' '---disable-inotify'; do tail -f $mode here & pid=$! # Ensure that tail --pid=PID does not exit when PID is alive. - timeout 1 tail -f -s.1 --pid=$pid $mode here - test $? = 124 || fail=1 + returns_ 124 timeout 1 tail -f -s.1 --pid=$pid $mode here || fail=1 cleanup_ @@ -44,8 +43,7 @@ for mode in '' '---disable-inotify'; do test $ret = 0 || fail=1 # Ensure tail doesn't wait for data when PID is dead - timeout 10 tail -f -s10 --pid=$PID_T_MAX $mode empty - test $? = 124 && fail=1 + returns_ 124 timeout 10 tail -f -s10 --pid=$PID_T_MAX $mode empty && fail=1 done Exit $fail diff --git a/tests/tail-2/wait.sh b/tests/tail-2/wait.sh index 59f796abe..1b5432754 100755 --- a/tests/tail-2/wait.sh +++ b/tests/tail-2/wait.sh @@ -35,29 +35,23 @@ cleanup_() { kill $pid 2>/dev/null && wait $pid; } fastpoll='-s.1 --max-unchanged-stats=1' for mode in '' '---disable-inotify'; do - timeout 10 tail $fastpoll -f $mode not_here - test $? = 124 && fail=1 + returns_ 124 timeout 10 tail $fastpoll -f $mode not_here && fail=1 if test ! -r unreadable; then # can't test this when root - timeout 10 tail $fastpoll -f $mode unreadable - test $? = 124 && fail=1 + returns_ 124 timeout 10 tail $fastpoll -f $mode unreadable && fail=1 fi - timeout .1 tail $fastpoll -f $mode here 2>tail.err - test $? = 124 || fail=1 + returns_ 124 timeout .1 tail $fastpoll -f $mode here 2>tail.err || fail=1 # 'tail -F' must wait in any case. - timeout .1 tail $fastpoll -F $mode here 2>>tail.err - test $? = 124 || fail=1 + returns_ 124 timeout .1 tail $fastpoll -F $mode here 2>>tail.err || fail=1 if test ! -r unreadable; then # can't test this when root - timeout .1 tail $fastpoll -F $mode unreadable - test $? = 124 || fail=1 + returns_ 124 timeout .1 tail $fastpoll -F $mode unreadable || fail=1 fi - timeout .1 tail $fastpoll -F $mode not_here - test $? = 124 || fail=1 + returns_ 124 timeout .1 tail $fastpoll -F $mode not_here || fail=1 grep -Ev "$inotify_failed_re" tail.err > x mv x tail.err |