Date: Wed, 25 Nov 2015 03:53:14 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r291283 - user/ngie/more-tests2/sbin/geom/class/tests/nop Message-ID: <201511250353.tAP3rECE027720@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Wed Nov 25 03:53:14 2015 New Revision: 291283 URL: https://svnweb.freebsd.org/changeset/base/291283 Log: conf.sh: - Implement gnop_test_cleanup - Use a random name for the shsec 1_test.sh/2_test.sh: - Attach md devices with attach_md - Remove unnecessary mdconfig -d -u and gstripe destroy calls at the end of the scripts Modified: user/ngie/more-tests2/sbin/geom/class/tests/nop/1_test.sh user/ngie/more-tests2/sbin/geom/class/tests/nop/2_test.sh user/ngie/more-tests2/sbin/geom/class/tests/nop/conf.sh Modified: user/ngie/more-tests2/sbin/geom/class/tests/nop/1_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/nop/1_test.sh Wed Nov 25 03:46:49 2015 (r291282) +++ user/ngie/more-tests2/sbin/geom/class/tests/nop/1_test.sh Wed Nov 25 03:53:14 2015 (r291283) @@ -5,21 +5,16 @@ echo "1..1" -us=45 +us=$(attach_md -t malloc -s 1M) || exit 1 -mdconfig -a -t malloc -s 1M -u $us || exit 1 - -gnop create /dev/md${us} || exit 1 +gnop create /dev/${us} || exit 1 # Size of created device should be 1MB. -size=`diskinfo /dev/md${us}.nop | awk '{print $3}'` +size=`diskinfo /dev/${us}.nop | awk '{print $3}'` if [ $size -eq 1048576 ]; then echo "ok 1" else echo "not ok 1" fi - -gnop destroy md${us}.nop -mdconfig -d -u $us Modified: user/ngie/more-tests2/sbin/geom/class/tests/nop/2_test.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/nop/2_test.sh Wed Nov 25 03:46:49 2015 (r291282) +++ user/ngie/more-tests2/sbin/geom/class/tests/nop/2_test.sh Wed Nov 25 03:53:14 2015 (r291283) @@ -3,20 +3,19 @@ . `dirname $0`/conf.sh -us=45 -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 echo "1..1" dd if=/dev/random of=${src} bs=1m count=1 >/dev/null 2>&1 -mdconfig -a -t malloc -s 1M -u $us || exit 1 +us=$(attach_md -t malloc -s 1M) || exit 1 -gnop create /dev/md${us} || exit 1 +gnop create /dev/${us} || exit 1 -dd if=${src} of=/dev/md${us}.nop bs=1m count=1 >/dev/null 2>&1 -dd if=/dev/md${us}.nop of=${dst} bs=1m count=1 >/dev/null 2>&1 +dd if=${src} of=/dev/${us}.nop bs=1m count=1 >/dev/null 2>&1 +dd if=/dev/${us}.nop of=${dst} bs=1m count=1 >/dev/null 2>&1 if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then echo "not ok 1" @@ -24,6 +23,4 @@ else echo "ok 1" fi -gnop destroy md${us}.nop -mdconfig -d -u $us rm -f ${src} ${dst} Modified: user/ngie/more-tests2/sbin/geom/class/tests/nop/conf.sh ============================================================================== --- user/ngie/more-tests2/sbin/geom/class/tests/nop/conf.sh Wed Nov 25 03:46:49 2015 (r291282) +++ user/ngie/more-tests2/sbin/geom/class/tests/nop/conf.sh Wed Nov 25 03:53:14 2015 (r291283) @@ -4,4 +4,11 @@ class="nop" base=`basename $0` +gnop_test_cleanup() +{ + [ -c /dev/${us}.nop ] && gnop destroy ${us}.nop + geom_test_cleanup +} +trap gnop_test_cleanup ABRT EXIT INT TERM + . `dirname $0`/../geom_subr.sh
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511250353.tAP3rECE027720>