Added unit tests
This commit is contained in:
parent
39214f2907
commit
75bad78233
15 changed files with 77 additions and 0 deletions
4
test/1missing.input
Normal file
4
test/1missing.input
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Personalities : [raid6] [raid5] [raid4]
|
||||||
|
md0 : active raid5 sda1[0] sdd1[2] sdb1[1]
|
||||||
|
1465151808 blocks level 5, 64k chunk, algorithm 2 [4/3] [UUU_]
|
||||||
|
unused devices: <none>
|
1
test/1missing.output
Normal file
1
test/1missing.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CRITICAL: Missing 1 of 4 devices | 'raid level'=5 'size in blocks'=1465151808 'num devices'=4 'num bad devices'=1;;1;0;4
|
6
test/OK1.input
Normal file
6
test/OK1.input
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Personalities : [raid1]
|
||||||
|
md0 : active raid1 sdb1[1] sda1[0]
|
||||||
|
976430080 blocks super 1.2 [2/2] [UU]
|
||||||
|
bitmap: 0/8 pages [0KB], 65536KB chunk
|
||||||
|
|
||||||
|
unused devices: <none>
|
1
test/OK1.output
Normal file
1
test/OK1.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
OK | 'raid level'=1 'size in blocks'=976430080 'num devices'=2 'num bad devices'=0;;1;0;2
|
6
test/OK2.input
Normal file
6
test/OK2.input
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Personalities : [raid1] [raid6] [raid5] [raid4]
|
||||||
|
md0 : active raid5 sde1[0] sdf1[4] sdb1[5] sdd1[2] sdc1[1]
|
||||||
|
1250241792 blocks super 1.2 level 5, 64k chunk, algorithm 2 [5/5] [UUUUU]
|
||||||
|
bitmap: 0/10 pages [0KB], 16384KB chunk
|
||||||
|
|
||||||
|
unused devices: <none>
|
1
test/OK2.output
Normal file
1
test/OK2.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
OK | 'raid level'=5 'size in blocks'=1250241792 'num devices'=5 'num bad devices'=0;;1;0;5
|
14
test/OK3.input
Normal file
14
test/OK3.input
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Personalities : [raid1] [raid6] [raid5] [raid4]
|
||||||
|
md1 : active raid1 sdb2[1] sda2[0]
|
||||||
|
136448 blocks [2/2] [UU]
|
||||||
|
|
||||||
|
md2 : active raid1 sdb3[1] sda3[0]
|
||||||
|
129596288 blocks [2/2] [UU]
|
||||||
|
|
||||||
|
md0 : active raid5 sdl1[9] sdk1[8] sdj1[7] sdi1[6] sdh1[5] sdg1[4] sdf1[3] sde1[2] sdd1[1] sdc1[0]
|
||||||
|
1318680576 blocks level 5, 1024k chunk, algorithm 2 [10/10] [UUUUUUUUUU]
|
||||||
|
|
||||||
|
md3 : active raid1 sdb1[1] sda1[0]
|
||||||
|
16787776 blocks [2/2] [UU]
|
||||||
|
|
||||||
|
unused devices: <none>
|
1
test/OK3.output
Normal file
1
test/OK3.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
OK | 'raid level'=5 'size in blocks'=1318680576 'num devices'=10 'num bad devices'=0;;1;0;10
|
7
test/bitmap.input
Normal file
7
test/bitmap.input
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Personalities : [linear] [raid0] [raid1] [raid5] [raid4] [raid6]
|
||||||
|
md0 : active raid6 sdf1[0] sde1[1] sdd1[2] sdc1[3] sdb1[4] sda1[5] hdb1[6]
|
||||||
|
1225557760 blocks level 6, 256k chunk, algorithm 2 [7/7] [UUUUUUU]
|
||||||
|
bitmap: 0/234 pages [0KB], 512KB chunk
|
||||||
|
|
||||||
|
unused devices: <none>
|
||||||
|
|
1
test/bitmap.output
Normal file
1
test/bitmap.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
OK | 'raid level'=6 'size in blocks'=1225557760 'num devices'=7 'num bad devices'=0;;1;0;7
|
5
test/notExisting.input
Normal file
5
test/notExisting.input
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Personalities : [raid1] [raid6] [raid5] [raid4]
|
||||||
|
md1 : active raid1 sdb2[1] sda2[0]
|
||||||
|
136448 blocks [2/2] [UU]
|
||||||
|
|
||||||
|
unused devices: <none>
|
1
test/notExisting.output
Normal file
1
test/notExisting.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CRITICAL: RAID md0 not found in notExisting.input
|
6
test/recovery.input
Normal file
6
test/recovery.input
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Personalities : [raid1] [raid6] [raid5] [raid4]
|
||||||
|
md0 : active raid5 sdh1[6] sdg1[4] sdf1[3] sde1[2] sdd1[1] sdc1[0]
|
||||||
|
1464725760 blocks level 5, 64k chunk, algorithm 2 [6/5] [UUUUUU]
|
||||||
|
[==>..................] recovery = 12.6% (37043392/292945152) finish=127.5min speed=33440K/sec
|
||||||
|
|
||||||
|
unused devices: <none>
|
1
test/recovery.output
Normal file
1
test/recovery.output
Normal file
|
@ -0,0 +1 @@
|
||||||
|
WARNING: Recovering: progress=12.6% finish=127.5min speed=33440K/sec | 'raid level'=5 'size in blocks'=1464725760 'num devices'=6 'num bad devices'=0;;1;0;6 'recovery progress'=12.6%;0;;0;100
|
22
test/run.sh
Executable file
22
test/run.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
dir="`dirname $0`"
|
||||||
|
|
||||||
|
ERROR=false
|
||||||
|
for f in `ls $dir/*.input`; do
|
||||||
|
RESULT="`$dir/../check_mdstat.sh --raid md0 --input $f`"
|
||||||
|
EXPECTED="`cat $dir/$(basename $f .input).output`"
|
||||||
|
if [ "$RESULT" != "$EXPECTED" ]; then
|
||||||
|
echo "Error for test $(basename $f .input):"
|
||||||
|
echo " Expected"
|
||||||
|
echo " $EXPECTED"
|
||||||
|
echo " and got"
|
||||||
|
echo " $RESULT"
|
||||||
|
ERROR=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if $ERROR; then
|
||||||
|
exit 1;
|
||||||
|
else
|
||||||
|
echo "Tests passed."
|
||||||
|
exit 0;
|
||||||
|
fi
|
Loading…
Reference in a new issue