summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2014-03-03 11:20:40 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2014-03-03 11:23:57 +0100
commit52007a9191e67b9b6d83fcf8332aceaa4e0f5e48 (patch)
tree7a7062101e33bbc0a5e2b51c90271b8acb9a2a17
parenta92fae079be1486302343443a813df9ec5bfd2ff (diff)
downloadlvm2-52007a9191e67b9b6d83fcf8332aceaa4e0f5e48.tar.gz
tests: split raid test
Use separate files for raid1, raid456, raid10. They need different target versions to work, so support more precise test selection. Optimize duplicate tests of target avalability and skip unsupported test cases sooner.
-rw-r--r--test/shell/lvchange-raid.sh61
-rw-r--r--test/shell/lvchange-raid10.sh20
-rw-r--r--test/shell/lvchange-raid456.sh22
3 files changed, 63 insertions, 40 deletions
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index 84c47f27a..8fc91a311 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -11,8 +11,6 @@
. lib/test
-THIN_POSTFIX=""
-
# Writemostly has been in every version since the begining
# Device refresh in 1.5.1 upstream and 1.3.4 < x < 1.4.0 in RHEL6
# Sync action in 1.5.0 upstream and 1.3.3 < x < 1.4.0 in RHEL6
@@ -252,7 +250,7 @@ run_recovery_rate_check() {
local vg=$1
local lv=${2}${THIN_POSTFIX}
- printf "#\n#\n#\n# %s/%s %s: run_recovery_rate_check\n#\n#\n#\n" \
+ printf "#\n#\n#\n# %s/%s (%s): run_recovery_rate_check\n#\n#\n#\n" \
$vg $lv $(get lv_field $vg/$lv segtype -a)
lvchange --minrecoveryrate 50 $vg/$lv
lvchange --maxrecoveryrate 100 $vg/$lv
@@ -276,13 +274,6 @@ run_checks() {
run_refresh_check $1 $2
run_recovery_rate_check $1 $2
elif [ 'thinpool_data' == $3 ]; then
- aux have_thin 1 8 0 || return 0
-
- # RAID works EX in cluster
- # thinpool works EX in cluster
- # but they don't work together in a cluster yet
- # (nor does thinpool+mirror work in a cluster yet)
- test -e LOCAL_CLVMD && return 0
printf "#\n#\n# run_checks: RAID as thinpool data\n#\n#\n"
# Hey, specifying devices for thin allocation doesn't work
@@ -297,8 +288,6 @@ run_checks() {
run_refresh_check $1 $2
run_recovery_rate_check $1 $2
elif [ 'thinpool_meta' == $3 ]; then
- aux have_thin 1 8 0 || return 0
- test -e LOCAL_CLVMD && return 0
printf "#\n#\n# run_checks: RAID as thinpool metadata\n#\n#\n"
lvrename $1/$2 ${2}_meta
@@ -327,35 +316,27 @@ run_checks() {
fi
}
+run_types() {
+ for i in $TEST_TYPES ; do
+ lvcreate -n $lv1 $vg -L2M --type "$@"
+ run_checks $vg $lv1 $i
+ lvremove -ff $vg
+ done
+}
+
########################################################
# MAIN
########################################################
-for i in "-" "snapshot" "thinpool_data" "thinpool_meta"; do
- lvcreate --type raid1 -m 1 -L 2M -n $lv1 $vg \
- "$dev1" "$dev2"
- run_checks $vg $lv1 $i
- lvremove -ff $vg
-
- lvcreate --type raid4 -i 2 -L 2M -n $lv1 $vg \
- "$dev1" "$dev2" "$dev3" "$dev4"
- run_checks $vg $lv1 $i
- lvremove -ff $vg
-
- lvcreate --type raid5 -i 2 -L 2M -n $lv1 $vg \
- "$dev1" "$dev2" "$dev3" "$dev4"
- run_checks $vg $lv1 $i
- lvremove -ff $vg
-
- lvcreate --type raid6 -i 3 -L 2M -n $lv1 $vg \
- "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
- run_checks $vg $lv1 $i
- lvremove -ff $vg
-
- lvcreate --type raid10 -m 1 -i 2 -L 2M -n $lv1 $vg \
- "$dev1" "$dev2" "$dev3" "$dev4"
- run_checks $vg $lv1 $i
- lvremove -ff $vg
-done
-
-vgremove -ff $vg
+TEST_TYPES="- snapshot"
+# RAID works EX in cluster
+# thinpool works EX in cluster
+# but they don't work together in a cluster yet
+# (nor does thinpool+mirror work in a cluster yet)
+test ! -e LOCAL_CLVMD -a aux have_thin 1 8 0 && TEST_TYPE="$TEST_TYPES thinpool_data thinpool_meta"
+
+# Implicit test for 'raid1' only
+if test "${TEST_RAID:-raid1}" = raid1 ; then
+ run_types raid1 -m 1 "$dev1" "$dev2"
+ vgremove -ff $vg
+fi
diff --git a/test/shell/lvchange-raid10.sh b/test/shell/lvchange-raid10.sh
new file mode 100644
index 000000000..b31c32818
--- /dev/null
+++ b/test/shell/lvchange-raid10.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+TEST_RAID=raid10
+
+. shell/lvchange-raid.sh
+
+aux target_at_least dm-raid 1 5 2 || skip
+
+run_types raid10 -m 1 -i 2 "$dev1" "$dev2" "$dev3" "$dev4"
+
+vgremove -ff $vg
diff --git a/test/shell/lvchange-raid456.sh b/test/shell/lvchange-raid456.sh
new file mode 100644
index 000000000..41a0dfd92
--- /dev/null
+++ b/test/shell/lvchange-raid456.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+TEST_RAID=raid456
+
+. shell/lvchange-raid.sh
+
+aux target_at_least dm-raid 1 5 2 || skip
+
+run_types raid4 -i 2 "$dev1" "$dev2" "$dev3" "$dev4"
+run_types raid5 -i 2 "$dev1" "$dev2" "$dev3" "$dev4"
+run_types raid6 -i 3 "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
+
+vgremove -ff $vg