svn commit: r296785 - stable/10/tools/regression/geom_shsec
Garrett Cooper
ngie at FreeBSD.org
Sun Mar 13 01:15:36 UTC 2016
Author: ngie
Date: Sun Mar 13 01:15:34 2016
New Revision: 296785
URL: https://svnweb.freebsd.org/changeset/base/296785
Log:
MFC r293441:
- Add a geom_shsec 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_shsec/conf.sh
stable/10/tools/regression/geom_shsec/test-1.t
stable/10/tools/regression/geom_shsec/test-2.t
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/tools/regression/geom_shsec/conf.sh
==============================================================================
--- stable/10/tools/regression/geom_shsec/conf.sh Sun Mar 13 01:14:07 2016 (r296784)
+++ stable/10/tools/regression/geom_shsec/conf.sh Sun Mar 13 01:15:34 2016 (r296785)
@@ -5,4 +5,11 @@ name="$(mktemp -u shsec.XXXXXX)"
class="shsec"
base=`basename $0`
+shsec_test_cleanup()
+{
+ [ -c /dev/$class/$name ] && gshsec stop $name
+ geom_test_cleanup
+}
+trap shsec_test_cleanup ABRT EXIT INT TERM
+
. `dirname $0`/../geom_subr.sh
Modified: stable/10/tools/regression/geom_shsec/test-1.t
==============================================================================
--- stable/10/tools/regression/geom_shsec/test-1.t Sun Mar 13 01:14:07 2016 (r296784)
+++ stable/10/tools/regression/geom_shsec/test-1.t Sun Mar 13 01:15:34 2016 (r296785)
@@ -5,15 +5,11 @@
echo "1..2"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
+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 $us0 || exit 1
-mdconfig -a -t malloc -s 2M -u $us1 || exit 1
-mdconfig -a -t malloc -s 3M -u $us2 || exit 1
-
-gshsec label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} 2>/dev/null || exit 1
+gshsec label $name /dev/${us0} /dev/${us1} /dev/${us2} 2>/dev/null || exit 1
devwait
# Size of created device should be 1MB - 512B.
@@ -30,8 +26,3 @@ if [ $sectorsize -eq 512 ]; then
else
echo "not ok 2"
fi
-
-gshsec stop $name
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
Modified: stable/10/tools/regression/geom_shsec/test-2.t
==============================================================================
--- stable/10/tools/regression/geom_shsec/test-2.t Sun Mar 13 01:14:07 2016 (r296784)
+++ stable/10/tools/regression/geom_shsec/test-2.t Sun Mar 13 01:15:34 2016 (r296785)
@@ -5,21 +5,18 @@
echo "1..4"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
nblocks1=1024
nblocks2=`expr $nblocks1 + 1`
-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} count=$nblocks1 >/dev/null 2>&1
-mdconfig -a -t malloc -s $nblocks2 -u $us0 || exit 1
-mdconfig -a -t malloc -s $nblocks2 -u $us1 || exit 1
-mdconfig -a -t malloc -s $nblocks2 -u $us2 || exit 1
+us0=$(attach_md -t malloc -s $nblocks2) || exit 1
+us1=$(attach_md -t malloc -s $nblocks2) || exit 1
+us2=$(attach_md -t malloc -s $nblocks2) || exit 1
-gshsec label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gshsec label $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
devwait
dd if=${src} of=/dev/shsec/${name} count=$nblocks1 >/dev/null 2>&1
@@ -31,29 +28,25 @@ else
echo "ok 1"
fi
-dd if=/dev/md${us0} of=${dst} count=$nblocks1 >/dev/null 2>&1
+dd if=/dev/${us0} of=${dst} count=$nblocks1 >/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} count=$nblocks1 >/dev/null 2>&1
+dd if=/dev/${us1} of=${dst} count=$nblocks1 >/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} count=$nblocks1 >/dev/null 2>&1
+dd if=/dev/${us2} of=${dst} count=$nblocks1 >/dev/null 2>&1
if [ `md5 -q ${src}` = `md5 -q ${dst}` ]; then
echo "not ok 4"
else
echo "ok 4"
fi
-gshsec stop $name
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
More information about the svn-src-stable
mailing list