aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Savkov <asavkov@redhat.com>2017-06-27 11:54:19 +0200
committerDavid Howells <dhowells@redhat.com>2017-06-27 13:06:39 +0100
commit28e7e32a2768182a70086a2b34e5547c073e7999 (patch)
treeac79995c0c5ccacd79f5162310d17f3de644bd5e
parent62f223825386402db9f92ff4c148b1ab2a65f1b8 (diff)
downloadkeyutils-28e7e32a2768182a70086a2b34e5547c073e7999.tar.gz
tests/bz1031154: skip if selinux is disabled
With selinux disabled the test currently fails trying to setenforce, it should be skipped instead. Found while trying to run in a container where selinux always appears disabled. Signed-off-by: Artem Savkov <asavkov@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--tests/bugzillas/bz1031154/runtest.sh1
-rw-r--r--tests/toolbox.inc.sh9
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/bugzillas/bz1031154/runtest.sh b/tests/bugzillas/bz1031154/runtest.sh
index aee8a28..d90afb4 100644
--- a/tests/bugzillas/bz1031154/runtest.sh
+++ b/tests/bugzillas/bz1031154/runtest.sh
@@ -20,6 +20,7 @@ then
exit 0
fi
+require_selinux
require_command getenforce
require_command setenforce
require_command runcon
diff --git a/tests/toolbox.inc.sh b/tests/toolbox.inc.sh
index 602218c..140be66 100644
--- a/tests/toolbox.inc.sh
+++ b/tests/toolbox.inc.sh
@@ -115,6 +115,15 @@ function require_command ()
fi
}
+function require_selinux ()
+{
+ if ! grep -q selinuxfs /proc/mounts;
+ then
+ toolbox_skip_test $TEST "SKIP DUE TO DISABLED SELINUX"
+ exit 0
+ fi
+}
+
###############################################################################
#
# extract an error message from the log file and check it