From 729292d9ddc2ac390749af5deb232c5e749aef6f Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 2 Sep 2022 19:39:30 +0200 Subject: [PATCH] test: suppress not-found errors for `selinuxenabled` if the binary is not available. --- test/TEST-13-NSPAWN-SMOKE/test.sh | 2 +- test/units/testsuite-13.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh index 3d1e50447c7..65c1e9be3d2 100755 --- a/test/TEST-13-NSPAWN-SMOKE/test.sh +++ b/test/TEST-13-NSPAWN-SMOKE/test.sh @@ -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 diff --git a/test/units/testsuite-13.sh b/test/units/testsuite-13.sh index 487cc549f4d..fb0b3cda167 100755 --- a/test/units/testsuite-13.sh +++ b/test/units/testsuite-13.sh @@ -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 -- 2.47.3