]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - test
Assemble: don't auto-assemble if any arrays are listed in mdadm.conf
[thirdparty/mdadm.git] / test
diff --git a/test b/test
index a83b68e69d181f737f17696a5b79656c76c04403..f1555f7d0ae2eca99f43a56370a7bd53d537e9c9 100644 (file)
--- a/test
+++ b/test
@@ -21,15 +21,23 @@ fi
 
 # assume md0, md1, md2 exist in /dev
 md0=/dev/md0 md1=/dev/md1 md2=/dev/md2
+mdp0=/dev/md_d0
+mdp1=/dev/md_d1
 
 # We test mdadm on loop-back block devices.
 # dir for storing files should be settable by command line maybe
 targetdir=/var/tmp
 size=20000
+# super0, round down to multiple of 64 and substract 64
 mdsize0=19904
+# super00 is nested, subtract 128
+mdsize00=19840
+# super1.0 round down to multiple of 2, subtract 8
 mdsize1=19992
-mdsize11=19996
-mdsize12=19992
+# subtract another 4 for bitmaps
+mdsize1b=19988
+mdsize11=19992
+mdsize12=19988
 
 cleanup() {
        $mdadm -Ss
@@ -59,6 +67,9 @@ done
 path0=$dev6
 path1=$dev7
 
+echo 2000 > /proc/sys/dev/raid/speed_limit_max
+echo 0 > /sys/module/md_mod/parameters/start_ro
+
 if [ " $1" = " setup" ]
 then trap 0 ; exit 0
 fi
@@ -66,6 +77,9 @@ fi
 # mdadm always adds --quiet, and we want to see any unexpected messages
 mdadm() {
     rm -f $targetdir/stderr
+    case $* in
+       *-S* ) udevsettle;;
+    esac
     case $* in
        *-C* ) $mdadm 2> $targetdir/stderr --quiet "$@" --auto=yes;;
         * )   $mdadm 2> $targetdir/stderr --quiet "$@"
@@ -87,7 +101,7 @@ check() {
       grep -s "active $1 " /proc/mdstat > /dev/null || {
                echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
      ;;
-    resync | recovery )
+    resync | recovery | reshape)
       sleep 0.5
       grep -s $1 /proc/mdstat > /dev/null || {
                echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
@@ -95,14 +109,14 @@ check() {
    
      nosync )
        sleep 0.5
-       if grep -s 're[synccovery]* =' > /dev/null /proc/mdstat ; then
+       if grep -s -E '(resync|recovery|reshape) =' > /dev/null /proc/mdstat ; then
           echo >&2 "ERROR resync or recovery is happening!"; cat /proc/mdstat ; exit 1; 
        fi
      ;;
    
     wait )
       sleep 0.1
-      while grep 're[synccovery]* =' > /dev/null /proc/mdstat
+      while grep -E '(resync|recovery|reshape|check|repair) =' > /dev/null /proc/mdstat
       do sleep 2;
       done
       ;;
@@ -144,6 +158,7 @@ testdev() {
    dsize=$[dvsize/chunk]
    dsize=$[dsize*chunk]
    rasize=$[dsize*2*cnt]
+   if [ `/sbin/blockdev --getsize $dev` -eq 0 ]; then sleep 2 ; fi
    if [ $rasize -ne `/sbin/blockdev --getsize $dev` ]
    then
      echo "ERROR: size is wrong for $dev: $cnt * $dvsize (chunk=$chunk) = $rasize, not `/sbin/blockdev --getsize $dev`"
@@ -163,6 +178,10 @@ do
   if [ -f "$script" ]
   then
    rm -f $targetdir/stderr
+   # stop all arrays, just incase some script left an array active.
+   mdadm -Ssq
+   mdadm --zero $devlist 2> /dev/null
+   mdadm --zero $devlist 2> /dev/null
    # source script in a subshell, so it has access to our
    # namespace, but cannot change it.
    if ( set -ex ; . $script )  2> $targetdir/log