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