From 01c65732b631fa0c61dff8d59d56bb13ab252e3d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 8 Jul 2024 16:50:23 +0000 Subject: [PATCH] test: better test for SELinux tools Previously the check was just if /sys/fs/selinux is mounted. This extends the check to see if all necessary tools are installed. Signed-off-by: Adrian Reber --- test/zdtm/static/selinux00.checkskip | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/zdtm/static/selinux00.checkskip b/test/zdtm/static/selinux00.checkskip index 8d946a75e..4c85647d1 100755 --- a/test/zdtm/static/selinux00.checkskip +++ b/test/zdtm/static/selinux00.checkskip @@ -2,6 +2,19 @@ test -d /sys/fs/selinux || exit 1 +# check if necessary commands are installed +if ! command -v setenforce &>/dev/null; then + exit 1 +fi + +if ! command -v setsebool &>/dev/null; then + exit 1 +fi + +if ! command -v getsebool &>/dev/null; then + exit 1 +fi + # See selinux00.hook for details getsebool unconfined_dyntrans_all > /dev/null 2>&1