All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] mdadm/test: Update for mdadm test part
@ 2017-07-19 11:11 Zhilong Liu
  2017-07-19 11:11 ` [PATCH 1/4] test/00readonly: Add unit case for testing readonly/readwrite Zhilong Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19 11:11 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

1. add a new unit case for testing readonly/readwrite feature, it
   covers common metadata versions and raid levels.
2. fixed a issue reported by Xiao Ni, shell got parsing error when
   array[] has few members, so just check the array[0] is enough.
3. get rid of the useless test files.

Thanks,
Zhilong

Zhilong Liu (4):
  test/00readonly: Add unit case for testing readonly/readwrite
  mdadm/test: Fixed the condition parsing error for array[]
  mdadm/test: Get rid of tests/testdev
  mdadm/test: Get rid of tests/check

 test             |  2 +-
 tests/00readonly | 20 ++++++++++++++++++++
 tests/check      | 35 -----------------------------------
 tests/testdev    | 13 -------------
 4 files changed, 21 insertions(+), 49 deletions(-)
 create mode 100644 tests/00readonly
 delete mode 100644 tests/check
 delete mode 100644 tests/testdev

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] test/00readonly: Add unit case for testing readonly/readwrite
  2017-07-19 11:11 [PATCH 0/4] mdadm/test: Update for mdadm test part Zhilong Liu
@ 2017-07-19 11:11 ` Zhilong Liu
  2017-07-19 11:37   ` [PATCH v2 " Zhilong Liu
  2017-07-19 11:11 ` [PATCH 2/4] mdadm/test: Fixed the condition parsing error for array[] Zhilong Liu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19 11:11 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

This is a test case for testing --readonly and
--readwrite feature, it covers common metadata
versions and raid levels.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 tests/00readonly | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 tests/00readonly

diff --git a/tests/00readonly b/tests/00readonly
new file mode 100644
index 0000000..8467da7
--- /dev/null
+++ b/tests/00readonly
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+for metadata in 0.9 1.0 1.1 1.2
+do
+	for level in linear raid0 raid1 raid4 raid5 raid6 raid10
+	do
+		mdadm -CR $md0 -l $level -n 4 --metadata=$metadata \
+			$dev1 $dev2 $dev3 $dev4 --assume-clean
+		check nosync
+		check $level
+		mdadm -ro $md0
+		check readonly &&
+			[ "$(cat /sys/block/md0/md/array_state)" == "readonly" ]
+		mdadm -w $md0
+		check $level
+		mdadm -S $md0
+	done
+done
+
+exit 0
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] mdadm/test: Fixed the condition parsing error for array[]
  2017-07-19 11:11 [PATCH 0/4] mdadm/test: Update for mdadm test part Zhilong Liu
  2017-07-19 11:11 ` [PATCH 1/4] test/00readonly: Add unit case for testing readonly/readwrite Zhilong Liu
@ 2017-07-19 11:11 ` Zhilong Liu
  2017-07-19 11:11 ` [PATCH 3/4] mdadm/test: Get rid of tests/testdev Zhilong Liu
  2017-07-19 11:11 ` [PATCH 4/4] mdadm/test: Get rid of tests/check Zhilong Liu
  3 siblings, 0 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19 11:11 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

it complains too many arguments when array[] has few
members, it's proper to check whether or not array[0]
is zero.

