freebsd-skq/tools/regression/geom_concat/test-2.sh
2004-03-03 21:52:49 +00:00

33 lines
809 B
Bash

#!/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}