xref: /freebsd/tests/sys/geom/class/shsec/2_test.sh (revision 2f9966ff63d65bd474478888c9088eeae3f9c669)
1#!/bin/sh
2
3. `dirname $0`/conf.sh
4
5echo "1..4"
6
7nblocks1=1024
8nblocks2=`expr $nblocks1 + 1`
9src=`mktemp $base.XXXXXX` || exit 1
10dst=`mktemp $base.XXXXXX` || exit 1
11
12dd if=/dev/random of=${src} count=$nblocks1 >/dev/null 2>&1
13
14attach_md us0 -t malloc -s $nblocks2 || exit 1
15attach_md us1 -t malloc -s $nblocks2 || exit 1
16attach_md us2 -t malloc -s $nblocks2 || exit 1
17
18gshsec label $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
19devwait
20
21dd if=${src} of=/dev/shsec/${name} count=$nblocks1 >/dev/null 2>&1
22
23dd if=/dev/shsec/${name} of=${dst} count=$nblocks1 >/dev/null 2>&1
24if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
25	echo "not ok 1"
26else
27	echo "ok 1"
28fi
29
30dd if=/dev/${us0} of=${dst} count=$nblocks1 >/dev/null 2>&1
31if [ `md5 -q ${src}` = `md5 -q ${dst}` ]; then
32	echo "not ok 2"
33else
34	echo "ok 2"
35fi
36
37dd if=/dev/${us1} of=${dst} count=$nblocks1 >/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} count=$nblocks1 >/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