xref: /freebsd/tests/sys/geom/class/raid3/12_test.sh (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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
11us0=$(attach_md -t malloc -s $nblocks1) || exit 1
12us1=$(attach_md -t malloc -s $nblocks1) || exit 1
13us2=$(attach_md -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