From owner-svn-src-user@freebsd.org Tue Nov 17 01:02:46 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BA48A31D50 for ; Tue, 17 Nov 2015 01:02:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4CD1D38; Tue, 17 Nov 2015 01:02:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAH12jB5047829; Tue, 17 Nov 2015 01:02:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAH12ilM047820; Tue, 17 Nov 2015 01:02:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511170102.tAH12ilM047820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 17 Nov 2015 01:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r290967 - user/ngie/more-tests2/sbin/geom/class/tests/mirror X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2015 01:02:46 -0000 Author: ngie Date: Tue Nov 17 01:02:44 2015 New Revision: 290967 URL: https://svnweb.freebsd.org/changeset/base/290967 Log: - Use unique gmirror names - Use attach_md for tracking md(4) devices - Tear down the mirror in a consolidated cleanup routine Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/1_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/2_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/3_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/4_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/5_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/6_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/7_test.sh user/ngie/more-tests2/sbin/geom/class/tests/mirror/conf.sh Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/1_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/1_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/1_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -5,15 +5,11 @@ echo "1..1" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` - -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 +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 -gmirror label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 +gmirror label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 devwait # Size of created device should be 1MB - 512b. @@ -25,10 +21,3 @@ if [ $size -eq 1048064 ]; then else echo "not ok 1" fi - -gmirror remove $name md${us0} -gmirror remove $name md${us1} -gmirror remove $name md${us2} -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/2_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/2_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/2_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -6,22 +6,19 @@ echo "1..4" balance="round-robin" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` ddbs=2048 nblocks1=1024 nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` -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=$ddbs count=$nblocks2 >/dev/null 2>&1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 +us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 -gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 +gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 devwait dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 @@ -32,28 +29,24 @@ if [ `md5 -q ${src}` != `md5 -q ${dst}` else echo "ok 1" fi -dd if=/dev/md${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 +dd if=/dev/${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 2" else echo "ok 2" fi -dd if=/dev/md${us1} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 +dd if=/dev/${us1} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 3" else echo "ok 3" fi -dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 +dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 4" else echo "ok 4" fi -gmirror remove $name md${us0} md${us1} md${us2} -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/3_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/3_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/3_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -6,22 +6,19 @@ echo "1..5" balance="round-robin" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` ddbs=2048 nblocks1=1024 nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` -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=$ddbs count=$nblocks2 >/dev/null 2>&1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 +us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 -gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 +gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 devwait dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 @@ -33,7 +30,7 @@ else echo "ok 1" fi -gmirror remove $name md${us0} +gmirror remove $name ${us0} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 2" @@ -41,7 +38,7 @@ else echo "ok 2" fi -gmirror remove $name md${us1} +gmirror remove $name ${us1} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 3" @@ -49,7 +46,7 @@ else echo "ok 3" fi -gmirror remove $name md${us2} +gmirror remove $name ${us2} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 4" @@ -64,7 +61,4 @@ else echo "ok 5" fi -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/4_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/4_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/4_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -6,22 +6,19 @@ echo "1..5" balance="load" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` ddbs=2048 nblocks1=1024 nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` -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=$ddbs count=$nblocks2 >/dev/null 2>&1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 +us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 -gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 +gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 devwait dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 @@ -33,7 +30,7 @@ else echo "ok 1" fi -gmirror remove $name md${us0} +gmirror remove $name ${us0} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 2" @@ -41,7 +38,7 @@ else echo "ok 2" fi -gmirror remove $name md${us1} +gmirror remove $name ${us1} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 3" @@ -49,7 +46,7 @@ else echo "ok 3" fi -gmirror remove $name md${us2} +gmirror remove $name ${us2} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 4" @@ -57,6 +54,8 @@ else echo "ok 4" fi +gmirror destroy $name + # mirror/${name} should be removed. if [ -c /dev/${name} ]; then echo "not ok 5" @@ -64,7 +63,4 @@ else echo "ok 5" fi -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/5_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/5_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/5_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -6,22 +6,19 @@ echo "1..5" balance="split" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` ddbs=8192 nblocks1=1024 nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` -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=$ddbs count=$nblocks2 >/dev/null 2>&1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 +us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 -gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 +gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 devwait dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 @@ -33,7 +30,7 @@ else echo "ok 1" fi -gmirror remove $name md${us0} +gmirror remove $name ${us0} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 2" @@ -41,7 +38,7 @@ else echo "ok 2" fi -gmirror remove $name md${us1} +gmirror remove $name ${us1} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 3" @@ -49,7 +46,7 @@ else echo "ok 3" fi -gmirror remove $name md${us2} +gmirror remove $name ${us2} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 4" @@ -64,7 +61,4 @@ else echo "ok 5" fi -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/6_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/6_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/6_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -6,26 +6,23 @@ echo "1..2" balance="split" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` ddbs=8192 nblocks1=1024 nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` -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=$ddbs count=$nblocks2 >/dev/null 2>&1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 +us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 -gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} || exit 1 +gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/${us0} /dev/${us1} || exit 1 devwait dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 -dd if=/dev/zero of=/dev/md${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 +dd if=/dev/zero of=/dev/${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then @@ -35,18 +32,14 @@ else fi # Connect disk to the mirror. -gmirror insert ${name} md${us2} +gmirror insert ${name} ${us2} # Wait for synchronization. sleep 1 -dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 +dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 2" else echo "ok 2" fi -gmirror remove $name md${us0} md${us1} md${us2} -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/7_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/7_test.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/7_test.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -6,22 +6,19 @@ echo "1..5" balance="prefer" -us0=45 -us1=`expr $us0 + 1` -us2=`expr $us0 + 2` ddbs=2048 nblocks1=1024 nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` -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=$ddbs count=$nblocks2 >/dev/null 2>&1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 -mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 +us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 +us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1 -gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 +gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 devwait dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 @@ -33,7 +30,7 @@ else echo "ok 1" fi -gmirror remove $name md${us0} +gmirror remove $name ${us0} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 2" @@ -41,7 +38,7 @@ else echo "ok 2" fi -gmirror remove $name md${us1} +gmirror remove $name ${us1} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 3" @@ -49,7 +46,7 @@ else echo "ok 3" fi -gmirror remove $name md${us2} +gmirror remove $name ${us2} dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 4" @@ -64,7 +61,4 @@ else echo "ok 5" fi -mdconfig -d -u $us0 -mdconfig -d -u $us1 -mdconfig -d -u $us2 rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/mirror/conf.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/mirror/conf.sh Tue Nov 17 01:01:03 2015 (r290966) +++ user/ngie/more-tests2/sbin/geom/class/tests/mirror/conf.sh Tue Nov 17 01:02:44 2015 (r290967) @@ -1,8 +1,15 @@ #!/bin/sh # $FreeBSD$ -name="test" +name="$(mktemp -u mirror.XXXXXX)" class="mirror" base=`basename $0` +gmirror_test_cleanup() +{ + [ -c /dev/$class/$name ] && gmirror destroy $name + geom_test_cleanup +} +trap gmirror_test_cleanup ABRT EXIT INT TERM + . `dirname $0`/../geom_subr.sh