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"
25 atf_check -e ignore -o ignore \
26 dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc
27 atf_check -e ignore -o ignore \
28 dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc
30 echo $CONF >> $PLAINFILES
31 echo "127.0.0.1 RW /dev/$work" > $CONF
33 atf_check ggated -p $PORT -F $PIDFILE $CONF
34 atf_check ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work
36 ggate_dev=/dev/ggate${us}
38 wait_for_ggate_device ${ggate_dev}
40 atf_check -e ignore -o ignore \
41 dd if=/dev/${src} of=${ggate_dev} bs=1m count=1 conv=notrunc
43 checksum /dev/$src /dev/$work
51 atf_test_case ggatel_file cleanup
54 atf_set "descr" "ggatel can proxy files"
55 atf_set "require.progs" "ggatel"
56 atf_set "require.user" "root"
66 echo src work >> ${PLAINFILES}
67 dd if=/dev/random of=work bs=1m count=1
68 dd if=/dev/random of=src bs=1m count=1
70 atf_check ggatel create -u $us work
72 ggate_dev=/dev/ggate${us}
74 wait_for_ggate_device ${ggate_dev}
76 atf_check -e ignore -o ignore \
77 dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc
87 atf_test_case ggatel_md cleanup
90 atf_set "descr" "ggatel can proxy files"
91 atf_set "require.progs" "ggatel"
92 atf_set "require.user" "root"
100 us=$(alloc_ggate_dev)
104 atf_check -e ignore -o ignore \
105 dd if=/dev/random of=$work bs=1m count=1 conv=notrunc
106 atf_check -e ignore -o ignore \
107 dd if=/dev/random of=$src bs=1m count=1 conv=notrunc
109 atf_check ggatel create -u $us /dev/$work
111 ggate_dev=/dev/ggate${us}
113 wait_for_ggate_device ${ggate_dev}
115 atf_check -e ignore -o ignore \
116 dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc
118 checksum /dev/$src /dev/$work
126 atf_init_test_cases()
128 atf_add_test_case ggated
129 atf_add_test_case ggatel_file
130 atf_add_test_case ggatel_md
138 while [ -c /dev/ggate${us} ]; do
141 echo ${us} > ggate.devs
149 md=$(mdconfig -a -t malloc -s 1M) || \
150 atf_fail "failed to allocate md device"
151 echo ${md} >> md.devs
161 src_checksum=$(md5 -q $src)
162 work_checksum=$(md5 -q $work)
164 if [ "$work_checksum" != "$src_checksum" ]; then
165 atf_fail "work md5 checksum didn't match"
168 ggate_checksum=$(md5 -q /dev/ggate${us})
169 if [ "$ggate_checksum" != "$src_checksum" ]; then
170 atf_fail "ggate md5 checksum didn't match"
176 if [ -f "ggate.devs" ]; then
177 while read test_ggate; do
178 ggatec destroy -f -u $test_ggate >/dev/null
183 if [ -f "$PIDFILE" ]; then
188 if [ -f "PLAINFILES" ]; then
195 if [ -f "md.devs" ]; then
196 while read test_md; do
197 mdconfig -d -u $test_md 2>/dev/null
208 # If the geom class isn't already loaded, try loading it.
209 if ! kldstat -q -m g_${class}; then
210 if ! geom ${class} load; then
211 atf_skip "could not load module for geom class=${class}"
217 # Bug 204616: ggatel(8) creates /dev/ggate* asynchronously if `ggatel create`
218 # isn't called with `-v`.
219 wait_for_ggate_device()
223 while [ ! -c $ggate_device ]; do