Date: Thu, 2 Feb 2017 03:54:43 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313081 - head/tests/sys/geom/class/gate Message-ID: <201702020354.v123shxF058071@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Feb 2 03:54:43 2017 New Revision: 313081 URL: https://svnweb.freebsd.org/changeset/base/313081 Log: 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 Modified: head/tests/sys/geom/class/gate/ggate_test.sh Modified: head/tests/sys/geom/class/gate/ggate_test.sh ============================================================================== --- head/tests/sys/geom/class/gate/ggate_test.sh Thu Feb 2 01:33:08 2017 (r313080) +++ head/tests/sys/geom/class/gate/ggate_test.sh Thu Feb 2 03:54:43 2017 (r313081) @@ -4,7 +4,6 @@ PIDFILE=ggated.pid PLAINFILES=plainfiles PORT=33080 CONF=gg.exports -RETRIES=16 atf_test_case ggated cleanup ggated_head() @@ -21,31 +20,23 @@ ggated_body() work=$(alloc_md) src=$(alloc_md) - dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc - dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc echo $CONF >> $PLAINFILES echo "127.0.0.1 RW /dev/$work" > $CONF atf_check ggated -p $PORT -F $PIDFILE $CONF - for try in `jot $RETRIES`; do - ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work && break - # wait for ggated to be ready - sleep 0.25 - done - if [ "$try" -eq "$RETRIES" ]; then - atf_fail "ggatec create failed" - fi + atf_check ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work - for try in `jot $RETRIES`; do - dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1 conv=notrunc\ - && break - # Wait for /dev/ggate${us} to be ready - sleep 0.25 - done - if [ "$try" -eq "$RETRIES" ]; then - atf_fail "dd failed; /dev/ggate${us} isn't working" - fi + ggate_dev=/dev/ggate${us} + + wait_for_ggate_device ${ggate_dev} + + atf_check -e ignore -o ignore \ + dd if=/dev/${src} of=${ggate_dev} bs=1m count=1 conv=notrunc checksum /dev/$src /dev/$work } @@ -78,7 +69,8 @@ ggatel_file_body() wait_for_ggate_device ${ggate_dev} - dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc checksum src work } @@ -103,8 +95,10 @@ ggatel_md_body() work=$(alloc_md) src=$(alloc_md) - dd if=/dev/random of=$work bs=1m count=1 conv=notrunc - dd if=/dev/random of=$src bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=$work bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=$src bs=1m count=1 conv=notrunc atf_check ggatel create -u $us /dev/$work @@ -112,7 +106,8 @@ ggatel_md_body() wait_for_ggate_device ${ggate_dev} - dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc checksum /dev/$src /dev/$work }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702020354.v123shxF058071>