]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/test: add '--testdir=' to switch choosing test suite
authorZhilong Liu <zlliu@suse.com>
Tue, 16 Jan 2018 09:45:05 +0000 (17:45 +0800)
committerJes Sorensen <jsorensen@fb.com>
Sun, 21 Jan 2018 21:36:08 +0000 (16:36 -0500)
By now, mdadm has two test suites to cover traditional sofr-raid
testing and clustermd testing, the '--testdir=' option supports
to switch which suite to test, tests/ or clustermd_tests/.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
clustermd_tests/func.sh
test

index f88d33f8d8cdb8ba41e5eebccd47175bb3ddf068..23874245167a87725bb93e2ac25f2b334b815253 100644 (file)
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-CLUSTER_CONF=$PWD/cluster_conf
-
 check_ssh()
 {
        NODE1="$(grep '^NODE1' $CLUSTER_CONF | cut -d'=' -f2)"
diff --git a/test b/test
index 6175c25e2e0baff8357308ba2712b9fe2a17ce3d..4ddef382421f795470b73e4f1eb0ea468b2e0795 100755 (executable)
--- a/test
+++ b/test
@@ -1,14 +1,12 @@
 #!/bin/bash
 #
 # run test suite for mdadm
-
-. tests/func.sh
-
 mdadm=$PWD/mdadm
-testdir="tests"
 targetdir="/var/tmp"
 logdir="$targetdir"
 config=/tmp/mdadm.conf
+testdir=
+devlist=
 
 savelogs=0
 exitonerror=1
@@ -114,6 +112,7 @@ do_help() {
        Example for disk mode: ./test --dev=disk --disks=/dev/sda{2..15}
        Options:
                --tests=test1,test2,...     Comma separated list of tests to run
+               --testdir=                  Specify testdir as tests|clustermd_tests
                --raidtype=                 raid0|linear|raid1|raid456|raid10|ddf|imsm
                --disable-multipath         Disable any tests involving multipath
                --disable-integrity         Disable slow tests of RAID[56] consistency
@@ -131,6 +130,29 @@ do_help() {
 }
 
 parse_args() {
+       for i in $*
+       do
+               case $i in
+               --testdir=* )
+                       case ${i##*=} in
+                       tests )
+                               testdir=tests
+                       ;;
+                       clustermd_tests )
+                               testdir=clustermd_tests
+                               CLUSTER_CONF="$PWD/$testdir/cluster_conf"
+                       ;;
+                       * )
+                               echo "Unknown argument: $i"
+                               do_help
+                               exit 1
+                       ;;
+                       esac
+               ;;
+               esac
+       done
+       [ -z "$testdir" ] && testdir=tests
+       . $testdir/func.sh
        for i in $*
        do
                case $i in
@@ -147,6 +169,8 @@ parse_args() {
                        cleanup
                        exit 0
                        ;;
+               --testdir=* )
+                       ;;
                --tests=* )
                        TESTLIST=($(echo ${i##*=} | sed -e 's/,/ /g'))
                        ;;