]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: use system ENOTSUP message
authorPádraig Brady <P@draigBrady.com>
Mon, 16 Feb 2026 12:54:35 +0000 (12:54 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 18 Feb 2026 18:31:49 +0000 (18:31 +0000)
* tests/cp/cp-mv-enotsup-xattr.sh: Don't hardcode "Operation not
supported".
* tests/cp/cp-a-selinux.sh: Likewise.

tests/cp/cp-a-selinux.sh
tests/cp/cp-mv-enotsup-xattr.sh

index de7a854c66db9914183c489a2bac357c938f2deb..970851e889a513317d6e75d53a151e021761aae4 100755 (executable)
@@ -23,6 +23,7 @@
 print_ver_ cp
 require_root_
 require_selinux_
+getlimits_
 
 cwd=$(pwd)
 cleanup_() { cd /; umount "$cwd/mnt"; }
@@ -151,14 +152,14 @@ rm -f g
 echo > g
 cp --preserve=all ../f g 2>err || fail=1
 test -s g || fail=1
-grep "Operation not supported" err && fail=1
+grep "$ENOTSUP" err && fail=1
 
 # =====================================================
 # The same as above except destination does not exist
 rm -f g
 cp --preserve=all ../f g 2>err || fail=1
 test -s g || fail=1
-grep "Operation not supported" err && fail=1
+grep "$ENOTSUP" err && fail=1
 
 # An alternative to the following approach would be to run in a confined
 # domain (maybe creating/loading it) that lacks the required permissions
index 4a31df83768b95fbcf7b9deb22df2dd55022cdca..8936b5c850369363334f982e54e8695f40f41f28 100755 (executable)
@@ -20,7 +20,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cp mv
-
+getlimits_
 require_root_
 
 cwd=$(pwd)
@@ -97,8 +97,8 @@ rm -f err noxattr/a
 # 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
-cp: setting attributes for 'noxattr/a': Operation not supported
+cat <<EOF > exp
+cp: setting attributes for 'noxattr/a': $ENOTSUP
 EOF
 else
 cat <<\EOF > exp