diff options
Diffstat (limited to 'tests/sys/geom/class/gate')
-rw-r--r-- | tests/sys/geom/class/gate/1_test.sh | 62 | ||||
-rw-r--r-- | tests/sys/geom/class/gate/2_test.sh | 48 | ||||
-rw-r--r-- | tests/sys/geom/class/gate/3_test.sh | 48 | ||||
-rw-r--r-- | tests/sys/geom/class/gate/Makefile | 17 | ||||
-rwxr-xr-x | tests/sys/geom/class/gate/conf.sh | 10 |
5 files changed, 185 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 diff --git a/tests/sys/geom/class/gate/2_test.sh b/tests/sys/geom/class/gate/2_test.sh new file mode 100644 index 0000000..be89acc --- /dev/null +++ b/tests/sys/geom/class/gate/2_test.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# $FreeBSD$ + +. `dirname $0`/conf.sh + +base=`basename $0` +us=46 +work=`mktemp -u $base.XXXXXX` || exit 1 +src=`mktemp -u $base.XXXXXX` || exit 1 + +test_cleanup() +{ + ggatel destroy -f -u $us + rm -f $work $src + + geom_test_cleanup +} +trap test_cleanup ABRT EXIT INT TERM + +dd if=/dev/random of=$work bs=1m count=1 conv=sync +dd if=/dev/random of=$src bs=1m count=1 conv=sync + +if ! ggatel create -u $us $work; then + echo 'ggatel create failed' + echo 'Bail out!' + exit 1 +fi + +dd if=${src} of=/dev/ggate${us} bs=1m count=1 +sleep 1 + +echo '1..2' + +src_checksum=$(md5 -q $src) +work_checksum=$(md5 -q $work) +if [ "$work_checksum" != "$src_checksum" ]; then + echo "not ok 1 - md5 checksums didn't match ($work_checksum != $src_checksum) # TODO: bug 204616" + 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 diff --git a/tests/sys/geom/class/gate/3_test.sh b/tests/sys/geom/class/gate/3_test.sh new file mode 100644 index 0000000..8901aca --- /dev/null +++ b/tests/sys/geom/class/gate/3_test.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# $FreeBSD$ + +. `dirname $0`/conf.sh + +base=`basename $0` +us=47 + +test_cleanup() +{ + ggatel destroy -f -u $us + + geom_test_cleanup +} +trap test_cleanup ABRT EXIT INT TERM + +work=$(attach_md -t malloc -s 1M) +src=$(attach_md -t malloc -s 1M) + +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) + +if ! ggatel create -u $us /dev/$work; then + echo 'ggatel create failed' + echo 'Bail out!' + exit 1 +fi + +dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1 conv=sync +sleep 1 + +echo '1..2' + +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 diff --git a/tests/sys/geom/class/gate/Makefile b/tests/sys/geom/class/gate/Makefile new file mode 100644 index 0000000..11ceb94 --- /dev/null +++ b/tests/sys/geom/class/gate/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test +TAP_TESTS_SH+= 3_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/gate/conf.sh b/tests/sys/geom/class/gate/conf.sh new file mode 100755 index 0000000..4eede08 --- /dev/null +++ b/tests/sys/geom/class/gate/conf.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +name="$(mktemp -u gate.XXXXXX)" +class="gate" +base=`basename $0` + +kldstat -q -m g_${class} || kldload geom_${class} || exit 1 + +. `dirname $0`/../geom_subr.sh |