]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: suppress not-found errors for `selinuxenabled` 24538/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 2 Sep 2022 17:39:30 +0000 (19:39 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 2 Sep 2022 20:09:29 +0000 (22:09 +0200)
if the binary is not available.

test/TEST-13-NSPAWN-SMOKE/test.sh
test/units/testsuite-13.sh

index 3d1e50447c734eb9b18da1e201d09704490aa089..65c1e9be3d29750ef23be70ee19c0bdab8edf414 100755 (executable)
@@ -17,7 +17,7 @@ test_append_files() {
         busybox="$(type -P busybox-static || type -P busybox)"
         inst_simple "$busybox" "$(dirname "$busybox")/busybox"
 
-        if selinuxenabled >/dev/null; then
+        if command -v selinuxenabled >/dev/null && selinuxenabled; then
             image_install selinuxenabled
             cp -ar /etc/selinux "$workspace/etc/selinux"
         fi
index 487cc549f4db7e3143f49a99b134d263ed219aad..fb0b3cda1679bab03e0b74e261f0e3d23daa618a 100755 (executable)
@@ -112,7 +112,7 @@ EOF
 }
 
 function check_selinux {
-    if ! selinuxenabled; then
+    if ! command -v selinuxenabled >/dev/null || ! selinuxenabled; then
         echo >&2 "SELinux is not enabled, skipping SELinux-related tests"
         return 0
     fi