9_test.sh revision 153187
1#!/bin/sh 2# $FreeBSD: head/tools/regression/geom_raid3/test-9.t 153187 2005-12-07 01:28:59Z pjd $ 3 4. `dirname $0`/conf.sh 5 6echo "1..1" 7 8us0=45 9us1=`expr $us0 + 1` 10us2=`expr $us0 + 2` 11ddbs=2048 12nblocks1=1024 13nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` 14src=`mktemp /tmp/$base.XXXXXX` || exit 1 15dst=`mktemp /tmp/$base.XXXXXX` || exit 1 16 17dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 18 19mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1 20mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1 21mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1 22 23graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1 24devwait 25 26# 27# Writing without PARITY component and rebuild of PARITY component. 28# 29graid3 remove -n 2 $name 30dd if=/dev/zero of=/dev/md${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 31dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 32graid3 insert -n 2 $name md${us2} 33sleep 1 34# Remove DATA component, so PARITY component can be used while reading. 35graid3 remove -n 1 $name 36dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 37 38dd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 39if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then 40 echo "not ok 1" 41else 42 echo "ok 1" 43fi 44 45graid3 stop $name 46mdconfig -d -u $us0 47mdconfig -d -u $us1 48mdconfig -d -u $us2 49rm -f ${src} ${dst} 50