diff options
Diffstat (limited to 'tests/cp')
-rwxr-xr-x | tests/cp/acl.sh | 2 | ||||
-rwxr-xr-x | tests/cp/cp-a-selinux.sh | 9 | ||||
-rwxr-xr-x | tests/cp/cp-mv-enotsup-xattr.sh | 8 | ||||
-rwxr-xr-x | tests/cp/proc-zero-len.sh | 6 | ||||
-rwxr-xr-x | tests/cp/reflink-perm.sh | 4 |
5 files changed, 16 insertions, 13 deletions
diff --git a/tests/cp/acl.sh b/tests/cp/acl.sh index 0dc9f882d..36a5d298c 100755 --- a/tests/cp/acl.sh +++ b/tests/cp/acl.sh @@ -53,7 +53,7 @@ test "$acl1" = "$acl2" || fail=1 echo > a/file || framework_failure_ # add some data test -s a/file || framework_failure_ cp -p --attributes-only a/file b/ || fail=1 -test -s b/file && fail=1 +compare /dev/null b/file || fail=1 acl2=$(cd b && getfacl file) || framework_failure_ test "$acl1" = "$acl2" || fail=1 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 diff --git a/tests/cp/cp-mv-enotsup-xattr.sh b/tests/cp/cp-mv-enotsup-xattr.sh index 11809892a..f46977b60 100755 --- a/tests/cp/cp-mv-enotsup-xattr.sh +++ b/tests/cp/cp-mv-enotsup-xattr.sh @@ -69,19 +69,19 @@ grep -F "$xattr_pair" out_a >/dev/null \ # This should pass without diagnostics cp -a xattr/a noxattr/ 2>err || fail=1 test -s noxattr/a || fail=1 # destination file must not be empty -test -s err && fail=1 # there must be no stderr output +compare /dev/null err || fail=1 rm -f err noxattr/a # This should pass without diagnostics (new file) cp --preserve=all xattr/a noxattr/ 2>err || fail=1 test -s noxattr/a || fail=1 # destination file must not be empty -test -s err && fail=1 # there must be no stderr output +compare /dev/null err || fail=1 # This should pass without diagnostics (existing file) cp --preserve=all xattr/a noxattr/ 2>err || fail=1 test -s noxattr/a || fail=1 # destination file must not be empty -test -s err && fail=1 # there must be no stderr output +compare /dev/null err || fail=1 rm -f err noxattr/a @@ -104,7 +104,7 @@ rm -f err noxattr/a # This should pass without diagnostics mv xattr/a noxattr/ 2>err || fail=1 test -s noxattr/a || fail=1 # destination file must not be empty -test -s err && fail=1 # there must be no stderr output +compare /dev/null err || fail=1 # This should pass and copy xattrs of the symlink # since the xattrs used here are not in the 'user.' namespace. diff --git a/tests/cp/proc-zero-len.sh b/tests/cp/proc-zero-len.sh index 3369cfb3c..3fcd5aab1 100755 --- a/tests/cp/proc-zero-len.sh +++ b/tests/cp/proc-zero-len.sh @@ -37,8 +37,10 @@ cp $f exp 2>err \ # Don't simply compare contents; they might differ, # e.g., if CPU freq changes between cat and cp invocations. # Instead, simply compare whether they're both nonempty. -test -s out && { rm -f out; echo nonempty > out; } -test -s exp && { rm -f exp; echo nonempty > exp; } +test -s out \ + && { rm -f out; echo nonempty > out; } +test -s exp \ + && { rm -f exp; echo nonempty > exp; } compare exp out || fail=1 diff --git a/tests/cp/reflink-perm.sh b/tests/cp/reflink-perm.sh index 52f83fce1..52f5e2576 100755 --- a/tests/cp/reflink-perm.sh +++ b/tests/cp/reflink-perm.sh @@ -38,8 +38,8 @@ test copy -nt file && fail=1 # Ensure that --attributes-only overrides --reflink completely echo > file2 # file with data cp --reflink=auto --preserve --attributes-only file2 empty_copy || fail=1 -test -s empty_copy && fail=1 +compare /dev/null empty_copy || fail=1 cp --reflink=always --preserve --attributes-only file2 empty_copy || fail=1 -test -s empty_copy && fail=1 +compare /dev/null empty_copy || fail=1 Exit $fail |