mdsize00=19840
# super1.0 round down to multiple of 2, subtract 8
mdsize1=19992
+mdsize1a=19988
+mdsize12=19988
+# super1.2 for linear: round to multiple of 2, subtract 4
+mdsize1_l=18976
+mdsize2_l=18976
# subtract another 4 for bitmaps
mdsize1b=19988
mdsize11=19992
+mdsize11a=18944
mdsize12=19988
# ddf needs bigger devices as 32Meg is reserved!
ddfsize=65536
+config=/tmp/mdadm.conf
+
cleanup() {
udevadm settle
- $mdadm -Ssq
+ $mdadm -Ssq 2> /dev/null
for d in 0 1 2 3 4 5 6 7 8 9 10 11 12
do
- losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d
- done
+ losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d
+ rm -f /dev/disk/by-path/loop*
+ done
}
trap cleanup 0 1 2 3 15
* ) $mdadm 2> $targetdir/stderr --quiet "$@"
esac
rv=$?
+ case $* in
+ *-S* ) udevadm settle;;
+ esac
cat >&2 $targetdir/stderr
return $rv
}
;;
raid* | linear )
grep -s "active $1 " /proc/mdstat > /dev/null || {
- echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
+ echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
;;
resync | recovery | reshape)
sleep 0.5
grep -s $1 /proc/mdstat > /dev/null || {
- echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
+ echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
;;
-
+
nosync )
sleep 0.5
- 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;
+ 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 -E '(resync|recovery|reshape|check|repair) =' > /dev/null /proc/mdstat
+ while grep -E '(resync|recovery|reshape|check|repair) *=' > /dev/null /proc/mdstat
do sleep 2;
done
;;
-
+
state )
grep -s "blocks.*\[$2\]\$" /proc/mdstat > /dev/null || {
- echo >&2 "ERROR state $2 not found!"; cat /proc/mdstat ; exit 1; }
+ echo >&2 "ERROR state $2 not found!"; cat /proc/mdstat ; exit 1; }
sleep 0.5
;;
bitmap )
grep -s bitmap > /dev/null /proc/mdstat || {
- echo >&2 ERROR no bitmap ; cat /proc/mdstat ; exit 1; }
+ echo >&2 ERROR no bitmap ; cat /proc/mdstat ; exit 1; }
;;
nobitmap )
- if grep -s "bitmap" > /dev/null /proc/mdstat
+ if grep -s "bitmap" > /dev/null /proc/mdstat
then
- echo >&2 ERROR bitmap present ; cat /proc/mdstat ; exit 1;
+ echo >&2 ERROR bitmap present ; cat /proc/mdstat ; exit 1;
fi
;;
-
+
* ) echo >&2 ERROR unknown check $1 ; exit 1;
esac
}
fsck -fn $dev >&2
}
-setup_environment() {
- if [ -f $1 ]; then
- . $environment
- setup_env
- fi
-}
-
-reset_environment() {
- if [ -f $1 ]; then
- reset_env
- unset setup_env
- unset reset_env
- fi
-}
-
for script in tests/$prefix tests/$prefix*[^~]
do
if [ -f "$script" ]
then
rm -f $targetdir/stderr
# stop all arrays, just incase some script left an array active.
- mdadm -Ssq
+ $mdadm -Ssq 2> /dev/null
mdadm --zero $devlist 2> /dev/null
mdadm --zero $devlist 2> /dev/null
- environment="tests/env-`basename $script`"
- setup_environment $environment
# source script in a subshell, so it has access to our
# namespace, but cannot change it.
+ echo -ne "$script... "
if ( set -ex ; . $script ) 2> $targetdir/log
- then echo "$script succeeded"
- else cat $targetdir/log ; cat $targetdir/stderr
- echo "$script failed"
- reset_environment $environment
+ then echo "succeeded"
+ else echo "FAILED - see $targetdir/log for details"
exit 1
fi
- reset_environment $environment
fi
done
exit 0