]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
tests: Gate tests for linear flavor with variable LINEAR
authorSong Liu <song@kernel.org>
Tue, 9 Jan 2024 23:07:16 +0000 (15:07 -0800)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Tue, 16 Jan 2024 11:03:27 +0000 (12:03 +0100)
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/20231214222107.2016042-1-song@kernel.org/
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
test
tests/00linear
tests/00names
tests/00raid0
tests/00readonly
tests/02lineargrow
tests/03assem-incr
tests/03r0assem
tests/04r0update
tests/func.sh

diff --git a/test b/test
index b244453b1ceccd74c45af5e53dffdd0bef09c740..49a36c3b8ef2f33961d00e553fdb03b1a8b2288b 100755 (executable)
--- a/test
+++ b/test
@@ -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 )
index e3ac6555c9dd4d6365f72db5559142f08cb69a4c..5a1160851af2cfb2a0f09423a2b159793c43f00d 100644 (file)
@@ -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
index 7a066d8fb2b76bf92c4c32e7007847b144d7cd1b..d996befc5e8b486e7485c0f2e7b6391aba351f29 100644 (file)
@@ -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
index 9b8896cbdc52ff58ab58158dee42ae4bb6a03e0b..6407c320fd65ccd743adbd0fb42b3df90a4836be 100644 (file)
@@ -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
index afe243b3a0b031e687488f7ec6a959c2e4a2fde0..80b63629e4f9a959afaf9e570e073000c287bcf8 100644 (file)
@@ -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
index 595bf9f20802e4a09c3fc50c4dadfb36b8ec3cbb..d17e2326d13f52daac75698015405cdd81f034d7 100644 (file)
@@ -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
index f10a1a48ee5cdb2b1d23456c43deffc009dce9bd..38880a7fed101dcc072a7765d7dc54159a1d547c 100644 (file)
@@ -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
index 44df064562330736f4e9adf3cd2eaeb95c09e2e5..f7c29e8c1ab6a4c23e9051f69300f0e3bcf72cd5 100644 (file)
@@ -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...
 
index b95efb06c761b76857909d58326bd32878907628..c495f34a0a79d62d763319d18482eabd342311b7 100644 (file)
@@ -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'`
index 5053b0121f1da19fc82d9792f9911848b131972e..1c1a28a2a9c881327f125df13a9d763d3c71ea5c 100644 (file)
@@ -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() {