]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - tools/regression/geom_gate/test-3.t
MFC r293621,r293622,r293815:
[FreeBSD/stable/10.git] / tools / regression / geom_gate / test-3.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 . `dirname $0`/conf.sh
5
6 base=`basename $0`
7 us=47
8
9 test_cleanup()
10 {
11         ggatel destroy -f -u $us
12
13         geom_test_cleanup
14 }
15 trap test_cleanup ABRT EXIT INT TERM
16
17 work=$(attach_md -t malloc -s 1M)
18 src=$(attach_md -t malloc -s 1M)
19
20 dd if=/dev/random of=/dev/$work bs=1m count=1 conv=sync
21 dd if=/dev/random of=/dev/$src bs=1m count=1 conv=sync
22 src_checksum=$(md5 -q /dev/$src)
23
24 if ! ggatel create -u $us /dev/$work; then
25         echo 'ggatel create failed'
26         echo 'Bail out!'
27         exit 1
28 fi
29
30 dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1 conv=sync
31 sleep 1
32
33 echo '1..2'
34
35 work_checksum=$(md5 -q /dev/$work)
36 if [ "$work_checksum" != "$src_checksum" ]; then
37         echo "not ok 1 - md5 checksums didn't match ($work_checksum != $src_checksum)"
38         echo 'not ok 2 # SKIP'
39 else
40         echo 'ok 1 - md5 checksum'
41
42         ggate_checksum=$(md5 -q /dev/ggate${us})
43         if [ "$ggate_checksum" != "$src_checksum" ]; then
44                 echo "not ok 2 - md5 checksums didn't match ($ggate_checksum != $src_checksum)"
45         else
46                 echo 'ok 2 - md5 checksum'
47         fi
48 fi