]> git.ipfire.org Git - thirdparty/mdadm.git/blame - tests/05r1-n3-bitmapfile
Add 'quite' option and tidy up some tests.
[thirdparty/mdadm.git] / tests / 05r1-n3-bitmapfile
CommitLineData
5e7519fa
NB
1set -e
2
3#
4# create a raid1 with 3 devices and a bitmap file
5# make sure resync does right thing.
6#
7#
8bmf=$targetdir/bitmap
9rm -f $bmf
dab6685f
NB
10mdadm --create --run $md0 --level=1 -n3 --delay=1 --bitmap $bmf $dev1 $dev2 $dev3
11check wait
12testdev $md0 1 $mdsize0 1
13mdadm -S $md0
14
15mdadm --assemble $md0 --bitmap=$bmf $dev1 $dev2 $dev3
16testdev $md0 1 $mdsize0 1
17dirty1=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
5e7519fa 18sleep 4
dab6685f 19dirty2=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
5e7519fa
NB
20
21if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ]
22then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2"
23 exit 1
24fi
dab6685f
NB
25mdadm $md0 -f $dev2
26testdev $md0 1 $mdsize0 1
5e7519fa 27sleep 4
dab6685f 28dirty3=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
5e7519fa
NB
29if [ $dirty3 -lt 400 ]
30then
31 echo >&2 "ERROR dirty count $dirty3 is too small"
32 exit 2
33fi
34
dab6685f 35mdadm -S $md0
5e7519fa 36
dab6685f
NB
37mdadm --assemble -R $md0 --bitmap=$bmf $dev1 $dev3
38check nosync
39mdadm $md0 --add $dev2
40check recovery
5e7519fa 41
dab6685f
NB
42dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
43check wait
5e7519fa 44sleep 4
dab6685f 45dirty5=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
5e7519fa
NB
46
47if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ]
48then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5"
49 exit 1
50fi
51
dab6685f 52mdadm -S $md0
5e7519fa 53exit 0