From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:05:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDC2A4EAE8F; Sun, 24 Jan 2021 04:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfXs1gTXz4RFl; Sun, 24 Jan 2021 04:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 214461CF78; Sun, 24 Jan 2021 04:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O45Gg8094113; Sun, 24 Jan 2021 04:05:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O45GAV094112; Sun, 24 Jan 2021 04:05:16 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:05:16 GMT Message-Id: <202101240405.10O45GAV094112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ad62ba026e4d - stable/12 - du: tests: make H_flag tests more strict about output requirements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ad62ba026e4d91f01569ca17f3b9f900a60cc08f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:05:17 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ad62ba026e4d91f01569ca17f3b9f900a60cc08f commit ad62ba026e4d91f01569ca17f3b9f900a60cc08f Author: Kyle Evans AuthorDate: 2021-01-05 21:49:46 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:05:00 +0000 du: tests: make H_flag tests more strict about output requirements The current version of this test will effectively pass as long as one of the specified paths is in the output, and it could even be a subset of one of the paths. Strengthen up the test a little bit: * Specify beginning/end anchors for each path * Add egrep -v checks to make sure we don't have any *additional* paths * Ratchet down paths2 to exactly the two paths we expect to appear (cherry picked from commit 3c5c39c7ad8f010cfa5fc0db43d15d1964b4cf16) --- usr.bin/du/tests/du_test.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh index 4a8f11e83ff5..92a26deae02b 100755 --- a/usr.bin/du/tests/du_test.sh +++ b/usr.bin/du/tests/du_test.sh @@ -45,17 +45,25 @@ H_flag_head() H_flag_body() { local paths1='testdir/A/B testdir/A testdir/C testdir' - local paths2='testdir/A/B testdir/A testdir/C testdir' + local paths2='testdir/C/B testdir/C' local lineprefix="^[0-9]+$(printf "\t")" - local sep="\n${lineprefix}" + local sep="\$\n${lineprefix}" atf_check mkdir testdir atf_check -x "cd testdir && mkdir A && touch A/B && ln -s A C" atf_check -o save:du.out du -aAH testdir - atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")" du.out + atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")$" du.out + # Check that the output doesn't contain any lines (i.e. paths) that we + # did not expect it to contain from $paths1. + atf_check -s exit:1 egrep -vq "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")$" du.out + atf_check -o save:du_C.out du -aAH testdir/C - atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")" du_C.out + atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")$" du_C.out + + # Check that the output doesn't contain any lines (i.e. paths) that we + # did not expect it to contain from $paths2. + atf_check -s exit:1 egrep -vq "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")$" du_C.out } atf_test_case I_flag