1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-15 03:41:57 +02:00

tests: use compare-vs-/dev/null instead of 'test -s'

When some program produces unexpected output, that use of
compare-vs-/dev/null will ensure that the surprising output is
printed in the test's output.  With "test -s err" only, one
would have to instrument and rerun in order to see the offending
output.

* cfg.mk (sc_prohibit_and_fail_1): Exempt 'compare' from this check.
* tests/dd/misc.sh: Change "tests -s ... || fail=1" to
"compare /dev/null ... && fail=1".
* tests/misc/nice.sh: Likewise.
* tests/rm/read-only.sh: Likewise.
* tests/tail-2/inotify-race.sh: Likewise.
* tests/touch/no-dereference.sh: Likewise.

Suggested by Jim Meyering in
http://lists.gnu.org/archive/html/coreutils/2015-01/msg00042.html
This commit is contained in:
Bernhard Voelker
2015-01-14 17:38:12 +01:00
parent 58cff8a009
commit e84046dbe6
6 changed files with 6 additions and 6 deletions

View File

@@ -47,6 +47,6 @@ compare /dev/null out || fail=1
# However, trying to remove an existing file must fail.
rm -f mnt/f > out 2>&1 && fail=1
# with a diagnostic.
test -s out || fail=1
compare /dev/null out && fail=1
Exit $fail