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 <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Zhilong Liu 2018-01-16 17:45:05 +08:00 committed by Jes Sorensen
parent beb71de04d
commit 6c33d34df2
2 changed files with 28 additions and 6 deletions

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
CLUSTER_CONF=$PWD/cluster_conf
check_ssh() check_ssh()
{ {
NODE1="$(grep '^NODE1' $CLUSTER_CONF | cut -d'=' -f2)" NODE1="$(grep '^NODE1' $CLUSTER_CONF | cut -d'=' -f2)"

32
test
View File

@ -1,14 +1,12 @@
#!/bin/bash #!/bin/bash
# #
# run test suite for mdadm # run test suite for mdadm
. tests/func.sh
mdadm=$PWD/mdadm mdadm=$PWD/mdadm
testdir="tests"
targetdir="/var/tmp" targetdir="/var/tmp"
logdir="$targetdir" logdir="$targetdir"
config=/tmp/mdadm.conf config=/tmp/mdadm.conf
testdir=
devlist=
savelogs=0 savelogs=0
exitonerror=1 exitonerror=1
@ -114,6 +112,7 @@ do_help() {
Example for disk mode: ./test --dev=disk --disks=/dev/sda{2..15} Example for disk mode: ./test --dev=disk --disks=/dev/sda{2..15}
Options: Options:
--tests=test1,test2,... Comma separated list of tests to run --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 --raidtype= raid0|linear|raid1|raid456|raid10|ddf|imsm
--disable-multipath Disable any tests involving multipath --disable-multipath Disable any tests involving multipath
--disable-integrity Disable slow tests of RAID[56] consistency --disable-integrity Disable slow tests of RAID[56] consistency
@ -131,6 +130,29 @@ do_help() {
} }
parse_args() { 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 $* for i in $*
do do
case $i in case $i in
@ -147,6 +169,8 @@ parse_args() {
cleanup cleanup
exit 0 exit 0
;; ;;
--testdir=* )
;;
--tests=* ) --tests=* )
TESTLIST=($(echo ${i##*=} | sed -e 's/,/ /g')) TESTLIST=($(echo ${i##*=} | sed -e 's/,/ /g'))
;; ;;