[PATCH 12/19] tests/04update-metadata skip linear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add one check that if kernel doesn't support linear/multipath, it can
skip linear/multipath testing.

Signed-off-by: Xiao Ni <xni@xxxxxxxxxx>
---
 test                    |  3 +++
 tests/04update-metadata | 35 ++++++++++++++++++++---------------
 tests/func.sh           |  2 ++
 3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/test b/test
index 1fce6be2c4a9..f09994e78107 100755
--- a/test
+++ b/test
@@ -17,6 +17,9 @@ devlist=
 # device node will be /dev/md127 (127 is choosed by mdadm autumatically)
 is_foreign="no"
 
+skipping_linear="no"
+skipping_multipath="no"
+
 savelogs=0
 exitonerror=1
 ctrl_c_error=0
diff --git a/tests/04update-metadata b/tests/04update-metadata
index 2b72a303b6a0..c748770cfda7 100644
--- a/tests/04update-metadata
+++ b/tests/04update-metadata
@@ -8,24 +8,29 @@ set -xe
 
 dlist="$dev0 $dev1 $dev2 $dev3"
 
-for ls in linear/4 raid1/1 raid5/3 raid6/2
+if [ $skipping_linear == "yes" ]; then
+	level_list="raid1/1 raid5/3 raid6/2"
+else
+	level_list="linear/4 raid1/1 raid5/3 raid6/2"
+fi
+for ls in $level_list
 do
-  s=${ls#*/} l=${ls%/*}
-  if [[ $l == 'raid1' ]]; then
-	mdadm -CR --assume-clean -e 0.90 $md0 --level $l -n 4 $dlist
-  else
-	mdadm -CR --assume-clean -e 0.90 $md0 --level $l -n 4 -c 64 $dlist
-  fi
-  testdev $md0 $s 19904 64
-  mdadm -S $md0
-  mdadm -A $md0 --update=metadata $dlist
-  testdev $md0 $s 19904 64 check
-  mdadm -S $md0
+	s=${ls#*/} l=${ls%/*}
+	if [[ $l == 'raid1' ]]; then
+		mdadm -CR --assume-clean -e 0.90 $md0 --level $l -n 4 $dlist
+	else
+		mdadm -CR --assume-clean -e 0.90 $md0 --level $l -n 4 -c 64 $dlist
+	fi
+	testdev $md0 $s 19904 64
+	mdadm -S $md0
+	mdadm -A $md0 --update=metadata $dlist
+	testdev $md0 $s 19904 64 check
+	mdadm -S $md0
 done
 
 if mdadm -A $md0 --update=metadata $dlist
 then echo >&2 should fail with v1.0 metadata
-     exit 1
+	exit 1
 fi
 
 mdadm -CR -e 0.90 $md0 --level=6 -n4 -c32 $dlist
@@ -33,7 +38,7 @@ mdadm -S $md0
 
 if mdadm -A $md0 --update=metadata $dlist
 then echo >&2 should fail during resync
-     exit 1
+	exit 1
 fi
 mdadm -A $md0 $dlist
 mdadm --wait $md0 || true
@@ -48,5 +53,5 @@ mdadm -S $md0
 
 if mdadm -A $md0 --update=metadata $dlist
 then echo >&2 should fail when bitmap present
-     exit 1
+	exit 1
 fi
diff --git a/tests/func.sh b/tests/func.sh
index cfe83e552a2a..db55542d4011 100644
--- a/tests/func.sh
+++ b/tests/func.sh
@@ -125,6 +125,7 @@ check_env() {
 		MULTIPATH="yes"
 	if [ "$MULTIPATH" != "yes" ]; then
 		echo "test: skipping tests for multipath, which is removed in upstream 6.8+ kernels"
+		skipping_multipath="yes"
 	fi
 
 	# Check whether to run linear tests
@@ -133,6 +134,7 @@ check_env() {
 		LINEAR="yes"
 	if [ "$LINEAR" != "yes" ]; then
 		echo "test: skipping tests for linear, which is removed in upstream 6.8+ kernels"
+		skipping_linear="yes"
 	fi
 }
 
-- 
2.32.0 (Apple Git-132)





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux