Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2016 01:16:50 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r296786 - stable/10/tools/regression/geom_stripe
Message-ID:  <201603130116.u2D1Go4N088275@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Mar 13 01:16:50 2016
New Revision: 296786
URL: https://svnweb.freebsd.org/changeset/base/296786

Log:
  MFC r293442:
  
  - Add a geom_stripe specific cleanup function and trap on that function at
    exit so things are cleaned up properly
  - Use attach_md for attaching md(4) devices
  - Don't hardcode /tmp for temporary files, which violates the kyua sandbox

Modified:
  stable/10/tools/regression/geom_stripe/conf.sh
  stable/10/tools/regression/geom_stripe/test-1.t
  stable/10/tools/regression/geom_stripe/test-2.t
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tools/regression/geom_stripe/conf.sh
==============================================================================
--- stable/10/tools/regression/geom_stripe/conf.sh	Sun Mar 13 01:15:34 2016	(r296785)
+++ stable/10/tools/regression/geom_stripe/conf.sh	Sun Mar 13 01:16:50 2016	(r296786)
@@ -5,4 +5,11 @@ name="$(mktemp -u stripe.XXXXXX)"
 class="stripe"
 base=`basename $0`
 
+gstripe_test_cleanup()
+{
+	[ -c /dev/$class/$name ] && gstripe destroy $name
+	geom_test_cleanup
+}
+trap gstripe_test_cleanup ABRT EXIT INT TERM
+
 . `dirname $0`/../geom_subr.sh

Modified: stable/10/tools/regression/geom_stripe/test-1.t
==============================================================================
--- stable/10/tools/regression/geom_stripe/test-1.t	Sun Mar 13 01:15:34 2016	(r296785)
+++ stable/10/tools/regression/geom_stripe/test-1.t	Sun Mar 13 01:16:50 2016	(r296786)
@@ -5,13 +5,11 @@
 
 echo "1..1"
 
-us=45
+us0=$(attach_md -t malloc -s 1M) || exit 1
+us1=$(attach_md -t malloc -s 2M) || exit 1
+us2=$(attach_md -t malloc -s 3M) || exit 1
 
-mdconfig -a -t malloc -s 1M -u $us || exit 1
-mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1
-mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1
-
-gstripe create -s 16384 $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1
+gstripe create -s 16384 $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
 devwait
 
 # Size of created device should be 1MB * 3.
@@ -23,8 +21,3 @@ if [ $size -eq 3145728 ]; then
 else
 	echo "not ok 1"
 fi
-
-gstripe destroy $name
-mdconfig -d -u $us
-mdconfig -d -u `expr $us + 1`
-mdconfig -d -u `expr $us + 2`

Modified: stable/10/tools/regression/geom_stripe/test-2.t
==============================================================================
--- stable/10/tools/regression/geom_stripe/test-2.t	Sun Mar 13 01:15:34 2016	(r296785)
+++ stable/10/tools/regression/geom_stripe/test-2.t	Sun Mar 13 01:16:50 2016	(r296786)
@@ -5,18 +5,17 @@
 
 echo "1..1"
 
-us=45
 tsize=3
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
 
 dd if=/dev/random of=${src} bs=1m count=$tsize >/dev/null 2>&1
 
-mdconfig -a -t malloc -s 1M -u $us || exit 1
-mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1
-mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1
+us0=$(attach_md -t malloc -s 1M) || exit 1
+us1=$(attach_md -t malloc -s 2M) || exit 1
+us2=$(attach_md -t malloc -s 3M) || exit 1
 
-gstripe create -s 8192 $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1
+gstripe create -s 8192 $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
 devwait
 
 dd if=${src} of=/dev/stripe/${name} bs=1m count=$tsize >/dev/null 2>&1
@@ -28,8 +27,4 @@ else
 	echo "ok 1"
 fi
 
-gstripe destroy $name
-mdconfig -d -u $us
-mdconfig -d -u `expr $us + 1`
-mdconfig -d -u `expr $us + 2`
 rm -f ${src} ${dst}



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