Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 2016 21:38:26 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r293443 - head/tools/regression/geom_uzip
Message-ID:  <201601082138.u08LcQAf092764@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Jan  8 21:38:26 2016
New Revision: 293443
URL: https://svnweb.freebsd.org/changeset/base/293443

Log:
  - 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

Added:
  head/tools/regression/geom_uzip/conf.sh   (contents, props changed)
  head/tools/regression/geom_uzip/test-1.t
     - copied, changed from r293442, head/tools/regression/geom_uzip/test-1.sh
Deleted:
  head/tools/regression/geom_uzip/runtests.sh
  head/tools/regression/geom_uzip/test-1.sh
  head/tools/regression/geom_uzip/test-2.sh
Modified:
  head/tools/regression/geom_uzip/Makefile

Modified: head/tools/regression/geom_uzip/Makefile
==============================================================================
--- head/tools/regression/geom_uzip/Makefile	Fri Jan  8 21:28:09 2016	(r293442)
+++ head/tools/regression/geom_uzip/Makefile	Fri Jan  8 21:38:26 2016	(r293443)
@@ -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

Added: head/tools/regression/geom_uzip/conf.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/geom_uzip/conf.sh	Fri Jan  8 21:38:26 2016	(r293443)
@@ -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

Copied and modified: head/tools/regression/geom_uzip/test-1.t (from r293442, head/tools/regression/geom_uzip/test-1.sh)
==============================================================================
--- head/tools/regression/geom_uzip/test-1.sh	Fri Jan  8 21:28:09 2016	(r293442, copy source)
+++ head/tools/regression/geom_uzip/test-1.t	Fri Jan  8 21:38:26 2016	(r293443)
@@ -1,36 +1,22 @@
 #!/bin/sh
-#
 # $FreeBSD$
-#
 
-mntpoint="/mnt/test-1"
+testsdir=$(dirname $0)
+. $testsdir/conf.sh
 
-#
-# prepare
-kldload geom_uzip
-uudecode test-1.img.uzip.uue
-num=`mdconfig -an -f test-1.img.uzip` || exit 1
+echo "1..1"
+
+UUE=$testsdir/test-1.img.uzip.uue
+uudecode $UUE
+us0=$(attach_md -f $(basename $UUE .uue)) || exit 1
 sleep 1
 
-#
-# mount
-mkdir -p "${mntpoint}"
-mount -o ro /dev/md${num}.uzip "${mntpoint}" || exit 1
+mount -o ro /dev/${us0}.uzip "${mntpoint}" || exit 1
 
-#
-# compare
 #cat "${mntpoint}/etalon.txt"
-diff -u etalon/etalon.txt "${mntpoint}/etalon.txt"
+diff -I '\$FreeBSD.*\$' -u $testsdir/etalon/etalon.txt "${mntpoint}/etalon.txt"
 if [ $? -eq 0 ]; then
-	echo "PASS"
+	echo "ok 1"
 else
-	echo "FAIL"
+	echo "not ok 1"
 fi
-
-#
-# cleanup
-umount "${mntpoint}"
-rmdir "${mntpoint}"
-mdconfig -d -u ${num}
-sleep 1
-kldunload geom_uzip



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601082138.u08LcQAf092764>