]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - test
Assemble: free resources in load_devices
[thirdparty/mdadm.git] / test
diff --git a/test b/test
index 6175c25e2e0baff8357308ba2712b9fe2a17ce3d..711a3c7a2076d100ad908543a8b4935fa6882f56 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=$PWD/tests
+devlist=
 
 savelogs=0
 exitonerror=1
@@ -84,11 +82,9 @@ do_test() {
        if [ -f "$_script" ]
        then
                rm -f $targetdir/stderr
-               # stop all arrays, just incase some script left an array active.
-               $mdadm -Ssq 2> /dev/null
-               mdadm --zero $devlist 2> /dev/null
                # this might have been reset: restore the default.
                echo 2000 > /proc/sys/dev/raid/speed_limit_max
+               do_clean
                # source script in a subshell, so it has access to our
                # namespace, but cannot change it.
                echo -ne "$_script... "
@@ -114,6 +110,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 +128,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 +167,8 @@ parse_args() {
                        cleanup
                        exit 0
                        ;;
+               --testdir=* )
+                       ;;
                --tests=* )
                        TESTLIST=($(echo ${i##*=} | sed -e 's/,/ /g'))
                        ;;
@@ -159,7 +181,7 @@ parse_args() {
                                TESTLIST=($(ls $testdir | grep "linear"))
                                ;;
                        raid1 )
-                               TESTLIST=($(ls $testdir | grep "[0-9][0-9]r1\|raid1" | grep -vi raid10))
+                               TESTLIST=($(ls $testdir | grep "[0-9][0-9]r1\|raid1" | grep -vi "r10\|raid10"))
                                ;;
                        raid456 )
                                TESTLIST=($(ls $testdir | grep "[0-9][0-9]r[4-6]\|raid[4-6]"))