xref: /freebsd/tests/sys/geom/class/raid3/3_test.sh (revision 55141f2c8991b2a6adbf30bb0fe3e6cbc303f06d)
1#!/bin/sh
2
3. `dirname $0`/conf.sh
4
5echo "1..1"
6
7ddbs=2048
8nblocks1=1024
9nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
10src=`mktemp $base.XXXXXX` || exit 1
11dst=`mktemp $base.XXXXXX` || exit 1
12
13us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
14us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
15us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
16
17dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
18
19graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
20devwait
21
22dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
23
24#
25# Reading without one DATA component (so with parity).
26#
27graid3 remove -n 1 $name
28dd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
29if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
30	echo "not ok 1"
31else
32	echo "ok 1"
33fi
34
35rm -f ${src} ${dst}
36