Date: Sat, 22 Apr 2017 21:40:31 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317300 - head/usr.bin/grep/tests Message-ID: <201704222140.v3MLeV1D001167@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sat Apr 22 21:40:31 2017 New Revision: 317300 URL: https://svnweb.freebsd.org/changeset/base/317300 Log: Only expect :grep_r_implied to pass with bsdgrep(1) The test fails with gnu grep from base and ports. Sponsored by: Dell EMC Isilon Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh ============================================================================== --- head/usr.bin/grep/tests/grep_freebsd_test.sh Sat Apr 22 21:40:10 2017 (r317299) +++ head/usr.bin/grep/tests/grep_freebsd_test.sh Sat Apr 22 21:40:31 2017 (r317300) @@ -25,11 +25,45 @@ # # $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 grep_r_implied grep_r_implied_body() { - (cd "$(atf_get_srcdir)" && grep -r -e "test" < /dev/null) || - atf_skip "Implied working directory is not supported with your version of grep(1)" + grep_type + if [ $? -ne $GREP_TYPE_BSD ]; then + atf_skip "this test only works with bsdgrep(1)" + fi + (cd "$(atf_get_srcdir)" && grep -r --exclude="*.out" -e "test" .) > d_grep_r_implied.out atf_check -s exit:0 -x \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704222140.v3MLeV1D001167>