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