diff mbox series

[19/19] mdadm/tests: disable selinux

Message ID 20240522085056.54818-20-xni@redhat.com (mailing list archive)
State Accepted
Headers show
Series mdadm/tests: enhance/fix regression cases | expand

Commit Message

Xiao Ni May 22, 2024, 8:50 a.m. UTC
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 <xni@redhat.com>
---
 test          |  3 +++
 tests/func.sh | 10 ++++++++++
 2 files changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/test b/test
index 4a88de58fdf5..47f53ad78b75 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 db55542d4011..b2e4d122aa7f 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