Linux-Raid Archives mirror
 help / color / mirror / Atom feed
From: Mateusz Kusiak <mateusz.kusiak@intel.com>
To: linux-raid@vger.kernel.org
Cc: jes@trained-monkey.org, mariusz.tkaczyk@linux.intel.com
Subject: [PATCH] test: run tests on system level mdadm
Date: Tue, 20 Feb 2024 17:04:44 +0100	[thread overview]
Message-ID: <20240220160444.3139-1-mateusz.kusiak@intel.com> (raw)

The tests run with MDADM_NO_SYSTEMCTL flag by default, however it has
no effect on udev. In case of external metadata, even if flag is set,
udev will trigger systemd to launch mdmon.

This commit changes test execution level, so the tests are run on system
level mdadm, meaning local build must be installed prior to running
tests.

Add warning that the tests are run on system level mdadm and local
build must be installed first.

Do not call mdadm with "quiet" as it makes it not display critical
messages necessary for debug.

Remove forcing speed_limit and add restoring system speed_limit_max
after test execution.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
---
 test          | 27 ++++++++++++++++++---------
 tests/func.sh |  1 -
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/test b/test
index 49a36c3b8ef2..338c2db44fa7 100755
--- a/test
+++ b/test
@@ -1,11 +1,12 @@
 #!/bin/bash
 #
 # run test suite for mdadm
-mdadm=$PWD/mdadm
+mdadm=`which mdadm`
 targetdir="/var/tmp"
 logdir="$targetdir"
 config=/tmp/mdadm.conf
 testdir=$PWD/tests
+system_speed_limit=`cat /proc/sys/dev/raid/speed_limit_max`
 devlist=
 
 savelogs=0
@@ -20,9 +21,6 @@ DEVTYPE=loop
 INTEGRITY=yes
 LVM_VOLGROUP=mdtest
 
-# make sure to test local mdmon, not system one
-export MDADM_NO_SYSTEMCTL=1
-
 # assume md0, md1, md2 exist in /dev
 md0=/dev/md0
 md1=/dev/md1
@@ -41,7 +39,10 @@ ctrl_c() {
 	ctrl_c_error=1
 }
 
-# mdadm always adds --quiet, and we want to see any unexpected messages
+restore_system_speed_limit() {
+	echo $system_speed_limit > /proc/sys/dev/raid/speed_limit_max
+}
+
 mdadm() {
 	rm -f $targetdir/stderr
 	case $* in
@@ -63,10 +64,10 @@ mdadm() {
 					$mdadm --zero $args > /dev/null
 			}
 		done
-		$mdadm 2> $targetdir/stderr --quiet "$@" --auto=yes
+		$mdadm 2> $targetdir/stderr "$@" --auto=yes
 		;;
 	* )
-		$mdadm 2> $targetdir/stderr --quiet "$@"
+		$mdadm 2> $targetdir/stderr "$@"
 		;;
 	esac
 	rv=$?
@@ -99,8 +100,6 @@ do_test() {
 		fi
 
 		rm -f $targetdir/stderr
-		# this might have been reset: restore the default.
-		echo 2000 > /proc/sys/dev/raid/speed_limit_max
 		do_clean
 		# source script in a subshell, so it has access to our
 		# namespace, but cannot change it.
@@ -122,6 +121,7 @@ do_test() {
 				echo "  (KNOWN BROKEN TEST: $_broken_msg)"
 			fi
 		fi
+		restore_system_speed_limit
 		[ "$savelogs" == "1" ] &&
 			mv -f $targetdir/log $logdir/$_basename.log
 		[ "$ctrl_c_error" == "1" ] && exit 1
@@ -299,7 +299,15 @@ parse_args() {
 	done
 }
 
+print_warning() {
+	cat <<-EOF
+	Warning! Tests are performed on system level mdadm!
+	If you want to test local build, you need to install it first!
+	EOF
+}
+
 main() {
+	print_warning
 	do_setup
 
 	echo "Testing on linux-$(uname -r) kernel"
@@ -329,6 +337,7 @@ main() {
 			break
 		fi
 	done
+
 	exit 0
 }
 
diff --git a/tests/func.sh b/tests/func.sh
index 1c1a28a2a9c8..b474442b6abe 100644
--- a/tests/func.sh
+++ b/tests/func.sh
@@ -213,7 +213,6 @@ do_setup() {
 	path1=$dev7
 	ulimit -c unlimited
 	[ -f /proc/mdstat ] || modprobe md_mod
-	echo 2000 > /proc/sys/dev/raid/speed_limit_max
 	echo 0 > /sys/module/md_mod/parameters/start_ro
 }
 
-- 
2.35.3


             reply	other threads:[~2024-02-20 16:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 16:04 Mateusz Kusiak [this message]
2024-02-23 11:50 ` [PATCH] test: run tests on system level mdadm Mariusz Tkaczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240220160444.3139-1-mateusz.kusiak@intel.com \
    --to=mateusz.kusiak@intel.com \
    --cc=jes@trained-monkey.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mariusz.tkaczyk@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).