From owner-svn-src-stable@freebsd.org Tue Apr 18 16:17:39 2017 Return-Path: Delivered-To: svn-src-stable@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 50397D43340; Tue, 18 Apr 2017 16:17:39 +0000 (UTC) (envelope-from asomers@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 1FD83238; Tue, 18 Apr 2017 16:17:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3IGHcHA078812; Tue, 18 Apr 2017 16:17:38 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3IGHcpl078811; Tue, 18 Apr 2017 16:17:38 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704181617.v3IGHcpl078811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 18 Apr 2017 16:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317093 - stable/10/tests/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Apr 2017 16:17:39 -0000 Author: asomers Date: Tue Apr 18 16:17:38 2017 New Revision: 317093 URL: https://svnweb.freebsd.org/changeset/base/317093 Log: MFC r285117 Make cleanup routines idempotent cleanup routines can be executed at any point during the execution of the body, including even before the body has done any real work. In those cases, cleanup routines should be careful to not raise spurious errors so as to not "override" the actual result of the test case. This is just general good coding style but is not a problem in practice for these specific tests. (The way I discovered the issue, though, was due to a regression I introduced in Kyua itself while refactoring some internals.) MFC after: 1 week Modified: stable/10/tests/sys/netinet/fibs_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/netinet/fibs_test.sh ============================================================================== --- stable/10/tests/sys/netinet/fibs_test.sh Tue Apr 18 15:43:47 2017 (r317092) +++ stable/10/tests/sys/netinet/fibs_test.sh Tue Apr 18 16:17:38 2017 (r317093) @@ -98,9 +98,12 @@ arpresolve_checks_interface_fib_body() } arpresolve_checks_interface_fib_cleanup() { - for PID in `cat "processes_to_kill"`; do - kill $PID - done + if [ -f processes_to_kill ]; then + for pid in $(cat processes_to_kill); do + kill "${pid}" + done + rm -f processes_to_kill + fi cleanup_tap } @@ -477,8 +480,10 @@ setup_tap() cleanup_tap() { - for TAPD in `cat "tap_devices_to_cleanup"`; do - ifconfig ${TAPD} destroy - done - rm "tap_devices_to_cleanup" + if [ -f tap_devices_to_cleanup ]; then + for tap_device in $(cat tap_devices_to_cleanup); do + ifconfig "${tap_device}" destroy + done + rm -f tap_devices_to_cleanup + fi }