From owner-svn-src-all@freebsd.org Thu Apr 13 04:10:28 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 770D4D3BE87; Thu, 13 Apr 2017 04:10:28 +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 39574A72; Thu, 13 Apr 2017 04:10:28 +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 v3D4ARjQ013812; Thu, 13 Apr 2017 04:10:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3D4AR7T013811; Thu, 13 Apr 2017 04:10:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704130410.v3D4AR7T013811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 13 Apr 2017 04:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316750 - head/contrib/netbsd-tests/usr.bin/grep 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, 13 Apr 2017 04:10:28 -0000 Author: ngie Date: Thu Apr 13 04:10:27 2017 New Revision: 316750 URL: https://svnweb.freebsd.org/changeset/base/316750 Log: Fix expectations for testcases per bsdgrep vs gnu grep from base/ports The following failures occur with various versions of grep: BSD grep: - :context - :context2 GNU grep (base): - :color - :oflag_zerolen GNU grep (ports): - :recurse_symlink Tested with: bsdgrep (^/head@r316542), gnu grep (base/2.5.1), gnu grep (ports/2.27) Reported by: Jenkins (bsdgrep failures) Sponsored by: Dell EMC Isilon Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Apr 13 01:56:15 2017 (r316749) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Apr 13 04:10:27 2017 (r316750) @@ -69,6 +69,12 @@ recurse_symlink_head() } recurse_symlink_body() { + # Begin FreeBSD + grep_type + if [ $? -eq $GREP_TYPE_GNU ]; then + atf_expect_fail "this test doesn't pass with gnu grep from ports" + fi + # End FreeBSD mkdir -p test/c/d (cd test/c/d && ln -s ../d .) echo "Test string" > test/c/match @@ -153,6 +159,12 @@ context_head() } context_body() { + # Begin FreeBSD + grep_type + if [ $? -eq $GREP_TYPE_BSD ]; then + atf_expect_fail "this test doesn't pass with BSD grep yet" + fi + # End FreeBSD cp $(atf_get_srcdir)/d_context_*.* . atf_check -o file:d_context_a.out grep -C2 bamboo d_context_a.in @@ -214,6 +226,12 @@ context2_head() } context2_body() { + # Begin FreeBSD + grep_type + if [ $? -eq $GREP_TYPE_BSD ]; then + atf_expect_fail "this test doesn't pass with BSD grep yet" + fi + # End FreeBSD printf "haddock\000cod\000plaice\000" > test1 printf "mackeral\000cod\000crab\000" > test2 @@ -227,6 +245,38 @@ context2_body() grep -z -C1 cod test1 test2 } # Begin FreeBSD + +# What grep(1) are we working with? +# - 0 : bsdgrep +# - 1 : gnu grep 2.51 (base) +# - 2 : gnu grep (ports) +GREP_TYPE_BSD=0 +GREP_TYPE_GNU_FREEBSD=1 +GREP_TYPE_GNU=2 +GREP_TYPE_UNKNOWN=3 + +grep_type() +{ + local grep_version=$(grep --version) + + case "$grep_version" in + *"BSD grep"*) + return $GREP_TYPE_BSD + ;; + *"GNU grep"*) + case "$grep_version" in + *2.5.1-FreeBSD*) + return $GREP_TYPE_GNU_FREEBSD + ;; + *) + return $GREP_TYPE_GNU + ;; + esac + ;; + esac + atf_fail "unknown grep type: $grep_version" +} + atf_test_case oflag_zerolen oflag_zerolen_head() { @@ -234,6 +284,11 @@ oflag_zerolen_head() } oflag_zerolen_body() { + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test doesn't pass with gnu grep in base" + fi + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_a.out" \ grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_a.in" @@ -271,6 +326,11 @@ color_head() } color_body() { + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test doesn't pass with gnu grep in base" + fi + echo 'abcd*' > grepfile echo 'abc$' >> grepfile echo '^abc' >> grepfile