]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls: don't always skip a capability test
authorPádraig Brady <P@draigBrady.com>
Thu, 3 Oct 2024 11:32:45 +0000 (12:32 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 3 Oct 2024 11:41:37 +0000 (12:41 +0100)
* tests/ls/no-cap.sh: Move to being a root only test, since
commit v9.5-132-g2a6bed933 we now need to call setcap
to make the test effective.  Otherwise we would have always
just skipped the test.

tests/local.mk
tests/ls/no-cap.sh

index 2b885798a9722a862b96d7ba5df08d15c237cb7b..3223b58aa7659aca7850c4ad481ca7e9e58cc9b0 100644 (file)
@@ -124,6 +124,7 @@ all_root_tests =                            \
   tests/id/setgid.sh                           \
   tests/install/install-C-root.sh              \
   tests/ls/capability.sh                       \
+  tests/ls/no-cap.sh                           \
   tests/ls/nameless-uid.sh                     \
   tests/chcon/chcon.sh                         \
   tests/chroot/chroot-credentials.sh           \
@@ -638,7 +639,6 @@ all_tests =                                 \
   tests/ls/w-option.sh                         \
   tests/ls/multihardlink.sh                    \
   tests/ls/no-arg.sh                           \
-  tests/ls/no-cap.sh                           \
   tests/ls/selinux-segfault.sh                 \
   tests/ls/quote-align.sh                      \
   tests/ls/size-align.sh                       \
index 3d84c74ff3bac56511a6afcbfe7026a646312a62..7707421fa4876799c89b8476a9aa7931e7725a0d 100755 (executable)
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ ls
 require_strace_ capget
+require_root_
+
+touch file || framework_failure_
+
+setcap 'cap_net_bind_service=ep' file ||
+  skip_ "setcap doesn't work"
 
 LS_COLORS=ca=1; export LS_COLORS
 strace -e capget ls --color=always > /dev/null 2> out || fail=1
 $EGREP 'capget\(' out || skip_ "your ls doesn't call capget"
 
-rm -f out
-
 LS_COLORS=ca=:; export LS_COLORS
 strace -e capget ls --color=always > /dev/null 2> out || fail=1
 $EGREP 'capget\(' out && fail=1