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