mdadm: add test script for raid456 journal

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
Song Liu 2015-10-21 11:35:16 -07:00 committed by NeilBrown
parent 28f83f6d3b
commit 356e69de79
2 changed files with 73 additions and 0 deletions

9
test
View File

@ -246,6 +246,15 @@ check() {
fi
;;
readonly )
grep -s "read-only" > /dev/null /proc/mdstat || {
echo >&2 "ERROR array is not read-only!"; cat /proc/mdstat ; exit 1; }
;;
inactive )
grep -s "inactive" > /dev/null /proc/mdstat || {
echo >&2 "ERROR array is not inactive!"; cat /proc/mdstat ; exit 1; }
;;
* ) echo >&2 ERROR unknown check $1 ; exit 1;
esac
}

64
tests/20raid5journal Normal file
View File

@ -0,0 +1,64 @@
# check write journal of raid456
# test --detail
test_detail_shows_journal() {
mdadm -D $1 | grep journal || {
echo >&2 "ERROR --detail does show journal device!"; mdadm -D $1 ; exit 1; }
}
# test --examine
test_examine_shows_journal() {
mdadm -E $1 | grep Journal || {
echo >&2 "ERROR --examine does show Journal device!"; mdadm -E $1 ; exit 1; }
}
# test --create
create_with_journal_and_stop() {
mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3 --write-journal $dev4
check wait
tar cf - /etc > $md0
./raid6check $md0 0 0 | grep 'Error detected' && exit 1
test_detail_shows_journal $md0
test_examine_shows_journal $dev4
mdadm -S $md0
}
# test --assemble
test_assemble() {
create_with_journal_and_stop
if mdadm -A $md0 $dev0 $dev1 $dev2 $dev3
then
echo >&2 "ERROR should return 1 when journal is missing!"; cat /proc/mdstat ; exit 1;
fi
mdadm -S $md0
mdadm -A $md0 $dev0 $dev1 $dev2 $dev3 --force
check readonly
mdadm -S $md0
}
# test --incremental
test_incremental() {
create_with_journal_and_stop
for d in $dev0 $dev1 $dev2 $dev3
do
mdadm -I $d
done
check inactive
mdadm -I $dev4
check raid5
mdadm -S $md0
# test --incremental with journal missing
for d in $dev0 $dev1 $dev2 $dev3
do
mdadm -I $d
done
mdadm -R $md0
check readonly
mdadm -S $md0
}
create_with_journal_and_stop
test_assemble
test_incremental