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