From: Zhilong Liu Date: Tue, 16 Jan 2018 09:45:05 +0000 (+0800) Subject: mdadm/test: add '--testdir=' to switch choosing test suite X-Git-Tag: mdadm-4.1-rc1~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c33d34df2b0bcacadd5c547c8c827bbfac1bd2a;p=thirdparty%2Fmdadm.git mdadm/test: add '--testdir=' to switch choosing test suite 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 Signed-off-by: Jes Sorensen --- diff --git a/clustermd_tests/func.sh b/clustermd_tests/func.sh index f88d33f8..23874245 100644 --- a/clustermd_tests/func.sh +++ b/clustermd_tests/func.sh @@ -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 6175c25e..4ddef382 100755 --- 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')) ;;