Skip to contentSkip to conversation

tests/bz1031154: skip if selinux is disabled

PATCH Superseded Artem Savkov 2 participants 2 messages Jun 26, 2017 Keys/keyrings

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tests/bugzillas/bz1031154/runtest.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/bugzillas/bz1031154/runtest.sh +5 -0
index aee8a28..e1721c0 100644
@@ -20,6 +20,11 @@ then
     exit 0
 fi
 
+if ! grep -q selinuxfs /proc/mounts; then
+    toolbox_skip_test $TEST "SKIPPING TEST DUE TO DISABLED SELINUX"
+    exit 0
+fi
+
 require_command getenforce
 require_command setenforce
 require_command runcon
Signature · 1 line
2.7.5
maintainer
#1 lore raw
Quoted 3 lines · Artem Savkov

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.

Could you add a macro for this to toolbox.sh and use that instead? It sounds generally useful.

David