summaryrefslogtreecommitdiffstats
path: root/tests/sys/geom/class/shsec
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-01-13 09:14:27 +0000
committerngie <ngie@FreeBSD.org>2016-01-13 09:14:27 +0000
commit68e22a452aec426140d0683d3512db10fb3037c6 (patch)
tree3cade8aa99ab58bdd2f67e2fd18a51c8ca6330dd /tests/sys/geom/class/shsec
parent67b9a0f51a41ff097d0e11f863011216f0db4396 (diff)
parent662bdc54fa28b9d6b5fc712eff1863cb790dc2d7 (diff)
downloadFreeBSD-src-68e22a452aec426140d0683d3512db10fb3037c6.zip
FreeBSD-src-68e22a452aec426140d0683d3512db10fb3037c6.tar.gz
Integrate
tools/regression/geom_{concat,eli,gate,mirror,nop,raid3,shsec,stripe,uzip} in to the FreeBSD test suite as tests/sys/geom/class/{concat,eli,gate,mirror,nop,raid3,shsec,stripe,uzip} The tools/regression/geom and tools/regression/geom_part testcases are being left alone because both test sets are both currently broken. The majority of this work was done on ^/user/ngie/more-tests2 . The differences are as follows: - tests/sys/geom/class/Makefile.inc is not present; it was inlined into the class's Makefiles for explicitness. - The testcases officially require root via kyua - The geom_gate(4) tests don't use the pidfile changes proposed in https://reviews.freebsd.org/D4836 . MFC after: 1 month Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tests/sys/geom/class/shsec')
-rw-r--r--tests/sys/geom/class/shsec/1_test.sh28
-rw-r--r--tests/sys/geom/class/shsec/2_test.sh52
-rw-r--r--tests/sys/geom/class/shsec/Makefile16
-rw-r--r--tests/sys/geom/class/shsec/conf.sh15
4 files changed, 111 insertions, 0 deletions
diff --git a/tests/sys/geom/class/shsec/1_test.sh b/tests/sys/geom/class/shsec/1_test.sh
new file mode 100644
index 0000000..ab0bb37
--- /dev/null
+++ b/tests/sys/geom/class/shsec/1_test.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# $FreeBSD$
+
+. `dirname $0`/conf.sh
+
+echo "1..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
+
+gshsec label $name /dev/${us0} /dev/${us1} /dev/${us2} 2>/dev/null || exit 1
+devwait
+
+# Size of created device should be 1MB - 512B.
+
+mediasize=`diskinfo /dev/shsec/${name} | awk '{print $3}'`
+if [ $mediasize -eq 1048064 ]; then
+ echo "ok 1"
+else
+ echo "not ok 1"
+fi
+sectorsize=`diskinfo /dev/shsec/${name} | awk '{print $2}'`
+if [ $sectorsize -eq 512 ]; then
+ echo "ok 2"
+else
+ echo "not ok 2"
+fi
diff --git a/tests/sys/geom/class/shsec/2_test.sh b/tests/sys/geom/class/shsec/2_test.sh
new file mode 100644
index 0000000..9dfe36a
--- /dev/null
+++ b/tests/sys/geom/class/shsec/2_test.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# $FreeBSD$
+
+. `dirname $0`/conf.sh
+
+echo "1..4"
+
+nblocks1=1024
+nblocks2=`expr $nblocks1 + 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
+
+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/$us0 /dev/$us1 /dev/$us2 || exit 1
+devwait
+
+dd if=${src} of=/dev/shsec/${name} count=$nblocks1 >/dev/null 2>&1
+
+dd if=/dev/shsec/${name} of=${dst} count=$nblocks1 >/dev/null 2>&1
+if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
+ echo "not ok 1"
+else
+ echo "ok 1"
+fi
+
+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/${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/${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
+
+rm -f ${src} ${dst}
diff --git a/tests/sys/geom/class/shsec/Makefile b/tests/sys/geom/class/shsec/Makefile
new file mode 100644
index 0000000..5659b5d
--- /dev/null
+++ b/tests/sys/geom/class/shsec/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
+
+TAP_TESTS_SH+= 1_test
+TAP_TESTS_SH+= 2_test
+
+FILES+= conf.sh
+FILESNAME_conf.sh= conf.sh
+FILESDIR= ${TESTSDIR}
+
+.for t in ${TAP_TESTS_SH}
+TEST_METADATA.$t+= required_user="root"
+.endfor
+
+.include <bsd.test.mk>
diff --git a/tests/sys/geom/class/shsec/conf.sh b/tests/sys/geom/class/shsec/conf.sh
new file mode 100644
index 0000000..7800eb7
--- /dev/null
+++ b/tests/sys/geom/class/shsec/conf.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# $FreeBSD$
+
+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
OpenPOWER on IntegriCloud