- Make test-1.sh into a TAP testable testcase

- Delete test-2.sh as it was an incomplete testcase, and the contents were
  basically a subset of test-1.sh
- Add a conf.sh file for executing common functions with geom_uzip
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
Enji Cooper 2016-01-08 21:38:26 +00:00
parent b8338417d2
commit eb028f7b2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=293443
6 changed files with 43 additions and 62 deletions

View File

@ -9,7 +9,7 @@ ZIMAGE= ${IMAGE}.uzip
UZIMAGE= ${ZIMAGE}.uue
test:
@sh runtests.sh
prove -rv ./test-1.t
image:
makefs -s 1048576 ${IMAGE} etalon

View File

@ -0,0 +1,20 @@
#!/bin/sh
# $FreeBSD$
class="uzip"
base=`basename $0`
uzip_test_cleanup()
{
if [ -n "$mntpoint" ]; then
umount $mntpoint
rmdir $mntpoint
fi
geom_test_cleanup
}
trap uzip_test_cleanup ABRT EXIT INT TERM
. `dirname $0`/../geom_subr.sh
# NOTE: make sure $TMPDIR has been set by geom_subr.sh if unset [by kyua, etc]
mntpoint=$(mktemp -d tmp.XXXXXX) || exit

View File

@ -1,10 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
dir=`dirname $0`
for ts in `dirname $0`/test-*.sh; do
sh $ts
done

View File

@ -1,36 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
mntpoint="/mnt/test-1"
#
# prepare
kldload geom_uzip
uudecode test-1.img.uzip.uue
num=`mdconfig -an -f test-1.img.uzip` || exit 1
sleep 1
#
# mount
mkdir -p "${mntpoint}"
mount -o ro /dev/md${num}.uzip "${mntpoint}" || exit 1
#
# compare
#cat "${mntpoint}/etalon.txt"
diff -u etalon/etalon.txt "${mntpoint}/etalon.txt"
if [ $? -eq 0 ]; then
echo "PASS"
else
echo "FAIL"
fi
#
# cleanup
umount "${mntpoint}"
rmdir "${mntpoint}"
mdconfig -d -u ${num}
sleep 1
kldunload geom_uzip

View File

@ -0,0 +1,22 @@
#!/bin/sh
# $FreeBSD$
testsdir=$(dirname $0)
. $testsdir/conf.sh
echo "1..1"
UUE=$testsdir/test-1.img.uzip.uue
uudecode $UUE
us0=$(attach_md -f $(basename $UUE .uue)) || exit 1
sleep 1
mount -o ro /dev/${us0}.uzip "${mntpoint}" || exit 1
#cat "${mntpoint}/etalon.txt"
diff -I '\$FreeBSD.*\$' -u $testsdir/etalon/etalon.txt "${mntpoint}/etalon.txt"
if [ $? -eq 0 ]; then
echo "ok 1"
else
echo "not ok 1"
fi

View File

@ -1,15 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
#
# prepare
kldload geom_uzip
uudecode test-1.img.uzip.uue
num=`mdconfig -an -f test-1.img.uzip` || exit 1
sleep 1
#
# destroy
kldunload geom_uzip