]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - tools/regression/geom_raid3/test-12.t
MFC r293438:
[FreeBSD/stable/10.git] / tools / regression / geom_raid3 / test-12.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 . `dirname $0`/conf.sh
5
6 echo "1..1"
7
8 nblocks1=9
9 nblocks2=`expr $nblocks1 - 1`
10 nblocks3=`expr $nblocks2 / 2`
11
12 us0=$(attach_md -t malloc -s $nblocks1) || exit 1
13 us1=$(attach_md -t malloc -s $nblocks1) || exit 1
14 us2=$(attach_md -t malloc -s $nblocks1) || exit 1
15
16 dd if=/dev/random of=/dev/${us0} count=$nblocks1 >/dev/null 2>&1
17 dd if=/dev/random of=/dev/${us1} count=$nblocks1 >/dev/null 2>&1
18 dd if=/dev/random of=/dev/${us2} count=$nblocks1 >/dev/null 2>&1
19
20 graid3 label -w $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
21 devwait
22 # Wait for synchronization.
23 sleep 2
24 graid3 stop $name
25 # Break one component.
26 dd if=/dev/random of=/dev/${us1} count=$nblocks2 >/dev/null 2>&1
27 # Provoke retaste of the rest components.
28 true > /dev/${us0}
29 true > /dev/${us2}
30 sleep 1
31
32 dd if=/dev/raid3/${name} of=/dev/null bs=1k count=$nblocks3 >/dev/null 2>&1
33 ec=$?
34 if [ $ec -eq 0 ]; then
35         echo "not ok 1"
36 else
37         echo "ok 1"
38 fi