From: Frantisek Sumsal Date: Tue, 14 Nov 2023 09:52:24 +0000 (+0100) Subject: test: switch SELinux to permissive in the config file X-Git-Tag: v255-rc2~14^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bbe865b2feea548ea090c30ecf9d5087b049c86b;p=thirdparty%2Fsystemd.git test: switch SELinux to permissive in the config file The config file has (unfortunately) precedence over the kernel command line, so let's tweak the config file if necessary. --- diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh index 0757b38cc29..c7eaae8ab4a 100755 --- a/test/TEST-06-SELINUX/test.sh +++ b/test/TEST-06-SELINUX/test.sh @@ -22,7 +22,7 @@ test -f /usr/share/selinux/devel/include/system/systemd.if && find /etc/selinux . "${TEST_BASE_DIR:?}/test-functions" SETUP_SELINUX=yes -KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux" +KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux enforcing=0" test_append_files() { local workspace="${1:?}" @@ -53,6 +53,9 @@ test_append_files() { image_install -o /usr/libexec/selinux/hll/pp # Fedora/RHEL/... image_install -o /usr/lib/selinux/hll/pp # Debian/Ubuntu/... + # Config file has (unfortunately) always precedence, so let's switch it there as well + sed -i '/^SELINUX=disabled$/s/disabled/permissive/' "$workspace/etc/selinux/config" + if ! chroot "$workspace" make -C /systemd-test-module -f /usr/share/selinux/devel/Makefile clean load systemd_test.pp QUIET=n; then dfatal "Failed to build the systemd test module" exit 1 diff --git a/test/units/testsuite-06.sh b/test/units/testsuite-06.sh index c57d8b94888..73ae4850418 100755 --- a/test/units/testsuite-06.sh +++ b/test/units/testsuite-06.sh @@ -3,12 +3,6 @@ set -eux set -o pipefail -echo 1 >/sys/fs/selinux/enforce || { - echo "Can't make selinux enforcing, skipping test" - touch /testok - exit -} - runcon -t systemd_test_start_t systemctl start hola runcon -t systemd_test_reload_t systemctl reload hola runcon -t systemd_test_stop_t systemctl stop hola