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

This commit is contained in:
Pawel Jakub Dawidek 2005-12-07 01:29:50 +00:00
parent 3c6d62f3c4
commit 54cd653136
5 changed files with 31 additions and 36 deletions

View File

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

View File

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

View File

@ -1,10 +0,0 @@
#!/bin/sh
# $FreeBSD$
dir=`dirname $0`
gshsec load >/dev/null 2>&1
for ts in `dirname $0`/test-*.sh; do
sh $ts
done
gshsec 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
gshsec label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
gshsec label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} 2>/dev/null || exit 1
devwait
# Size of created device should be 1MB - 512B.
mediasize=`diskinfo /dev/shsec/${name} | awk '{print $3}'`
if [ $mediasize -eq 1048064 ]; then
echo "PASS"
echo "ok 1"
else
echo "FAIL"
echo "not ok 1"
fi
sectorsize=`diskinfo /dev/shsec/${name} | awk '{print $2}'`
if [ $sectorsize -eq 512 ]; then
echo "PASS"
echo "ok 2"
else
echo "FAIL"
echo "not ok 2"
fi
gshsec stop $name

View File

@ -1,8 +1,10 @@
#!/bin/sh
# $FreeBSD$
name="test"
base=`basename $0`
. `dirname $0`/conf.sh
echo "1..4"
us0=45
us1=`expr $us0 + 1`
us2=`expr $us0 + 2`
@ -18,36 +20,36 @@ mdconfig -a -t malloc -s $nblocks2 -u $us1 || exit 1
mdconfig -a -t malloc -s $nblocks2 -u $us2 || exit 1
gshsec label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
sleep 1
devwait
dd if=${src} of=/dev/shsec/${name} count=$nblocks1 >/dev/null 2>&1
dd if=/dev/shsec/${name} of=${dst} count=$nblocks1 >/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} count=$nblocks1 >/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} count=$nblocks1 >/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} count=$nblocks1 >/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
gshsec stop $name