summaryrefslogtreecommitdiffstats
path: root/tests/sys/geom/class/gate/1_test.sh
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-03-14 01:31:40 +0000
committerngie <ngie@FreeBSD.org>2016-03-14 01:31:40 +0000
commit081e0ebd819bccd974af605e5910f7e159e4f812 (patch)
treeb57156ea308b22b7d9ddbc7a989b406f61159d59 /tests/sys/geom/class/gate/1_test.sh
parent46bdbf008715de052640fcbe8d94db502adc45c9 (diff)
downloadFreeBSD-src-081e0ebd819bccd974af605e5910f7e159e4f812.zip
FreeBSD-src-081e0ebd819bccd974af605e5910f7e159e4f812.tar.gz
MFC r293821:
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 .
Diffstat (limited to 'tests/sys/geom/class/gate/1_test.sh')
-rw-r--r--tests/sys/geom/class/gate/1_test.sh62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/sys/geom/class/gate/1_test.sh b/tests/sys/geom/class/gate/1_test.sh
new file mode 100644
index 0000000..83f6096
--- /dev/null
+++ b/tests/sys/geom/class/gate/1_test.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# $FreeBSD$
+
+. `dirname $0`/conf.sh
+
+echo '1..2'
+
+base=`basename $0`
+us=0
+while [ -c /dev/ggate${us} ]; do
+ : $(( us += 1 ))
+done
+conf=`mktemp $base.XXXXXX` || exit 1
+pidfile=/var/run/ggated.pid
+port=33080
+
+work=$(attach_md -t malloc -s 1M)
+src=$(attach_md -t malloc -s 1M)
+
+test_cleanup()
+{
+ ggatec destroy -f -u $us
+ pkill -F $pidfile
+ geom_test_cleanup
+}
+trap test_cleanup ABRT EXIT INT TERM
+
+dd if=/dev/random of=/dev/$work bs=1m count=1 conv=sync
+dd if=/dev/random of=/dev/$src bs=1m count=1 conv=sync
+src_checksum=$(md5 -q /dev/$src)
+
+echo "127.0.0.1 RW /dev/$work" > $conf
+
+if ! ggated -p $port $conf; then
+ echo 'ggated failed to start'
+ echo 'Bail out!'
+ exit 1
+fi
+sleep 1
+if ! ggatec create -p $port -u $us 127.0.0.1 /dev/$work; then
+ echo 'ggatec create failed'
+ echo 'Bail out!'
+ exit 1
+fi
+
+dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1
+sleep 1
+
+work_checksum=$(md5 -q /dev/$work)
+if [ "$work_checksum" != "$src_checksum" ]; then
+ echo "not ok 1 - md5 checksums didn't match ($work_checksum != $src_checksum)"
+ echo "not ok 2 # SKIP"
+else
+ echo 'ok 1 - md5 checksum'
+
+ ggate_checksum=$(md5 -q /dev/ggate${us})
+ if [ "$ggate_checksum" != "$src_checksum" ]; then
+ echo "not ok 2 - md5 checksums didn't match ($ggate_checksum != $src_checksum)"
+ else
+ echo 'ok 2 - md5 checksum'
+ fi
+fi
OpenPOWER on IntegriCloud