Skip to contentSkip to conversation

tests: Gate tests for linear flavor with variable LINEAR

PATCH Applied Song Liu 2 participants 3 messages Jan 9, 2024 – Jan 16, 2024 MD RAID

lore
Share & tools
lore

Song Liu

author maintainer
#0 lore raw

PATCH v2 1/1 tests: Gate tests for linear flavor with variable LINEAR

linear flavor is being removed in the kernel [1], so tests for the linear flavor will fail. Add detection for linear flavor and --disable-linear option, with the same logic as multipath.

[1] https://lore.kernel.org/linux-raid/[email protected]/

---
 test               |  4 ++++
 tests/00linear     |  5 +++++
 tests/00names      |  8 +++++++-
 tests/00raid0      |  4 ++++
 tests/00readonly   |  8 +++++++-
 tests/02lineargrow |  5 +++++
 tests/03assem-incr |  8 +++++++-
 tests/03r0assem    |  4 ++++
 tests/04r0update   |  6 ++++++
 tests/func.sh      | 11 +++++++++++
 10 files changed, 60 insertions(+), 3 deletions(-)
test +4 -0
index b244453b1cec..49a36c3b8ef2 100755
@@ -140,6 +140,7 @@ do_help() {
 		--raidtype=                 raid0|linear|raid1|raid456|raid10|ddf|imsm
 		--disable-multipath         Disable any tests involving multipath
 		--disable-integrity         Disable slow tests of RAID[56] consistency
+		--disable-linear            Disable any tests involving linear
 		--logdir=directory          Directory to save all logfiles in
 		--save-logs                 Usually use with --logdir together
 		--keep-going | --no-error   Don't stop on error, ie. run all tests
@@ -255,6 +256,9 @@ parse_args() {
 		--disable-integrity )
 			unset INTEGRITY
 			;;
+		--disable-linear )
+			unset LINEAR
+			;;
 		--dev=* )
 			case ${i##*=} in
 			loop )
tests/00linear +5 -0
index e3ac6555c9dd..5a1160851af2 100644
@@ -1,6 +1,11 @@
 
 # create a simple linear
 
+if [ "$LINEAR" != "yes" ]; then
+  echo -ne 'skipping... '
+  exit 0
+fi
+
 mdadm -CR $md0 -l linear -n3 $dev0 $dev1 $dev2
 check linear
 testdev $md0 3 $mdsize2_l 1
tests/00names +7 -1
index 7a066d8fb2b7..d996befc5e8b 100644
@@ -4,7 +4,13 @@ set -x -e
 conf=$targetdir/mdadm.conf
 echo "CREATE names=yes" > $conf
 
-for i in linear raid0 raid1 raid4 raid5 raid6
+levels=(raid0 raid1 raid4 raid5 raid6)
+
+if [ "$LINEAR" == "yes" ]; then
+  levels+=( linear )
+fi
+
+for i in ${levels[@]}
 do
   mdadm -CR --config $conf /dev/md/$i -l $i -n 4 $dev4 $dev3 $dev2 $dev1
   check $i
tests/00raid0 +4 -0
index 9b8896cbdc52..6407c320fd65 100644
@@ -16,6 +16,10 @@ check raid0
 testdev $md0 5 $size 512
 mdadm -S $md0
 
+if [ "$LINEAR" != "yes" ]; then
+  echo -ne 'skipping... '
+  exit 0
+fi
 
 # now same again with different chunk size
 for chunk in 4 32 256
tests/00readonly +7 -1
index afe243b3a0b0..80b63629e4f9 100644
@@ -1,8 +1,14 @@
 #!/bin/bash
 
+levels=(raid0 raid1 raid4 raid5 raid6 raid10)
+
+if [ "$LINEAR" == "yes" ]; then
+  levels+=( linear )
+fi
+
 for metadata in 0.9 1.0 1.1 1.2
 do
-	for level in linear raid0 raid1 raid4 raid5 raid6 raid10
+	for level in ${levels[@]}
 	do
 		if [[ $metadata == "0.9" && $level == "raid0" ]];
 		then
tests/02lineargrow +5 -0
index 595bf9f20802..d17e2326d13f 100644
@@ -1,6 +1,11 @@
 
 # create a liner array, and add more drives to to.
 
+if [ "$LINEAR" != "yes" ]; then
+  echo -ne 'skipping... '
+  exit 0
+fi
+
 for e in 0.90 1 1.1 1.2
 do
   case $e in
tests/03assem-incr +7 -1
index f10a1a48ee5c..38880a7fed10 100644
@@ -6,7 +6,13 @@ set -x -e
 # Here just test that a partly "-I" assembled array can
 # be completed with "-A"
 
-for l in 0 1 5 linear
+levels=(raid0 raid1 raid5)
+
+if [ "$LINEAR" == "yes" ]; then
+  levels+=( linear )
+fi
+
+for l in ${levels[@]}
 do
   mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean
   mdadm -S md0
tests/03r0assem +4 -0
index 44df06456233..f7c29e8c1ab6 100644
@@ -64,6 +64,10 @@ mdadm --assemble --scan --config=$conf $md2
 $tst
 mdadm -S $md2
 
+if [ "$LINEAR" != "yes" ]; then
+  echo -ne 'skipping... '
+  exit 0
+fi
 
 ### Now for version 0...
 
tests/04r0update +6 -0
index b95efb06c761..c495f34a0a79 100644
@@ -1,5 +1,11 @@
 
 # create a raid0, re-assemble with a different super-minor
+
+if [ "$LINEAR" != "yes" ]; then
+  echo -ne 'skipping... '
+  exit 0
+fi
+
 mdadm -CR -e 0.90 $md0 -llinear -n3 $dev0 $dev1 $dev2
 testdev $md0 3 $mdsize0 1
 minor1=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
tests/func.sh +11 -0
index 5053b0121f1d..1c1a28a2a9c8 100644
@@ -123,6 +123,17 @@ check_env() {
 	modprobe multipath 2> /dev/null
 	grep -sq 'Personalities : .*multipath' /proc/mdstat &&
 		MULTIPATH="yes"
+	if [ "$MULTIPATH" != "yes" ]; then
+		echo "test: skipping tests for multipath, which is removed in upstream 6.8+ kernels"
+	fi
+
+	# Check whether to run linear tests
+	modprobe linear 2> /dev/null
+	grep -sq 'Personalities : .*linear' /proc/mdstat &&
+		LINEAR="yes"
+	if [ "$LINEAR" != "yes" ]; then
+		echo "test: skipping tests for linear, which is removed in upstream 6.8+ kernels"
+	fi
 }
 
 do_setup() {
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · On Tue, 9 Jan 2024 15:07:16 -0800 Song Liu <[email protected]> wrote:

linear flavor is being removed in the kernel [1], so tests for the linear flavor will fail. Add detection for linear flavor and --disable-linear option, with the same logic as multipath.

[1]
https://lore.kernel.org/linux-raid/[email protected]/

I will give few days for other folks to review.

Thanks,
Mariusz