summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-03-13 01:17:53 +0000
committerngie <ngie@FreeBSD.org>2016-03-13 01:17:53 +0000
commite8d93bbb19f29faf51fb9e0180aa7ef3a01ff11b (patch)
tree9280ade6f900b9d5694c746b92d67afa8d38d8dd /tools
parentc5dd044a69676625269af300fc4317d8be2943d2 (diff)
downloadFreeBSD-src-e8d93bbb19f29faf51fb9e0180aa7ef3a01ff11b.zip
FreeBSD-src-e8d93bbb19f29faf51fb9e0180aa7ef3a01ff11b.tar.gz
MFC r293443:
- 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
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/geom_uzip/Makefile2
-rwxr-xr-xtools/regression/geom_uzip/conf.sh20
-rw-r--r--tools/regression/geom_uzip/runtests.sh10
-rw-r--r--tools/regression/geom_uzip/test-1.sh36
-rw-r--r--tools/regression/geom_uzip/test-1.t22
-rw-r--r--tools/regression/geom_uzip/test-2.sh15
6 files changed, 43 insertions, 62 deletions
diff --git a/tools/regression/geom_uzip/Makefile b/tools/regression/geom_uzip/Makefile
index 6927ff1..3186ef6 100644
--- a/tools/regression/geom_uzip/Makefile
+++ b/tools/regression/geom_uzip/Makefile
@@ -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
diff --git a/tools/regression/geom_uzip/conf.sh b/tools/regression/geom_uzip/conf.sh
new file mode 100755
index 0000000..9a22841
--- /dev/null
+++ b/tools/regression/geom_uzip/conf.sh
@@ -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
diff --git a/tools/regression/geom_uzip/runtests.sh b/tools/regression/geom_uzip/runtests.sh
deleted file mode 100644
index 60e78b5..0000000
--- a/tools/regression/geom_uzip/runtests.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-dir=`dirname $0`
-
-for ts in `dirname $0`/test-*.sh; do
- sh $ts
-done
diff --git a/tools/regression/geom_uzip/test-1.sh b/tools/regression/geom_uzip/test-1.sh
deleted file mode 100644
index 7e8f168..0000000
--- a/tools/regression/geom_uzip/test-1.sh
+++ /dev/null
@@ -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
diff --git a/tools/regression/geom_uzip/test-1.t b/tools/regression/geom_uzip/test-1.t
new file mode 100644
index 0000000..b156c06
--- /dev/null
+++ b/tools/regression/geom_uzip/test-1.t
@@ -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
diff --git a/tools/regression/geom_uzip/test-2.sh b/tools/regression/geom_uzip/test-2.sh
deleted file mode 100644
index 8662827..0000000
--- a/tools/regression/geom_uzip/test-2.sh
+++ /dev/null
@@ -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
OpenPOWER on IntegriCloud