svn commit: r296792 - stable/9/tools/regression/geom_nop
Garrett Cooper
ngie at FreeBSD.org
Sun Mar 13 02:06:11 UTC 2016
Author: ngie
Date: Sun Mar 13 02:06:09 2016
New Revision: 296792
URL: https://svnweb.freebsd.org/changeset/base/296792
Log:
MFstable/10 r296783:
MFC r293437:
- 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
Modified:
stable/9/tools/regression/geom_nop/conf.sh
stable/9/tools/regression/geom_nop/test-1.t
stable/9/tools/regression/geom_nop/test-2.t
Directory Properties:
stable/9/ (props changed)
stable/9/tools/ (props changed)
stable/9/tools/regression/ (props changed)
Modified: stable/9/tools/regression/geom_nop/conf.sh
==============================================================================
--- stable/9/tools/regression/geom_nop/conf.sh Sun Mar 13 02:05:16 2016 (r296791)
+++ stable/9/tools/regression/geom_nop/conf.sh Sun Mar 13 02:06:09 2016 (r296792)
@@ -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: stable/9/tools/regression/geom_nop/test-1.t
==============================================================================
--- stable/9/tools/regression/geom_nop/test-1.t Sun Mar 13 02:05:16 2016 (r296791)
+++ stable/9/tools/regression/geom_nop/test-1.t Sun Mar 13 02:06:09 2016 (r296792)
@@ -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: stable/9/tools/regression/geom_nop/test-2.t
==============================================================================
--- stable/9/tools/regression/geom_nop/test-2.t Sun Mar 13 02:05:16 2016 (r296791)
+++ stable/9/tools/regression/geom_nop/test-2.t Sun Mar 13 02:06:09 2016 (r296792)
@@ -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}
More information about the svn-src-stable-9
mailing list