diff --git a/tools/regression/geom_gate/Makefile b/tools/regression/geom_gate/Makefile new file mode 100644 index 000000000000..c5c24adaa4dc --- /dev/null +++ b/tools/regression/geom_gate/Makefile @@ -0,0 +1,8 @@ +# +# $FreeBSD$ +# +# Regression tests for geom_gate. +# + +test: + @sh runtests.sh diff --git a/tools/regression/geom_gate/runtests.sh b/tools/regression/geom_gate/runtests.sh new file mode 100644 index 000000000000..38089c5daedf --- /dev/null +++ b/tools/regression/geom_gate/runtests.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# $FreeBSD$ + +dir=`dirname $0` + +for ts in `dirname $0`/test-*.sh; do + sh $ts +done diff --git a/tools/regression/geom_gate/test-1.sh b/tools/regression/geom_gate/test-1.sh new file mode 100644 index 000000000000..44a49606ff4c --- /dev/null +++ b/tools/regression/geom_gate/test-1.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` +us=45 +work="/dev/md${us}" +src="/dev/md`expr $us + 1`" +conf=`mktemp /tmp/$base.XXXXXX` || exit 1 + +mdconfig -a -t malloc -s 1M -u $us || exit 1 +mdconfig -a -t malloc -s 1M -u `expr $us + 1` || exit 1 +dd if=/dev/random of=$work bs=1m count=1 >/dev/null 2>&1 +dd if=/dev/random of=$src bs=1m count=1 >/dev/null 2>&1 +sum=`cat $src | md5 -q` + +echo "127.0.0.1 RW $work" > $conf +ggated $conf +ggatec create -u $us 127.0.0.1 $work + +dd if=${src} of=/dev/ggate${us} bs=1m count=1 >/dev/null 2>&1 + +if [ `cat $work | md5 -q` != $sum ]; then + echo "FAIL" +else + if [ `cat /dev/ggate${us} | md5 -q` != $sum ]; then + echo "FAIL" + else + echo "PASS" + fi +fi + +ggatec destroy -u $us +mdconfig -d -u $us +mdconfig -d -u `expr $us + 1` +pkill ggated $conf +rm -f $conf diff --git a/tools/regression/geom_gate/test-2.sh b/tools/regression/geom_gate/test-2.sh new file mode 100644 index 000000000000..498ac45d005e --- /dev/null +++ b/tools/regression/geom_gate/test-2.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` +us=45 +work=`mktemp /tmp/$base.XXXXXX` || exit 1 +src=`mktemp /tmp/$base.XXXXXX` || exit 1 + +dd if=/dev/random of=$work bs=1m count=1 >/dev/null 2>&1 +dd if=/dev/random of=$src bs=1m count=1 >/dev/null 2>&1 +sum=`md5 -q $src` + +ggatel create -u $us $work + +dd if=${src} of=/dev/ggate${us} bs=1m count=1 >/dev/null 2>&1 + +if [ `md5 -q $work` != $sum ]; then + echo "FAIL" +else + if [ `cat /dev/ggate${us} | md5 -q` != $sum ]; then + echo "FAIL" + else + echo "PASS" + fi +fi + +ggatel destroy -u $us +rm -f $work $src diff --git a/tools/regression/geom_gate/test-3.sh b/tools/regression/geom_gate/test-3.sh new file mode 100644 index 000000000000..ca73a5a26ba0 --- /dev/null +++ b/tools/regression/geom_gate/test-3.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` +us=45 +work="/dev/md${us}" +src="/dev/md`expr $us + 1`" + +mdconfig -a -t malloc -s 1M -u $us || exit 1 +mdconfig -a -t malloc -s 1M -u `expr $us + 1` || exit 1 +dd if=/dev/random of=$work bs=1m count=1 >/dev/null 2>&1 +dd if=/dev/random of=$src bs=1m count=1 >/dev/null 2>&1 +sum=`cat $src | md5 -q` + +ggatel create -u $us $work + +dd if=${src} of=/dev/ggate${us} bs=1m count=1 >/dev/null 2>&1 + +if [ `cat $work | md5 -q` != $sum ]; then + echo "FAIL" +else + if [ `cat /dev/ggate${us} | md5 -q` != $sum ]; then + echo "FAIL" + else + echo "PASS" + fi +fi + +ggatel destroy -u $us +mdconfig -d -u $us +mdconfig -d -u `expr $us + 1`