Convert graid3(8) regression tests to the new framework.

This commit is contained in:
Pawel Jakub Dawidek 2005-12-07 01:28:59 +00:00
parent b0f4c56e21
commit 3c6d62f3c4
15 changed files with 95 additions and 69 deletions

View File

@ -1,8 +0,0 @@
#
# $FreeBSD$
#
# Regression tests for geom_raid3.
#
test:
@sh runtests.sh

View File

@ -0,0 +1,8 @@
#!/bin/sh
# $FreeBSD$
name="test"
class="raid3"
base=`basename $0`
. `dirname $0`/../geom_subr.sh

View File

@ -1,10 +0,0 @@
#!/bin/sh
# $FreeBSD$
dir=`dirname $0`
graid3 load >/dev/null 2>&1
for ts in `dirname $0`/test-*.sh; do
sh $ts
done
graid3 unload

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..2"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -11,21 +13,22 @@ 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
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} 2>/dev/null || exit 1
devwait
# Size of created device should be 2MB - 1024B.
mediasize=`diskinfo /dev/raid3/${name} | awk '{print $3}'`
if [ $mediasize -eq 2096128 ]; then
echo "PASS"
echo "ok 1"
else
echo "FAIL"
echo "not ok 1"
fi
sectorsize=`diskinfo /dev/raid3/${name} | awk '{print $2}'`
if [ $sectorsize -eq 1024 ]; then
echo "PASS"
echo "ok 2"
else
echo "FAIL"
echo "not ok 2"
fi
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,14 +21,15 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label -r $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,14 +21,15 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label -w $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ dd if=/dev/random of=/dev/md${us1} count=$nblocks1 >/dev/null 2>&1
dd if=/dev/random of=/dev/md${us2} count=$nblocks1 >/dev/null 2>&1
graid3 label -w $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
# Wait for synchronization.
sleep 2
graid3 stop $name
@ -32,9 +35,9 @@ sleep 1
dd if=/dev/raid3/${name} of=/dev/null bs=1k count=$nblocks3 >/dev/null 2>&1
ec=$?
if [ $ec -eq 0 ]; then
echo "FAIL"
echo "not ok 1"
else
echo "PASS"
echo "ok 1"
fi
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,14 +21,15 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@ -28,9 +31,9 @@ dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
graid3 remove -n 1 $name
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
#
# Writing without one DATA component.
@ -28,9 +31,9 @@ dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
#
# Writing without PARITY component.
@ -28,9 +31,9 @@ dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@ -32,9 +35,9 @@ sleep 1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@ -35,9 +38,9 @@ dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
#
# Writing without DATA component and rebuild of DATA component.
@ -31,9 +34,9 @@ sleep 1
dd if=/dev/raid3/${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
graid3 stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..1"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -19,6 +21,7 @@ mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
devwait
#
# Writing without PARITY component and rebuild of PARITY component.
@ -34,9 +37,9 @@ dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>
dd if=/dev/raid3/${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
graid3 stop $name