aboutsummaryrefslogtreecommitdiff
path: root/tools/regression
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2016-01-08 19:10:52 +0000
committerEnji Cooper <ngie@FreeBSD.org>2016-01-08 19:10:52 +0000
commit6b2f497e48252223d3dc6344db3214bda0dcb8b8 (patch)
tree3a38d37e4e79180f91c67538d00ad92d61d0f210 /tools/regression
parent829fae9063685b393b1fc5670abd9c0d2c3686a1 (diff)
downloadsrc-6b2f497e48252223d3dc6344db3214bda0dcb8b8.tar.gz
src-6b2f497e48252223d3dc6344db3214bda0dcb8b8.zip
- Use attach_md for memory disks so they can be tracked.
- Add a geom_concat specific cleanup function and trap on that function at exit so things are cleaned up properly - Don't hardcode /tmp for temporary files, which violates the kyua sandbox MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=293434
Diffstat (limited to 'tools/regression')
-rw-r--r--tools/regression/geom_concat/conf.sh7
-rw-r--r--tools/regression/geom_concat/test-1.t15
-rw-r--r--tools/regression/geom_concat/test-2.t19
3 files changed, 18 insertions, 23 deletions
diff --git a/tools/regression/geom_concat/conf.sh b/tools/regression/geom_concat/conf.sh
index c8692bbc84da..374ed12aecc2 100644
--- a/tools/regression/geom_concat/conf.sh
+++ b/tools/regression/geom_concat/conf.sh
@@ -5,4 +5,11 @@ name="$(mktemp -u concat.XXXXXX)"
class="concat"
base=`basename $0`
+gconcat_test_cleanup()
+{
+ [ -c /dev/$class/$name ] && gconcat destroy $name
+ geom_test_cleanup
+}
+trap gconcat_test_cleanup ABRT EXIT INT TERM
+
. `dirname $0`/../geom_subr.sh
diff --git a/tools/regression/geom_concat/test-1.t b/tools/regression/geom_concat/test-1.t
index 8984f79b1045..ef80a61bc18e 100644
--- a/tools/regression/geom_concat/test-1.t
+++ b/tools/regression/geom_concat/test-1.t
@@ -5,13 +5,11 @@
echo '1..1'
-us=45
+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 $us || exit 1
-mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1
-mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1
-
-gconcat create $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1
+gconcat create $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
devwait
# Size of created device should be 1MB + 2MB + 3MB.
@@ -23,8 +21,3 @@ if [ $size -eq 6291456 ]; then
else
echo "not ok - Size is 6291456"
fi
-
-gconcat destroy $name
-mdconfig -d -u $us
-mdconfig -d -u `expr $us + 1`
-mdconfig -d -u `expr $us + 2`
diff --git a/tools/regression/geom_concat/test-2.t b/tools/regression/geom_concat/test-2.t
index 445d9bc712f9..95636be860eb 100644
--- a/tools/regression/geom_concat/test-2.t
+++ b/tools/regression/geom_concat/test-2.t
@@ -5,18 +5,17 @@
echo '1..1'
-us=45
tsize=6
-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=1m count=$tsize >/dev/null 2>&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
-mdconfig -a -t malloc -s 1M -u $us || exit 1
-mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1
-mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1
+dd if=/dev/random of=${src} bs=1m count=$tsize >/dev/null 2>&1
-gconcat create $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1
+gconcat create $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
devwait
dd if=${src} of=/dev/concat/${name} bs=1m count=$tsize >/dev/null 2>&1
@@ -28,8 +27,4 @@ else
echo "ok - md5 checksum comparison"
fi
-gconcat destroy $name
-mdconfig -d -u $us
-mdconfig -d -u `expr $us + 1`
-mdconfig -d -u `expr $us + 2`
rm -f ${src} ${dst}