diff --git a/test/1missing.input b/test/1missing.input new file mode 100644 index 0000000..97ad269 --- /dev/null +++ b/test/1missing.input @@ -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: diff --git a/test/1missing.output b/test/1missing.output new file mode 100644 index 0000000..808f869 --- /dev/null +++ b/test/1missing.output @@ -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 diff --git a/test/OK1.input b/test/OK1.input new file mode 100644 index 0000000..bae8d9a --- /dev/null +++ b/test/OK1.input @@ -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: diff --git a/test/OK1.output b/test/OK1.output new file mode 100644 index 0000000..4b618cd --- /dev/null +++ b/test/OK1.output @@ -0,0 +1 @@ +OK | 'raid level'=1 'size in blocks'=976430080 'num devices'=2 'num bad devices'=0;;1;0;2 diff --git a/test/OK2.input b/test/OK2.input new file mode 100644 index 0000000..7a6f761 --- /dev/null +++ b/test/OK2.input @@ -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: diff --git a/test/OK2.output b/test/OK2.output new file mode 100644 index 0000000..ebe7842 --- /dev/null +++ b/test/OK2.output @@ -0,0 +1 @@ +OK | 'raid level'=5 'size in blocks'=1250241792 'num devices'=5 'num bad devices'=0;;1;0;5 diff --git a/test/OK3.input b/test/OK3.input new file mode 100644 index 0000000..f338ed7 --- /dev/null +++ b/test/OK3.input @@ -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: diff --git a/test/OK3.output b/test/OK3.output new file mode 100644 index 0000000..f4b32ff --- /dev/null +++ b/test/OK3.output @@ -0,0 +1 @@ +OK | 'raid level'=5 'size in blocks'=1318680576 'num devices'=10 'num bad devices'=0;;1;0;10 diff --git a/test/bitmap.input b/test/bitmap.input new file mode 100644 index 0000000..fdccafc --- /dev/null +++ b/test/bitmap.input @@ -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: + diff --git a/test/bitmap.output b/test/bitmap.output new file mode 100644 index 0000000..3c4e3a2 --- /dev/null +++ b/test/bitmap.output @@ -0,0 +1 @@ +OK | 'raid level'=6 'size in blocks'=1225557760 'num devices'=7 'num bad devices'=0;;1;0;7 diff --git a/test/notExisting.input b/test/notExisting.input new file mode 100644 index 0000000..a3df9a2 --- /dev/null +++ b/test/notExisting.input @@ -0,0 +1,5 @@ +Personalities : [raid1] [raid6] [raid5] [raid4] +md1 : active raid1 sdb2[1] sda2[0] + 136448 blocks [2/2] [UU] + +unused devices: diff --git a/test/notExisting.output b/test/notExisting.output new file mode 100644 index 0000000..b5ca907 --- /dev/null +++ b/test/notExisting.output @@ -0,0 +1 @@ +CRITICAL: RAID md0 not found in notExisting.input diff --git a/test/recovery.input b/test/recovery.input new file mode 100644 index 0000000..6e8ddc6 --- /dev/null +++ b/test/recovery.input @@ -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: diff --git a/test/recovery.output b/test/recovery.output new file mode 100644 index 0000000..ac8b429 --- /dev/null +++ b/test/recovery.output @@ -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 diff --git a/test/run.sh b/test/run.sh new file mode 100755 index 0000000..c5302b8 --- /dev/null +++ b/test/run.sh @@ -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