xref: /freebsd/tests/sys/geom/class/mirror/2_test.sh (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1#!/bin/sh
2
3. `dirname $0`/conf.sh
4
5echo "1..4"
6
7balance="round-robin"
8ddbs=2048
9nblocks1=1024
10nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
11src=`mktemp $base.XXXXXX` || exit 1
12dst=`mktemp $base.XXXXXX` || exit 1
13
14dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
15
16attach_md us0 -t malloc -s `expr $nblocks1 + 1` || exit 1
17attach_md us1 -t malloc -s `expr $nblocks1 + 1` || exit 1
18attach_md us2 -t malloc -s `expr $nblocks1 + 1` || exit 1
19
20gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
21devwait
22
23dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
24
25dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
26if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
27	echo "not ok 1"
28else
29	echo "ok 1"
30fi
31dd if=/dev/${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
32if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
33	echo "not ok 2"
34else
35	echo "ok 2"
36fi
37dd if=/dev/${us1} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
38if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
39	echo "not ok 3"
40else
41	echo "ok 3"
42fi
43
44dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
45if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
46	echo "not ok 4"
47else
48	echo "ok 4"
49fi
50
51rm -f ${src} ${dst}
52