summaryrefslogtreecommitdiff
path: root/tests/cp/cp-a-selinux.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-05-06 02:37:43 +0100
committerPádraig Brady <P@draigBrady.com>2014-05-07 00:06:00 +0100
commit8840a00cd79b8beae72b1a0ec6b9e64912633c13 (patch)
tree32cba40c4c2d88a8cf75c7721742e367bd9a0398 /tests/cp/cp-a-selinux.sh
parent0b04ff22edcd7b75f0929f5bede7d814d100e2f1 (diff)
downloadcoreutils-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/cp/cp-a-selinux.sh')
-rwxr-xr-xtests/cp/cp-a-selinux.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/cp/cp-a-selinux.sh b/tests/cp/cp-a-selinux.sh
index 3ab7e0e28..db0d68930 100755
--- a/tests/cp/cp-a-selinux.sh
+++ b/tests/cp/cp-a-selinux.sh
@@ -37,7 +37,8 @@ cp -a c d 2>err || framework_failure_
cp --preserve=context c e || framework_failure_
cp --preserve=all c f || framework_failure_
ls -Z d | grep $ctx || fail=1
-test -s err && fail=1 #there must be no stderr output for -a
+# there must be no stderr output for -a
+compare /dev/null err || fail=1
ls -Z e | grep $ctx || fail=1
ls -Z f | grep $ctx || fail=1
@@ -116,7 +117,7 @@ echo > g || framework_failure_
# succeed (giving no diagnostics), yet leaving the destination file empty.
cp -a f g 2>err || fail=1
test -s g || fail=1 # The destination file must not be empty.
-test -s err && fail=1 # There must be no stderr output.
+compare /dev/null err || fail=1
# =====================================================
# Here, we expect cp to succeed and not warn with "Operation not supported"
@@ -151,7 +152,7 @@ echo > g
# security context through NFS or a mount with fixed context.
cp --preserve=context f g 2> out && fail=1
# Here, we *do* expect the destination to be empty.
-test -s g && fail=1
+compare /dev/null g || fail=1
sed "s/ .g'.*//" out > k
mv k out
compare exp out || fail=1
@@ -161,7 +162,7 @@ echo > g
# Check if -a option doesn't silence --preserve=context option diagnostics
cp -a --preserve=context f g 2> out2 && fail=1
# Here, we *do* expect the destination to be empty.
-test -s g && fail=1
+compare /dev/null g || fail=1
sed "s/ .g'.*//" out2 > k
mv k out2
compare exp out2 || fail=1