9_test.sh revision 302408
178344Sobrien#!/bin/sh 278344Sobrien# $FreeBSD: stable/11/tests/sys/geom/class/raid3/9_test.sh 293821 2016-01-13 09:14:27Z ngie $ 398184Sgordon 478344Sobrien. `dirname $0`/conf.sh 578344Sobrien 678344Sobrienecho "1..1" 7223852Srmacklem 8180564Sdougbddbs=2048 978344Sobriennblocks1=1024 1078344Sobriennblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` 1178344Sobriensrc=`mktemp $base.XXXXXX` || exit 1 1278344Sobriendst=`mktemp $base.XXXXXX` || exit 1 13230099Sdougb 1499550Sgordonus0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 15168681Smtmus1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 1678344Sobrienus2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 1778344Sobrien 1878344Sobriendd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 1978344Sobrien 2078344Sobriengraid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 2178344Sobriendevwait 22231667Sdougb 23124627Smtm# 24124627Smtm# Writing without PARITY component and rebuild of PARITY component. 25124627Smtm# 26124628Smtmgraid3 remove -n 2 $name 27124627Smtmdd if=/dev/zero of=/dev/${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 28150294Srodrigcdd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 2998184Sgordongraid3 insert -n 2 $name md${us2} 30124628Smtmsleep 1 31124627Smtm# Remove DATA component, so PARITY component can be used while reading. 32150294Srodrigcgraid3 remove -n 1 $name 33124627Smtmdd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 34124628Smtm 35168410Spjddd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 36221046Srmacklemif [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then 37193354Srmacklem echo "not ok 1" 38221046Srmacklemelse 39221046Srmacklem echo "ok 1" 40193354Srmacklemfi 41193354Srmacklem 42168685Spjdrm -f ${src} ${dst} 43168410Spjd