Reported-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test b/test
index 87e2df2..25268a0 100755
--- a/test
+++ b/test
@@ -75,7 +75,7 @@ save_log() {
 		echo
 	elif [ "$DEVTYPE" == 'loop' -o "$DEVTYPE" == 'disk' ]
 	then
-		if [ ! -z ${array[@]} -a ${#array[@]} -ge 1 ]
+		if [ ! -z "$array" -a ${#array[@]} -ge 1 ]
 		then
 			md_disks=($($mdadm -D -Y ${array[@]} | grep "/dev/" | cut -d'=' -f2))
 			cat /proc/mdstat | grep -q "bitmap"
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] mdadm/test: Get rid of tests/testdev
  2017-07-19 11:11 [PATCH 0/4] mdadm/test: Update for mdadm test part Zhilong Liu
  2017-07-19 11:11 ` [PATCH 1/4] test/00readonly: Add unit case for testing readonly/readwrite Zhilong Liu
  2017-07-19 11:11 ` [PATCH 2/4] mdadm/test: Fixed the condition parsing error for array[] Zhilong Liu
@ 2017-07-19 11:11 ` Zhilong Liu
  2017-07-19 11:11 ` [PATCH 4/4] mdadm/test: Get rid of tests/check Zhilong Liu
  3 siblings, 0 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19 11:11 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

It's time to get rid of the tests/testdev due
to it has covered by testdev() in 'test'.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 tests/testdev | 13 -------------
 1 file changed, 13 deletions(-)
 delete mode 100644 tests/testdev

diff --git a/tests/testdev b/tests/testdev
deleted file mode 100644
index 8b6e6f0..0000000
--- a/tests/testdev
+++ /dev/null
@@ -1,13 +0,0 @@
-dev=$1
-cnt=$2
-size=$3
-chunk=$4
-mkfs -j $dev > /dev/null 2>&1 && fsck -fn $dev >&2
-dsize=$[size/chunk]
-dsize=$[dsize*chunk]
-rasize=$[dsize*2*cnt]
-if [ $rasize -ne `/sbin/blockdev --getsize $dev` ]
-then
-  echo "ERROR: size is wrong for $dev: $cnt * $size (chunk=$chunk) = $rasize, not `/sbin/blockdev --getsize $dev`"
-  exit 1;
-fi
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] mdadm/test: Get rid of tests/check
  2017-07-19 11:11 [PATCH 0/4] mdadm/test: Update for mdadm test part Zhilong Liu
                   ` (2 preceding siblings ...)
  2017-07-19 11:11 ` [PATCH 3/4] mdadm/test: Get rid of tests/testdev Zhilong Liu
@ 2017-07-19 11:11 ` Zhilong Liu
  3 siblings, 0 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19 11:11 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

The tests/check is not useful due to check()
in 'test' has covered various checking.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 tests/check | 35 -----------------------------------
 1 file changed, 35 deletions(-)
 delete mode 100644 tests/check

diff --git a/tests/check b/tests/check
deleted file mode 100644
index f4ed6d5..0000000
--- a/tests/check
+++ /dev/null
@@ -1,35 +0,0 @@
-
-case $1 in
- raid* | linear )
-   grep -s "active $1 " /proc/mdstat > /dev/null || {
-		echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
-  ;;
- resync | recovery )
-   sleep 0.1
-   grep -s $1 /proc/mdstat > /dev/null || {
-		echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
-  ;;
-
-  nosync )
-    sleep 0.5
-    grep -s 're[synccovery]* =' > /dev/null /proc/mdstat && {
-		echo >&2 "ERROR resync or recovery is happening!"; cat /proc/mdstat ; exit 1; }
-  ;;
-
- wait )
-   sleep 0.1
-   while grep 're[synccovery]* =' > /dev/null /proc/mdstat
-   do sleep 2;
-   done
-   ;;
-
- state )
-    grep -s "blocks.*\[$2\]\$" /proc/mdstat > /dev/null || {
-		echo >&2 "ERROR state $2 not found!"; cat /proc/mdstat ; exit 1; }
-    sleep 0.5
-   ;;
-
- * ) echo >&2 ERROR unknown check $1 ; exit 1;
-esac
-
-exit 0
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 1/4] test/00readonly: Add unit case for testing readonly/readwrite
  2017-07-19 11:11 ` [PATCH 1/4] test/00readonly: Add unit case for testing readonly/readwrite Zhilong Liu
@ 2017-07-19 11:37   ` Zhilong Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19 11:37 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu

This is a test case for testing --readonly and
--readwrite feature, it covers common metadata
versions and raid levels.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
---

Changing from v1:
improve checking sysfs configure.

 tests/00readonly | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 tests/00readonly

diff --git a/tests/00readonly b/tests/00readonly
new file mode 100644
index 0000000..28b0fa1
--- /dev/null
+++ b/tests/00readonly
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+for metadata in 0.9 1.0 1.1 1.2
+do
+	for level in linear raid0 raid1 raid4 raid5 raid6 raid10
+	do
+		mdadm -CR $md0 -l $level -n 4 --metadata=$metadata \
+			$dev1 $dev2 $dev3 $dev4 --assume-clean
+		check nosync
+		check $level
+		mdadm -ro $md0
+		check readonly
+		state=$(cat /sys/block/md0/md/array_state)
+		[ "$state" == "readonly" ] ||
+			die "array_state should be 'readonly', but is $state"
+		mdadm -w $md0
+		check $level
+		mdadm -S $md0
+	done
+done
+
+exit 0
-- 
2.6.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-19 11:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19 11:11 [PATCH 0/4] mdadm/test: Update for mdadm test part Zhilong Liu
2017-07-19 11:11 ` [PATCH 1/4] test/00readonly: Add unit case for testing readonly/readwrite Zhilong Liu
2017-07-19 11:37   ` [PATCH v2 " Zhilong Liu
2017-07-19 11:11 ` [PATCH 2/4] mdadm/test: Fixed the condition parsing error for array[] Zhilong Liu
2017-07-19 11:11 ` [PATCH 3/4] mdadm/test: Get rid of tests/testdev Zhilong Liu
2017-07-19 11:11 ` [PATCH 4/4] mdadm/test: Get rid of tests/check Zhilong Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.