summaryrefslogtreecommitdiff
path: root/tests/cp
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-12-17 14:42:34 +0000
committerPádraig Brady <P@draigBrady.com>2015-12-17 16:59:46 +0000
commitf8a9c8c343b073f92d9cf149fbf6c1d0e425bfb3 (patch)
tree9a811aba627ddb4ff9d8e79dabab9c637a7ed801 /tests/cp
parent5148302771f1e36f3ea3e7ed33e55bd7a7a1cc3b (diff)
downloadcoreutils-f8a9c8c343b073f92d9cf149fbf6c1d0e425bfb3.tar.xz
tests: avoid root test false failure without libxattr
* tests/cp/cp-mv-enotsup-xattr.sh: Exclude xattr copy verification when libxattr is not available.
Diffstat (limited to 'tests/cp')
-rwxr-xr-xtests/cp/cp-mv-enotsup-xattr.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/cp/cp-mv-enotsup-xattr.sh b/tests/cp/cp-mv-enotsup-xattr.sh
index 13f477d64..b9f2b5466 100755
--- a/tests/cp/cp-mv-enotsup-xattr.sh
+++ b/tests/cp/cp-mv-enotsup-xattr.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Ensure that mv, cp -a and cp --preserve=xattr(all) options do work
-# as expected on file system without their support and do show correct
+# as expected on file systems without their support and do show correct
# diagnostics when required
# Copyright (C) 2009-2015 Free Software Foundation, Inc.
@@ -85,7 +85,7 @@ compare /dev/null err || fail=1
rm -f err noxattr/a
-# This should fail with coresponding diagnostics
+# This should fail with corresponding diagnostics
cp -a --preserve=xattr xattr/a noxattr/ 2>err && fail=1
if grep '^#define USE_XATTR 1' $CONFIG_HEADER > /dev/null; then
cat <<\EOF > exp
@@ -117,8 +117,11 @@ txattr='trusted.overlay.whiteout'
if setfattr -hn "$txattr" -v y xattr/symlink; then
# Note only root can read the 'trusted.' namespace
if getfattr -h -m- -d xattr/symlink | grep -F "$txattr"; then
- mv xattr/symlink noxattr/ || fail=1
- getfattr -h -m- -d noxattr/symlink | grep -F "$txattr" || fail=1
+ mv xattr/symlink noxattr/ 2>err || fail=1
+ if grep '^#define USE_XATTR 1' $CONFIG_HEADER > /dev/null; then
+ getfattr -h -m- -d noxattr/symlink | grep -F "$txattr" || fail=1
+ fi
+ compare /dev/null err || fail=1
else
echo "failed to get '$txattr' xattr. skipping symlink check" >&2
fi