summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-11-25 03:57:58 +0000
committerngie <ngie@FreeBSD.org>2015-11-25 03:57:58 +0000
commit731c5014d4b12c3b2f16960ed3894a19cdfe138a (patch)
tree5662917393c2a8157f00e34ac4ab6f3424e7545a
parent2a21ca898bc762a485efb3b613009eb2a5f158f8 (diff)
downloadFreeBSD-src-731c5014d4b12c3b2f16960ed3894a19cdfe138a.zip
FreeBSD-src-731c5014d4b12c3b2f16960ed3894a19cdfe138a.tar.gz
conf.sh:
- Implement gconcat_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 gconcat destroy calls at the end of the scripts
-rwxr-xr-xsbin/geom/class/tests/concat/1_test.sh15
-rwxr-xr-xsbin/geom/class/tests/concat/2_test.sh19
-rwxr-xr-xsbin/geom/class/tests/concat/conf.sh9
3 files changed, 19 insertions, 24 deletions
diff --git a/sbin/geom/class/tests/concat/1_test.sh b/sbin/geom/class/tests/concat/1_test.sh
index 8984f79..ef80a61 100755
--- a/sbin/geom/class/tests/concat/1_test.sh
+++ b/sbin/geom/class/tests/concat/1_test.sh
@@ -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/sbin/geom/class/tests/concat/2_test.sh b/sbin/geom/class/tests/concat/2_test.sh
index 445d9bc..95636be 100755
--- a/sbin/geom/class/tests/concat/2_test.sh
+++ b/sbin/geom/class/tests/concat/2_test.sh
@@ -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}
diff --git a/sbin/geom/class/tests/concat/conf.sh b/sbin/geom/class/tests/concat/conf.sh
index 0eaf1ba..374ed12 100755
--- a/sbin/geom/class/tests/concat/conf.sh
+++ b/sbin/geom/class/tests/concat/conf.sh
@@ -1,8 +1,15 @@
#!/bin/sh
# $FreeBSD$
-name="test"
+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
OpenPOWER on IntegriCloud