summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-04 20:31:09 +0000
committerdim <dim@FreeBSD.org>2016-01-04 20:31:09 +0000
commitdb873d7452584205dd063528dc8addbf28aa396b (patch)
treece0c2f03d6f3cd7ad2ea424abe13bf26cdcccf3d /tools
parent639d21dadc7392ad8dcdda30c92723510898f3c1 (diff)
parent3f499d5271ef24e15d5320d7f55b05e28d629662 (diff)
downloadFreeBSD-src-db873d7452584205dd063528dc8addbf28aa396b.zip
FreeBSD-src-db873d7452584205dd063528dc8addbf28aa396b.tar.gz
Merge ^/head r293036 through r293174.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/geom_mirror/conf.sh7
-rw-r--r--tools/regression/geom_mirror/test-1.t19
-rw-r--r--tools/regression/geom_mirror/test-2.t25
-rw-r--r--tools/regression/geom_mirror/test-3.t24
-rw-r--r--tools/regression/geom_mirror/test-4.t26
-rw-r--r--tools/regression/geom_mirror/test-5.t24
-rw-r--r--tools/regression/geom_mirror/test-6.t25
-rw-r--r--tools/regression/geom_mirror/test-7.t24
-rw-r--r--tools/regression/geom_subr.sh3
9 files changed, 69 insertions, 108 deletions
diff --git a/tools/regression/geom_mirror/conf.sh b/tools/regression/geom_mirror/conf.sh
index 5e7e15a..d8595f1 100644
--- a/tools/regression/geom_mirror/conf.sh
+++ b/tools/regression/geom_mirror/conf.sh
@@ -5,4 +5,11 @@ name="$(mktemp -u mirror.XXXXXX)"
class="mirror"
base=`basename $0`
+gmirror_test_cleanup()
+{
+ [ -c /dev/$class/$name ] && gmirror destroy $name
+ geom_test_cleanup
+}
+trap gmirror_test_cleanup ABRT EXIT INT TERM
+
. `dirname $0`/../geom_subr.sh
diff --git a/tools/regression/geom_mirror/test-1.t b/tools/regression/geom_mirror/test-1.t
index b07a8d1..af82a14 100644
--- a/tools/regression/geom_mirror/test-1.t
+++ b/tools/regression/geom_mirror/test-1.t
@@ -5,15 +5,11 @@
echo "1..1"
-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
-
-gmirror label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
devwait
# Size of created device should be 1MB - 512b.
@@ -25,10 +21,3 @@ if [ $size -eq 1048064 ]; then
else
echo "not ok 1"
fi
-
-gmirror remove $name md${us0}
-gmirror remove $name md${us1}
-gmirror remove $name md${us2}
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
diff --git a/tools/regression/geom_mirror/test-2.t b/tools/regression/geom_mirror/test-2.t
index 3fb0822..5605c44 100644
--- a/tools/regression/geom_mirror/test-2.t
+++ b/tools/regression/geom_mirror/test-2.t
@@ -6,22 +6,19 @@
echo "1..4"
balance="round-robin"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-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=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -32,28 +29,24 @@ if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
else
echo "ok 1"
fi
-dd if=/dev/md${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us0} of=${dst} bs=$ddbs count=$nblocks2 >/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} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us1} of=${dst} bs=$ddbs count=$nblocks2 >/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} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
else
echo "ok 4"
fi
-gmirror remove $name md${us0} md${us1} md${us2}
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-3.t b/tools/regression/geom_mirror/test-3.t
index 5bdd2ab..b7f8525 100644
--- a/tools/regression/geom_mirror/test-3.t
+++ b/tools/regression/geom_mirror/test-3.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="round-robin"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-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=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -64,7 +61,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-4.t b/tools/regression/geom_mirror/test-4.t
index 0786bdb..6efcc02 100644
--- a/tools/regression/geom_mirror/test-4.t
+++ b/tools/regression/geom_mirror/test-4.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="load"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-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=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -57,6 +54,8 @@ else
echo "ok 4"
fi
+gmirror destroy $name
+
# mirror/${name} should be removed.
if [ -c /dev/${name} ]; then
echo "not ok 5"
@@ -64,7 +63,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-5.t b/tools/regression/geom_mirror/test-5.t
index 5b0a5ed..3a176b5 100644
--- a/tools/regression/geom_mirror/test-5.t
+++ b/tools/regression/geom_mirror/test-5.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="split"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=8192
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-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=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -64,7 +61,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-6.t b/tools/regression/geom_mirror/test-6.t
index ec86d06..68036e9 100644
--- a/tools/regression/geom_mirror/test-6.t
+++ b/tools/regression/geom_mirror/test-6.t
@@ -6,26 +6,23 @@
echo "1..2"
balance="split"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=8192
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-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=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} || exit 1
+gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/${us0} /dev/${us1} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-dd if=/dev/zero of=/dev/md${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/zero of=/dev/${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
@@ -35,18 +32,14 @@ else
fi
# Connect disk to the mirror.
-gmirror insert ${name} md${us2}
+gmirror insert ${name} ${us2}
# Wait for synchronization.
sleep 1
-dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
else
echo "ok 2"
fi
-gmirror remove $name md${us0} md${us1} md${us2}
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-7.t b/tools/regression/geom_mirror/test-7.t
index c911c03..f5bf71a 100644
--- a/tools/regression/geom_mirror/test-7.t
+++ b/tools/regression/geom_mirror/test-7.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="prefer"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-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=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -64,7 +61,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_subr.sh b/tools/regression/geom_subr.sh
index 0ffb8c8..58dc31d 100644
--- a/tools/regression/geom_subr.sh
+++ b/tools/regression/geom_subr.sh
@@ -23,7 +23,7 @@ devwait()
# a large number of md(4) devices lingering around
: ${TMPDIR=/tmp}
export TMPDIR
-TEST_MDS_FILE=${TMPDIR}/test_mds
+TEST_MDS_FILE=$(mktemp ${TMPDIR}/test_mds.XXXXXX) || exit 1
attach_md()
{
@@ -45,4 +45,5 @@ geom_test_cleanup()
mdconfig -d -u $test_md
done < $TEST_MDS_FILE
fi
+ rm -f $TEST_MDS_FILE
}
OpenPOWER on IntegriCloud