# We test mdadm on loop-back block devices.
# dir for storing files should be settable by command line maybe
-targetdir=/tmp
+targetdir=/var/tmp
size=20000
mdsize0=19904
mdsize1=19992
+mdsize11=19996
+mdsize12=19992
cleanup() {
$mdadm -Ss
path0=$dev6
path1=$dev7
+if [ " $1" = " setup" ]
+then trap 0 ; exit 0
+fi
# mdadm always adds --quiet, and we want to see any unexpected messages
mdadm() {
- $mdadm 2>&1 --quiet "$@"
+ $mdadm --quiet "$@"
}
# check various things
check() {
case $1 in
+ spares )
+ spares=`tr '] ' '\012\012' < /proc/mdstat | grep -c '(S)' || exit 0`
+ if [ $spares -ne $2 ]
+ then
+ echo >&2 "ERROR expected $2 spares, found $spares"; exit 1;
+ fi
+ ;;
raid* | linear )
grep -s "active $1 " /proc/mdstat > /dev/null || {
echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
;;
resync | recovery )
- sleep 0.1
+ sleep 0.5
grep -s $1 /proc/mdstat > /dev/null || {
echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
;;
bitmap )
grep -s bitmap > /dev/null /proc/mdstat || {
- echo >&2 ERROR no bitmap ; cat /proc/mdstat ; exist 1; }
+ echo >&2 ERROR no bitmap ; cat /proc/mdstat ; exit 1; }
;;
nobitmap )
if grep -s "bitmap" > /dev/null /proc/mdstat
-for script in tests/$prefix*[^~]
+for script in tests/$prefix tests/$prefix*[^~]
do
+ if [ -f "$script" ]
+ then
# source script in a subshell, so it has access to our
# namespace, but cannot change it.
if ( set -ex ; . $script ) 2> $targetdir/log
echo "$script failed"
exit 1
fi
+ fi
done
exit 0