From: Pádraig Brady
Date: Mon, 16 Feb 2026 12:54:35 +0000 (+0000)
Subject: tests: use system ENOTSUP message
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17fb316388bfcc18b9b370f0231817fd2d95481c;p=thirdparty%2Fcoreutils.git
tests: use system ENOTSUP message
* tests/cp/cp-mv-enotsup-xattr.sh: Don't hardcode "Operation not
supported".
* tests/cp/cp-a-selinux.sh: Likewise.
---
diff --git a/tests/cp/cp-a-selinux.sh b/tests/cp/cp-a-selinux.sh
index de7a854c66..970851e889 100755
--- a/tests/cp/cp-a-selinux.sh
+++ b/tests/cp/cp-a-selinux.sh
@@ -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
diff --git a/tests/cp/cp-mv-enotsup-xattr.sh b/tests/cp/cp-mv-enotsup-xattr.sh
index 4a31df8376..8936b5c850 100755
--- a/tests/cp/cp-mv-enotsup-xattr.sh
+++ b/tests/cp/cp-mv-enotsup-xattr.sh
@@ -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 <