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