summaryrefslogtreecommitdiffstats
path: root/tests/sys/geom/class/gate/1_test.sh
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2017-02-15 00:16:52 +0000
committerasomers <asomers@FreeBSD.org>2017-02-15 00:16:52 +0000
commit50ab11fce02e8a54c23784af5e534a8084b374d6 (patch)
tree1d8bd3880d4700c706eb2e6e2536c1a054714030 /tests/sys/geom/class/gate/1_test.sh
parentfafa7b31df860d1913826def1e1342e032042399 (diff)
downloadFreeBSD-src-50ab11fce02e8a54c23784af5e534a8084b374d6.zip
FreeBSD-src-50ab11fce02e8a54c23784af5e534a8084b374d6.tar.gz
MFC r311893, r313008, r313081
I had to modify the tests slightly for the MFC to stable/10, because stable/10 lacks r294037, which enabled /sbin/md5 to work on md(4) devices. r311893: ATFify the geom gate tests. This ensures their cleanup routines will be run even if they should timeout. tests/sys/geom/class/gate/ggate_test.sh tests/sys/geom/class/gate/Makefile Add an ATF test with three testcases, one for each TAP test. Use ATF-style cleanup functions, and convert sleeps to polling loops. ObsoleteFiles.inc tests/sys/geom/class/gate/conf.sh tests/sys/geom/class/gate/1_test.sh tests/sys/geom/class/gate/2_test.sh tests/sys/geom/class/gate/3_test.sh Delete TAP test files Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8891 r313008: Wait for /dev/ggate* to appear after calling `ggatel create` in :ggatel_{file,md} The test assumed that `ggatel create` created a device on completion, but that's incorrect. This squashes the race by waiting for the device to appear, as `ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called with `-v`. Discussed with: asomers MFC after: 1 week PR: 204616 Sponsored by: Dell EMC Isilon r313081: Replace for/retry loops with "wait_for_ggate_device" calls and check results of commands As noted in r313008, the underlying issue was that geom_gate device creation wasn't created at ggatel command completion, but some short time after. ggatec(8) employs similar logic when creating geom_gate(4) devices. Switch from retry loops (after the ggatec/dd write calls) to wait_for_ggate_device function calls after calling ggatec(8) instead to detect the presence of the /dev/ggate* device, as this function is sufficient for determining whether or not the character device is ready for testing While here, use atf_check consistently with all dd calls to ensure that data output is as expected. MFC after: 1 week Reviewed by: asomers Differential Revision: D9409 Sponsored by: Dell EMC Isilon
Diffstat (limited to 'tests/sys/geom/class/gate/1_test.sh')
-rw-r--r--tests/sys/geom/class/gate/1_test.sh63
1 files changed, 0 insertions, 63 deletions
diff --git a/tests/sys/geom/class/gate/1_test.sh b/tests/sys/geom/class/gate/1_test.sh
deleted file mode 100644
index ba573bb..0000000
--- a/tests/sys/geom/class/gate/1_test.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# $FreeBSD$
-
-. `dirname $0`/conf.sh
-
-echo '1..2'
-
-base=`basename $0`
-us=0
-while [ -c /dev/ggate${us} ]; do
- : $(( us += 1 ))
-done
-pidfile=ggated.$$.pid
-conf=`mktemp $base.XXXXXX` || exit 1
-port=33080
-
-work=$(attach_md -t malloc -s 1M)
-src=$(attach_md -t malloc -s 1M)
-
-test_cleanup()
-{
- ggatec destroy -f -u $us
- pkill -F $pidfile
- geom_test_cleanup
-}
-trap test_cleanup ABRT EXIT INT TERM
-
-dd if=/dev/random of=/dev/$work bs=1m count=1 conv=sync
-dd if=/dev/random of=/dev/$src bs=1m count=1 conv=sync
-src_checksum=$(md5 -q /dev/$src)
-
-echo "127.0.0.1 RW /dev/$work" > $conf
-
-if ! ggated -p $port -F $pidfile $conf; then
- echo 'ggated failed to start'
- echo 'Bail out!'
- exit 1
-fi
-sleep 1
-if ! ggatec create -p $port -u $us 127.0.0.1 /dev/$work; then
- echo 'ggatec create failed'
- echo 'Bail out!'
- exit 1
-fi
-sleep 1
-
-dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1
-sleep 1
-
-work_checksum=$(md5 -q /dev/$work)
-if [ "$work_checksum" != "$src_checksum" ]; then
- echo "not ok 1 - md5 checksums didn't match ($work_checksum != $src_checksum)"
- echo "not ok 2 # SKIP"
-else
- echo 'ok 1 - md5 checksum'
-
- ggate_checksum=$(md5 -q /dev/ggate${us})
- if [ "$ggate_checksum" != "$src_checksum" ]; then
- echo "not ok 2 - md5 checksums didn't match ($ggate_checksum != $src_checksum)"
- else
- echo 'ok 2 - md5 checksum'
- fi
-fi
OpenPOWER on IntegriCloud