8 atf_test_case ggated cleanup
11 atf_set "descr" "ggated can proxy geoms"
12 atf_set "require.progs" "ggatec ggated"
13 atf_set "require.user" "root"
23 atf_check -e ignore -o ignore \
24 dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc
25 atf_check -e ignore -o ignore \
26 dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc
28 echo $CONF >> $PLAINFILES
29 echo "127.0.0.1 RW /dev/$work" > $CONF
31 atf_check ggated -p $PORT -F $PIDFILE $CONF
32 atf_check ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work
34 ggate_dev=/dev/ggate${us}
36 wait_for_ggate_device ${ggate_dev}
38 atf_check -e ignore -o ignore \
39 dd if=/dev/${src} of=${ggate_dev} bs=1m count=1 conv=notrunc
41 checksum /dev/$src /dev/$work
49 atf_test_case ggatel_file cleanup
52 atf_set "descr" "ggatel can proxy files"
53 atf_set "require.progs" "ggatel"
54 atf_set "require.user" "root"
62 echo src work >> ${PLAINFILES}
63 dd if=/dev/random of=work bs=1m count=1
64 dd if=/dev/random of=src bs=1m count=1
66 atf_check ggatel create -u $us work
68 ggate_dev=/dev/ggate${us}
70 wait_for_ggate_device ${ggate_dev}
72 atf_check -e ignore -o ignore \
73 dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc
83 atf_test_case ggatel_md cleanup
86 atf_set "descr" "ggatel can proxy files"
87 atf_set "require.progs" "ggatel"
88 atf_set "require.user" "root"
98 atf_check -e ignore -o ignore \
99 dd if=/dev/random of=$work bs=1m count=1 conv=notrunc
100 atf_check -e ignore -o ignore \
101 dd if=/dev/random of=$src bs=1m count=1 conv=notrunc
103 atf_check ggatel create -u $us /dev/$work
105 ggate_dev=/dev/ggate${us}
107 wait_for_ggate_device ${ggate_dev}
109 atf_check -e ignore -o ignore \
110 dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc
112 checksum /dev/$src /dev/$work
120 atf_init_test_cases()
122 atf_add_test_case ggated
123 atf_add_test_case ggatel_file
124 atf_add_test_case ggatel_md
132 while [ -c /dev/ggate${us} ]; do
135 echo ${us} > ggate.devs
143 md=$(mdconfig -a -t malloc -s 1M) || \
144 atf_fail "failed to allocate md device"
145 echo ${md} >> md.devs
155 src_checksum=$(dd if=${src} bs=1m | md5 -q)
156 work_checksum=$(dd if=${work} bs=1m | md5 -q)
158 if [ "$work_checksum" != "$src_checksum" ]; then
159 atf_fail "work md5 checksum didn't match"
162 ggate_checksum=$(dd if=/dev/ggate${us} bs=1m | md5 -q)
163 if [ "$ggate_checksum" != "$src_checksum" ]; then
164 atf_fail "ggate md5 checksum didn't match"
170 if [ -f "ggate.devs" ]; then
171 while read test_ggate; do
172 ggatec destroy -f -u $test_ggate >/dev/null
177 if [ -f "$PIDFILE" ]; then
182 if [ -f "PLAINFILES" ]; then
189 if [ -f "md.devs" ]; then
190 while read test_md; do
191 mdconfig -d -u $test_md 2>/dev/null
198 # Bug 204616: ggatel(8) creates /dev/ggate* asynchronously if `ggatel create`
199 # isn't called with `-v`.
200 wait_for_ggate_device()
204 while [ ! -c $ggate_device ]; do