]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - test
test: ensure testing uses correct mdmon
[thirdparty/mdadm.git] / test
diff --git a/test b/test
index 3f8515fe17e14fdc51cf1d22fb73621d34f8a535..8e8d1df3612202fbcbc14c74f6adc99d295997f1 100755 (executable)
--- a/test
+++ b/test
@@ -21,11 +21,17 @@ logdir="$testdir/logs"
 logsave=0
 exitonerror=1
 
+echo "Testing on linux-$(uname -r) kernel"
+
 # Check whether to run multipath tests
 modprobe multipath 2> /dev/null
 if grep -s 'Personalities : .*multipath' > /dev/null /proc/mdstat ; then
     MULTIPATH="yes"
 fi
+INTEGRITY=yes
+
+# make sure to test local mdmon, not system one
+export MDADM_NO_SYSTEMCTL=1
 
 # assume md0, md1, md2 exist in /dev
 md0=/dev/md0 md1=/dev/md1 md2=/dev/md2
@@ -61,23 +67,23 @@ config=/tmp/mdadm.conf
 cleanup() {
        udevadm settle
        $mdadm -Ssq 2> /dev/null
-       for d in 0 1 2 3 4 5 6 7  8 9 10 11 12
+       for d in 0 1 2 3 4 5 6 7  8 9 10 11 12 13
        do
            losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d
            rm -f /dev/disk/by-path/loop*
        done
 }
 
-ctrl-c() {
+ctrl_c() {
        exitonerror=1
 }
 
 do_setup() {
   trap cleanup 0 1 3 15
-  trap ctrl-c 2
+  trap ctrl_c 2
 
   devlist=
-  for d in 0 1 2 3 4 5 6 7 8 9 10 11 12
+  for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13
   do
     sz=$size
     if [ $d -gt 7 ]; then sz=$ddfsize ; fi
@@ -92,6 +98,7 @@ do_setup() {
     eval dev$d=/dev/loop$d
     eval file$d=$targetdir/mdtest$d
     eval devlist=\"\$devlist \$dev$d\"
+    eval devlist$d=\"\$devlist\"
    #" <-- add this quote to un-confuse vim syntax highlighting
   done
   path0=$dev6
@@ -135,6 +142,10 @@ check() {
       grep -s "active $1 " /proc/mdstat > /dev/null || {
                echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
      ;;
+    algorithm )
+      grep -s " algorithm $2 " /proc/mdstat > /dev/null || {
+         echo >&2 "ERROR algorithm $2 not found"; cat /proc/mdstat; exit 1;}
+     ;;
     resync | recovery | reshape)
       sleep 0.5
       grep -s $1 /proc/mdstat > /dev/null || {
@@ -149,10 +160,13 @@ check() {
      ;;
 
     wait )
+      p=`cat /proc/sys/dev/raid/speed_limit_max`
+      echo 2000000 > /proc/sys/dev/raid/speed_limit_max
       sleep 0.1
       while grep -E '(resync|recovery|reshape|check|repair) *=' > /dev/null /proc/mdstat
-      do sleep 2;
+      do sleep 0.5;
       done
+      echo $p > /proc/sys/dev/raid/speed_limit_max
       ;;
 
     state )
@@ -209,6 +223,10 @@ testdev() {
    fi
 }
 
+fast_sync() {
+  echo 200000 > /proc/sys/dev/raid/speed_limit_max
+}
+
 rotest() {
   dev=$1
   fsck -fn $dev >&2
@@ -224,6 +242,8 @@ do_test() {
     $mdadm -Ssq 2> /dev/null
     mdadm --zero $devlist 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
     # source script in a subshell, so it has access to our
     # namespace, but cannot change it.
     echo -ne "$_script... "
@@ -233,6 +253,7 @@ do_test() {
       _fail=0
     else
       log=log
+      cat $targetdir/stderr >> $targetdir/log
       if [ $exitonerror == 0 ]; then
          log=log-`basename $_script`
          mv $targetdir/log $targetdir/$log
@@ -254,6 +275,7 @@ do_help() {
   echo " Options:"
   echo "    --tests=<test1,test2,..>    Comma separated list of tests to run"
   echo "    --disable-multipath         Disable any tests involving multipath"
+  echo "    --disable-integrity         Disable slow tests of RAID[56] consistency"
   echo "    --logdir=<directory>        Directory to save logfiles in"
   echo "    --save-logs                 Save all logs in <logdir>"
   echo "    --keep-going                Don't stop on error, ie. run all tests"
@@ -299,6 +321,9 @@ parse_args() {
     --disable-multipath)
       unset MULTIPATH
       ;;
+    --disable-integrity)
+      unset INTEGRITY
+      ;;
     --help)
       do_help
       exit 0;