diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-05-06 02:37:43 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-05-07 00:06:00 +0100 |
commit | 8840a00cd79b8beae72b1a0ec6b9e64912633c13 (patch) | |
tree | 32cba40c4c2d88a8cf75c7721742e367bd9a0398 /tests/misc | |
parent | 0b04ff22edcd7b75f0929f5bede7d814d100e2f1 (diff) | |
download | coreutils-8840a00cd79b8beae72b1a0ec6b9e64912633c13.tar.xz |
tests: improve diagnostics when asserting empty files
* tests/chmod/c-option.sh: Use `compare /dev/null ... || fail=1`
rather than `test -s ... && fail=1`, so that the file contents
are output, thus improving diagnostics for failing tests.
* tests/cp/acl.sh: Likewise.
* tests/cp/cp-a-selinux.sh: Likewise.
* tests/cp/cp-mv-enotsup-xattr.sh: Likewise.
* tests/cp/reflink-perm.sh: Likewise.
* tests/dd/misc.sh: Likewise.
* tests/misc/env-null.sh: Likewise.
* tests/misc/env.sh: Likewise.
* tests/misc/nice.sh: Likewise.
* tests/misc/nohup.sh: Likewise.
* tests/misc/printenv.sh: Likewise.
* tests/misc/xattr.sh: Likewise.
* tests/mv/update.sh: Likewise.
* tests/rm/deep-2.sh: Likewise.
* tests/rm/read-only.sh: Likewise.
* tests/split/r-chunk.sh: Likewise.
* tests/tail-2/follow-stdin.sh: Likewise.
* tests/tail-2/inotify-race.sh: Likewise.
* tests/tail-2/wait.sh: Likewise.
* tests/touch/no-dereference.sh: Likewise.
* cfg.mk (sc_prohibit_test_empty:): New syntax-check.
* tests/cp/proc-zero-len.sh: Adjust to avoid false syntax-check failure.
* tests/cp/proc-zero-len.sh: Likewise.
* tests/mv/part-symlink.sh: Likewise.
* tests/tail-2/infloop-1.sh: Likewise.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/env-null.sh | 4 | ||||
-rwxr-xr-x | tests/misc/env.sh | 6 | ||||
-rwxr-xr-x | tests/misc/nice.sh | 4 | ||||
-rwxr-xr-x | tests/misc/nohup.sh | 6 | ||||
-rwxr-xr-x | tests/misc/printenv.sh | 4 | ||||
-rwxr-xr-x | tests/misc/xattr.sh | 2 |
6 files changed, 13 insertions, 13 deletions
diff --git a/tests/misc/env-null.sh b/tests/misc/env-null.sh index 6544fb37b..9b9c95e73 100755 --- a/tests/misc/env-null.sh +++ b/tests/misc/env-null.sh @@ -40,7 +40,7 @@ compare out1 out2 || fail=1 # env -0 does not work if a command is specified. env -0 echo hi > out test $? = 125 || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 # Test env -0 on a one-variable environment. printf 'a=b\nc=\0' > exp || framework_failure_ @@ -53,7 +53,7 @@ env "$(printf 'a=b\nc=')" printenv -0 a > out || fail=1 compare exp out || fail=1 env -u a printenv -0 a > out test $? = 1 || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 env -u b "$(printf 'a=b\nc=')" printenv -0 b a > out test $? = 1 || fail=1 compare exp out || fail=1 diff --git a/tests/misc/env.sh b/tests/misc/env.sh index 877a5e35e..c4b97377a 100755 --- a/tests/misc/env.sh +++ b/tests/misc/env.sh @@ -25,11 +25,11 @@ print_ver_ env a=1 export a env - > out || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 env -i > out || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 env -u a -i -u a -- > out || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 env -i -- a=b > out || fail=1 echo a=b > exp || framework_failure_ compare exp out || fail=1 diff --git a/tests/misc/nice.sh b/tests/misc/nice.sh index 8efb7d87d..26a01ca9f 100755 --- a/tests/misc/nice.sh +++ b/tests/misc/nice.sh @@ -81,12 +81,12 @@ if test x$(nice -n -1 nice 2> /dev/null) = x0 ; then if test -w /dev/full && test -c /dev/full; then nice -n -1 nice > out 2> /dev/full test $? = 125 || fail=1 - test -s out && fail=1 + compare /dev/null out || fail=1 fi else # superuser - change succeeds nice -n -1 nice 2> err || fail=1 - test -s err && fail=1 + compare /dev/null err || fail=1 test x$(nice -n -1 nice) = x-1 || fail=1 test x$(nice --1 nice) = x-1 || fail=1 fi diff --git a/tests/misc/nohup.sh b/tests/misc/nohup.sh index 2328b43e2..b3f4274ce 100755 --- a/tests/misc/nohup.sh +++ b/tests/misc/nohup.sh @@ -73,7 +73,7 @@ if test -w /dev/full && test -c /dev/full; then nohup echo hi 2> /dev/full test $? = 125 || fail=1 test -f nohup.out || fail=1 - test -s nohup.out && fail=1 + compare /dev/null nohup.out || fail=1 rm -f nohup.out exit $fail ) || fail=1 @@ -86,7 +86,7 @@ if test -t 1; then # It must exist. test -f nohup.out || fail=1 # It must be empty. - test -s nohup.out && fail=1 + compare /dev/null nohup.out || fail=1 fi cat <<\EOF > exp || fail=1 @@ -106,7 +106,7 @@ if test -t 1; then # It must exist. test -f nohup.out || fail=1 # It must be empty. - test -s nohup.out && fail=1 + compare /dev/null nohup.out || fail=1 fi cat <<\EOF > exp || fail=1 diff --git a/tests/misc/printenv.sh b/tests/misc/printenv.sh index fb911d004..054b02c25 100755 --- a/tests/misc/printenv.sh +++ b/tests/misc/printenv.sh @@ -37,7 +37,7 @@ fi # Printing a single variable's value. env -- printenv ENV_TEST > out test $? = 1 || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 echo a > exp || framework_failure_ ENV_TEST=a env -- printenv ENV_TEST > out || fail=1 compare exp out || fail=1 @@ -76,6 +76,6 @@ compare exp out || fail=1 # Bug present through coreutils 8.0. env a=b=c printenv a=b > out test $? = 1 || fail=1 -test -s out && fail=1 +compare /dev/null out || fail=1 Exit $fail diff --git a/tests/misc/xattr.sh b/tests/misc/xattr.sh index 269424611..f208090f5 100755 --- a/tests/misc/xattr.sh +++ b/tests/misc/xattr.sh @@ -66,7 +66,7 @@ getfattr -d c >out_c || skip_ "failed to get xattr of file" grep -F "$xattr_pair" out_c || fail=1 # cp's -a option must produce no diagnostics. -cp -a a d 2>err && test -s err && fail=1 +cp -a a d 2>err && { compare /dev/null err || fail=1; } getfattr -d d >out_d || skip_ "failed to get xattr of file" grep -F "$xattr_pair" out_d || fail=1 |