summaryrefslogtreecommitdiff
path: root/tests/test-lib.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-05-05 15:17:42 +0200
committerJim Meyering <meyering@redhat.com>2008-05-06 08:21:30 +0200
commitd3dc29c0bef01d16918dfb3b792ef6ed674f7eb9 (patch)
tree2e1dc9c8ae1083cccdc2e11b00c2c41a96a105bc /tests/test-lib.sh
parent6ec3a4f03356a79a49f03e4b8c4d59bca30ca671 (diff)
downloadcoreutils-d3dc29c0bef01d16918dfb3b792ef6ed674f7eb9.tar.xz
tests: skip another test if mcstransd is running
* tests/test-lib.sh (skip_if_mcstransd_is_running_): New function, extracted from... * tests/misc/chcon: ...here. Use function, not open-coded test. * tests/misc/selinux: Use the function here, too. Require root, not non-root. * tests/Makefile.am (root_tests): Add misc/selinux.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r--tests/test-lib.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 5ff301c6f..2083d0c15 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -226,6 +226,21 @@ mkfifo_or_skip_()
fi
}
+skip_if_mcstransd_is_running_()
+{
+ test $# = 0 || framework_failure
+
+ # When mcstransd is running, you'll see only the 3-component
+ # version of file-system context strings. Detect that,
+ # and if it's running, skip this test.
+ local ctx=$(stat --printf='%C\n' .) || framework_failure
+ case $ctx in
+ *:*:*:*) ;; # four components is ok
+ *) # anything else probably means mcstransd is running
+ skip_test_ "unexpected context '$ctx'; turn off mcstransd" ;;
+ esac
+}
+
# Skip the current test if umask doesn't work as usual.
# This test should be run in the temporary directory that ends
# up being removed via the trap commands.