test: bypass selinux integration test if selinux policy devel package is not installed
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Mar 2018 08:48:15 +0000 (09:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Mar 2018 14:29:35 +0000 (15:29 +0100)
With this "sudo ./run-integration-tests.sh" should work fully without
exception, even on systems lacking SELinux (in which case that test will
just be skipped)

test/TEST-06-SELINUX/test.sh

index e0c4c10..18856c2 100755 (executable)
@@ -10,6 +10,9 @@ TEST_NO_NSPAWN=1
 # selinux-policy-targeted
 # selinux-policy-devel
 
+# Check if selinux-policy-devel is installed, and if it isn't bail out early instead of failing
+test -d /usr/share/selinux/devel || exit 0
+
 . $TEST_BASE_DIR/test-functions
 SETUP_SELINUX=yes
 KERNEL_APPEND="$KERNEL_APPEND selinux=1 security=selinux"