]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - test
util: make env checking more generic
[thirdparty/mdadm.git] / test
diff --git a/test b/test
index a62d7e319f7343dc4c9d89006c738c893c49ce2c..9ceb531e7a3e3fe882f349931d75c7523655fa01 100644 (file)
--- a/test
+++ b/test
@@ -67,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
@@ -95,7 +98,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; }
@@ -103,14 +106,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
       ;;
@@ -152,6 +155,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`"
@@ -171,6 +175,8 @@ do
   if [ -f "$script" ]
   then
    rm -f $targetdir/stderr
+   # stop all arrays, just incase some script left an array active.
+   mdadm -Ssq
    # source script in a subshell, so it has access to our
    # namespace, but cannot change it.
    if ( set -ex ; . $script )  2> $targetdir/log