summaryrefslogtreecommitdiff
path: root/tests/test-lib.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2007-10-09 09:58:27 +0200
committerJim Meyering <meyering@redhat.com>2007-10-09 10:13:39 +0200
commit4597f40b7fa6f93ec798a6f0143b51c1e555a837 (patch)
treed455f2ab3f9aca9f9f8652eadd8d57df6c04d859 /tests/test-lib.sh
parent91bef1af623fc76d767ffb0af5c6d61c6f6383c5 (diff)
downloadcoreutils-4597f40b7fa6f93ec798a6f0143b51c1e555a837.tar.xz
Skip the chcon test on a system with no SELinux support.
* tests/test-lib.sh (require_selinux_): New function. * tests/misc/chcon: Use it. * tests/misc/selinux: Use it here, too. * tests/cp/cp-a-selinux: and here. * tests/selinux: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove selinux. Reported by Mike Frysinger and Bauke Jan Douma.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r--tests/test-lib.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 9d47242e4..66fbc1dc4 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -39,6 +39,16 @@ skip_if_()
esac
}
+require_selinux_()
+{
+ case `ls -Zd .` in
+ '? .'|'unlabeled .')
+ skip_test_ "this system (or maybe just" \
+ "the current file system) lacks SELinux support"
+ ;;
+ esac
+}
+
skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; }
framework_failure() { error_ 'failure in testing framework'; }
@@ -73,3 +83,7 @@ elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
else
compare() { cmp "$@"; }
fi
+
+# Local Variables:
+# indent-tabs-mode: nil
+# End: