Convert gmirror(8) regression tests to the new framework.
This commit is contained in:
parent
637750b988
commit
7d4ec059d3
@ -1,8 +0,0 @@
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# Regression tests for geom_mirror.
|
||||
#
|
||||
|
||||
test:
|
||||
@sh runtests.sh
|
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
dir=`dirname $0`
|
||||
|
||||
gmirror load >/dev/null 2>&1
|
||||
for ts in `dirname $0`/test-*.sh; do
|
||||
sh $ts
|
||||
done
|
||||
gmirror unload >/dev/null 2>&1
|
@ -7,10 +7,14 @@ us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
|
||||
echo "1..1"
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s 2M -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s 3M -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -19,9 +23,9 @@ sleep 1
|
||||
size=`diskinfo /dev/mirror/${name} | awk '{print $3}'`
|
||||
|
||||
if [ $size -eq 1048064 ]; then
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
else
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0}
|
@ -13,12 +13,16 @@ nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..4"
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -26,28 +30,28 @@ dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
fi
|
||||
dd if=/dev/md${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 2"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 2"
|
||||
fi
|
||||
dd if=/dev/md${us1} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 3"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 3"
|
||||
fi
|
||||
|
||||
dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 4"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 4"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0} md${us1} md${us2}
|
@ -13,12 +13,16 @@ nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..5"
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -26,40 +30,40 @@ dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 2"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 2"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us1}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 3"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 3"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us2}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 4"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 4"
|
||||
fi
|
||||
|
||||
# mirror/${name} should be removed.
|
||||
if [ -c /dev/${name} ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 5"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 5"
|
||||
fi
|
||||
|
||||
mdconfig -d -u $us0
|
@ -13,12 +13,16 @@ nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..5"
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -26,40 +30,40 @@ dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 2"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 2"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us1}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 3"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 3"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us2}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 4"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 4"
|
||||
fi
|
||||
|
||||
# mirror/${name} should be removed.
|
||||
if [ -c /dev/${name} ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 5"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 5"
|
||||
fi
|
||||
|
||||
mdconfig -d -u $us0
|
@ -13,12 +13,16 @@ nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..5"
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -26,40 +30,40 @@ dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 2"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 2"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us1}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 3"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 3"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us2}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 4"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 4"
|
||||
fi
|
||||
|
||||
# mirror/${name} should be removed.
|
||||
if [ -c /dev/${name} ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 5"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 5"
|
||||
fi
|
||||
|
||||
mdconfig -d -u $us0
|
@ -13,12 +13,16 @@ nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..2"
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -27,9 +31,9 @@ dd if=/dev/zero of=/dev/md${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
# Connect disk to the mirror.
|
||||
@ -38,9 +42,9 @@ gmirror insert ${name} md${us2}
|
||||
sleep 1
|
||||
dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 2"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 2"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0} md${us1} md${us2}
|
@ -13,12 +13,16 @@ nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..5"
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
kldstat -q -m g_mirror || gmirror load || exit 1
|
||||
|
||||
gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
sleep 1
|
||||
|
||||
@ -26,40 +30,40 @@ dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 1"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us0}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 2"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 2"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us1}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 3"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 3"
|
||||
fi
|
||||
|
||||
gmirror remove $name md${us2}
|
||||
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 4"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 4"
|
||||
fi
|
||||
|
||||
# mirror/${name} should be removed.
|
||||
if [ -c /dev/${name} ]; then
|
||||
echo "FAIL"
|
||||
echo "not ok 5"
|
||||
else
|
||||
echo "PASS"
|
||||
echo "ok 5"
|
||||
fi
|
||||
|
||||
mdconfig -d -u $us0
|
Loading…
Reference in New Issue
Block a user