6_test.sh revision 293438
168651Skris#!/bin/sh 268651Skris# $FreeBSD: head/tools/regression/geom_raid3/test-6.t 293438 2016-01-08 19:47:49Z ngie $ 368651Skris 468651Skris. `dirname $0`/conf.sh 568651Skris 668651Skrisecho "1..1" 768651Skris 868651Skrisddbs=2048 968651Skrisnblocks1=1024 1068651Skrisnblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` 1168651Skrissrc=`mktemp $base.XXXXXX` || exit 1 1268651Skrisdst=`mktemp $base.XXXXXX` || exit 1 1368651Skris 1468651Skrisus0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 1568651Skrisus1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 1668651Skrisus2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 1768651Skris 1868651Skrisdd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 1968651Skris 2076866Skrisgraid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 2176866Skrisdevwait 2268651Skris 2368651Skrisdd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 2468651Skris 2568651Skris# 2668651Skris# Rebuild of DATA component. 2768651Skris# 2868651Skrisgraid3 remove -n 1 $name 2968651Skrisdd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 3068651Skrisgraid3 insert -n 1 $name md${us1} 3168651Skrissleep 1 3268651Skris 3368651Skrisdd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 3476866Skrisif [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then 3576866Skris echo "not ok 1" 3676866Skriselse 3768651Skris echo "ok 1" 3868651Skrisfi 3968651Skris 4068651Skrisrm -f ${src} ${dst} 4168651Skris