diff options
author | pjd <pjd@FreeBSD.org> | 2004-03-03 21:52:49 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-03-03 21:52:49 +0000 |
commit | 2e05d44e283e1996b30f8cc74b989e3ac4d1482d (patch) | |
tree | 8228bebe5456eb8e628cba5301886b94f88ced2e /tools | |
parent | eda438f852318d7296faead06263e5465c154154 (diff) | |
download | FreeBSD-src-2e05d44e283e1996b30f8cc74b989e3ac4d1482d.zip FreeBSD-src-2e05d44e283e1996b30f8cc74b989e3ac4d1482d.tar.gz |
Add regression tests for geom_concat class.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/geom_concat/Makefile | 8 | ||||
-rw-r--r-- | tools/regression/geom_concat/runtests.sh | 8 | ||||
-rw-r--r-- | tools/regression/geom_concat/test-1.sh | 27 | ||||
-rw-r--r-- | tools/regression/geom_concat/test-2.sh | 32 |
4 files changed, 75 insertions, 0 deletions
diff --git a/tools/regression/geom_concat/Makefile b/tools/regression/geom_concat/Makefile new file mode 100644 index 0000000..5df6a3b --- /dev/null +++ b/tools/regression/geom_concat/Makefile @@ -0,0 +1,8 @@ +# +# $FreeBSD$ +# +# Regression test for geom_concat. +# + +test: + @sh runtests.sh diff --git a/tools/regression/geom_concat/runtests.sh b/tools/regression/geom_concat/runtests.sh new file mode 100644 index 0000000..38089c5 --- /dev/null +++ b/tools/regression/geom_concat/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_concat/test-1.sh b/tools/regression/geom_concat/test-1.sh new file mode 100644 index 0000000..356d5c0 --- /dev/null +++ b/tools/regression/geom_concat/test-1.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# $FreeBSD$ + +name="test" +base=`basename $0` +us=45 + +mdconfig -a -t malloc -s 1M -u $us || exit 1 +mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1 +mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1 + +gconcat create $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1 + +# Size of created device should be 1MB + 2MB + 3MB. + +size=`diskinfo /dev/${name}.concat | awk '{print $3}'` + +if [ $size -eq 6291456 ]; then + echo "PASS" +else + echo "FAIL" +fi + +gconcat destroy $name +mdconfig -d -u $us +mdconfig -d -u `expr $us + 1` +mdconfig -d -u `expr $us + 2` diff --git a/tools/regression/geom_concat/test-2.sh b/tools/regression/geom_concat/test-2.sh new file mode 100644 index 0000000..5a4e33b --- /dev/null +++ b/tools/regression/geom_concat/test-2.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# $FreeBSD$ + +name="test" +base=`basename $0` +us=45 +tsize=6 +src=`mktemp /tmp/$base.XXXXXX` || exit 1 +dst=`mktemp /tmp/$base.XXXXXX` || exit 1 + +dd if=/dev/random of=${src} bs=1m count=$tsize >/dev/null 2>&1 + +mdconfig -a -t malloc -s 1M -u $us || exit 1 +mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1 +mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1 + +gconcat create $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1 + +dd if=${src} of=/dev/${name}.concat bs=1m count=$tsize >/dev/null 2>&1 +dd if=/dev/${name}.concat of=${dst} bs=1m count=$tsize >/dev/null 2>&1 + +if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then + echo "FAIL" +else + echo "PASS" +fi + +gconcat destroy $name +mdconfig -d -u $us +mdconfig -d -u `expr $us + 1` +mdconfig -d -u `expr $us + 2` +rm -f ${src} ${dst} |