From owner-svn-src-head@freebsd.org Wed Jul 19 16:23:03 2017 Return-Path: Delivered-To: svn-src-head@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 85D75CFCD8A; Wed, 19 Jul 2017 16:23:03 +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 6060D16F3; Wed, 19 Jul 2017 16:23:03 +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 v6JGN2bN019112; Wed, 19 Jul 2017 16:23:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6JGN2FJ019111; Wed, 19 Jul 2017 16:23:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707191623.v6JGN2FJ019111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 19 Jul 2017 16:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321211 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 321211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2017 16:23:03 -0000 Author: ngie Date: Wed Jul 19 16:23:02 2017 New Revision: 321211 URL: https://svnweb.freebsd.org/changeset/base/321211 Log: Clean up :coredump_phnum - Use "atf_check -x 'cmd1 | cmd2'" instead of "cmd1 | atf_check cmd2". The two forms are idiomatically similar, but subtly different in the sense of what program invokes the other, and there could be unwanted side effects of the latter idiom dealing with forking, pipes, etc. - Remove chmod and instead source coredump_phnum_restore_state.sh directly. This avoids the need to check the result of the chmod call. - Fix indentation in an if-block (4 column space indentation -> hard tab). Modified: head/tests/sys/kern/coredump_phnum_test.sh Modified: head/tests/sys/kern/coredump_phnum_test.sh ============================================================================== --- head/tests/sys/kern/coredump_phnum_test.sh Wed Jul 19 16:08:08 2017 (r321210) +++ head/tests/sys/kern/coredump_phnum_test.sh Wed Jul 19 16:23:02 2017 (r321211) @@ -46,7 +46,6 @@ coredump_phnum_body() sysctl kern.coredump=$(sysctl -n kern.coredump) sysctl kern.corefile='$(sysctl -n kern.corefile)' EOF - chmod +x coredump_phnum_restore_state.sh ulimit -c unlimited sysctl kern.coredump=1 @@ -56,30 +55,27 @@ EOF # Check that core looks good if [ ! -f coredump_phnum_helper.core ]; then - atf_fail "Helper program did not dump core" + atf_fail "Helper program did not dump core" fi # These magic numbers don't have any real significance. They are just # the result of running the helper program and dumping core. The only # important bit is that they're larger than 65535 (UINT16_MAX). - readelf -h coredump_phnum_helper.core | \ - atf_check -o "match:65535 \(66[0-9]{3}\)" \ - grep "Number of program headers:" - readelf -l coredump_phnum_helper.core | \ - atf_check -o "match:There are 66[0-9]{3} program headers" \ - grep -1 "program headers" - readelf -S coredump_phnum_helper.core | \ - atf_check -o "match: 0000000000000001 .* 66[0-9]{3} " \ - grep -A1 "^ \[ 0\] " + atf_check -o "match:65535 \(66[0-9]{3}\)" \ + -x 'readelf -h coredump_phnum_helper.core | grep "Number of program headers:"' + atf_check -o "match:There are 66[0-9]{3} program headers" \ + -x 'readelf -l coredump_phnum_helper.core | grep -1 "program headers"' + atf_check -o "match: 0000000000000001 .* 66[0-9]{3} " \ + -x 'readelf -S coredump_phnum_helper.core | grep -A1 "^ \[ 0\] "' - procstat -v coredump_phnum_helper.core | \ - atf_check -o "match:66[0-9]{3}" wc -l + atf_check -o "match:66[0-9]{3}" \ + -x 'procstat -v coredump_phnum_helper.core | wc -l' } coredump_phnum_cleanup() { rm -f coredump_phnum_helper.core - if [ -x coredump_phnum_restore_state.sh ]; then - ./coredump_phnum_restore_state.sh + if [ -f coredump_phnum_restore_state.sh ]; then + . ./coredump_phnum_restore_state.sh fi rm -f coredump_phnum_restore_state.sh }