Date: Fri, 8 Jan 2016 19:43:18 +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: r293437 - head/tools/regression/geom_nop Message-ID: <201601081943.u08JhIkf060549@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Fri Jan 8 19:43:18 2016 New Revision: 293437 URL: https://svnweb.freebsd.org/changeset/base/293437 Log: - Add a conf.sh file for executing common functions with gnop - 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 Modified: head/tools/regression/geom_nop/conf.sh head/tools/regression/geom_nop/test-1.t head/tools/regression/geom_nop/test-2.t Modified: head/tools/regression/geom_nop/conf.sh ============================================================================== --- head/tools/regression/geom_nop/conf.sh Fri Jan 8 19:38:59 2016 (r293436) +++ head/tools/regression/geom_nop/conf.sh Fri Jan 8 19:43:18 2016 (r293437) @@ -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 Modified: head/tools/regression/geom_nop/test-1.t ============================================================================== --- head/tools/regression/geom_nop/test-1.t Fri Jan 8 19:38:59 2016 (r293436) +++ head/tools/regression/geom_nop/test-1.t Fri Jan 8 19:43:18 2016 (r293437) @@ -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: head/tools/regression/geom_nop/test-2.t ============================================================================== --- head/tools/regression/geom_nop/test-2.t Fri Jan 8 19:38:59 2016 (r293436) +++ head/tools/regression/geom_nop/test-2.t Fri Jan 8 19:43:18 2016 (r293437) @@ -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}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601081943.u08JhIkf060549>