From b914aa25ee1fe3e0bd97f58bdf2bfdd185992a79 Mon Sep 17 00:00:00 2001 From: Xiao Ni Date: Wed, 22 May 2024 16:50:56 +0800 Subject: [PATCH 093/157] mdadm/tests: disable selinux Sometimes systemd service fails because selinux. Disable selinux during testing now. We can enable it in future when having a better method. Signed-off-by: Xiao Ni Signed-off-by: Mariusz Tkaczyk --- test | 3 +++ tests/func.sh | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/test b/test index 4a88de58..47f53ad7 100755 --- a/test +++ b/test @@ -16,6 +16,8 @@ devlist= # For example, /dev/md0 is created, stops it, then assemble it, the # device node will be /dev/md127 (127 is choosed by mdadm autumatically) is_foreign="no" +#disable selinux +sys_selinux="Permissive" skipping_linear="no" skipping_multipath="no" @@ -351,6 +353,7 @@ main() { fi done + restore_selinux exit 0 } diff --git a/tests/func.sh b/tests/func.sh index db55542d..b2e4d122 100644 --- a/tests/func.sh +++ b/tests/func.sh @@ -167,6 +167,15 @@ is_raid_foreign() { fi } +record_selinux() { + sys_selinux=`getenforce` + setenforce Permissive +} + +restore_selinux() { + setenforce $sys_selinux +} + do_setup() { trap cleanup 0 1 3 15 trap ctrl_c 2 @@ -247,6 +256,7 @@ do_setup() { echo 0 > /sys/module/md_mod/parameters/start_ro record_system_speed_limit is_raid_foreign + record_selinux } # check various things -- 2.41.0