From owner-svn-src-all@freebsd.org Thu Feb 2 03:54:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0113ACCBFEF; Thu, 2 Feb 2017 03:54:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFD3486A; Thu, 2 Feb 2017 03:54:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v123shpb058072; Thu, 2 Feb 2017 03:54:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v123shxF058071; Thu, 2 Feb 2017 03:54:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702020354.v123shxF058071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 2 Feb 2017 03:54:43 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2017 03:54:45 -0000 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 }