diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-10-05 00:26:51 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-10-05 00:49:29 -0700 |
commit | a588951ee04a4e8924e98c350f44586c1869f19d (patch) | |
tree | 1ea34053e5bbbd004affadd920a1c3a2dc3ba203 | |
parent | a0bc7ca891ec1b022375b634d743a6c9a09b81c3 (diff) | |
download | grep-a588951ee04a4e8924e98c350f44586c1869f19d.tar.gz |
tests: fix tests when PCRE is not used
* tests/Makefile.am (TESTS_ENVIRONMENT):
Set PATH before setting PCRE_WORKS, so that the latter test
uses the just-built grep.
* tests/filename-lineno.pl (invalid-re-P-paren)
(invalid-re-P-star-paren): Adjust non-PCRE case to match
recently-changed behavior.
-rw-r--r-- | tests/Makefile.am | 13 | ||||
-rwxr-xr-x | tests/filename-lineno.pl | 6 |
2 files changed, 10 insertions, 9 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 034bd0c3..cc55c7e3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -224,11 +224,6 @@ TESTS_ENVIRONMENT = \ }; \ fi; \ \ - : 'set this envvar to indicate whether -P works'; \ - m=0; if err=`echo .|grep -Pq . 2>&1`; then \ - test -z "$$err" && m=1; fi; \ - export PCRE_WORKS=$$m; \ - \ : 'Test egrep/fgrep help if they use our grep.'; \ grep=`echo grep | sed -e '$(transform)'` || exit; \ if test "$$grep" = grep; then \ @@ -260,7 +255,13 @@ TESTS_ENVIRONMENT = \ PERL='$(PERL)' \ SHELL='$(SHELL)' \ PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \ - ; 9>&2 + ; \ + \ + : 'set this envvar to indicate whether -P works'; \ + m=0; if err=`echo .|grep -Pq . 2>&1`; then \ + test -z "$$err" && m=1; fi; \ + export PCRE_WORKS=$$m; \ + 9>&2 LOG_COMPILER = $(SHELL) diff --git a/tests/filename-lineno.pl b/tests/filename-lineno.pl index 82b48cd8..98780d6b 100755 --- a/tests/filename-lineno.pl +++ b/tests/filename-lineno.pl @@ -100,13 +100,13 @@ my @Tests = ['invalid-re-P-paren', '-P ")"', {EXIT=>2}, {ERR => $ENV{PCRE_WORKS} == 1 ? "$prog: unmatched parentheses\n" - : "Perl matching not supported in a --disable-perl-regexp build\n" + : "$prog: Perl matching not supported in a --disable-perl-regexp build\n" }, ], ['invalid-re-P-star-paren', '-P "a.*)"', {EXIT=>2}, {ERR => $ENV{PCRE_WORKS} == 1 - ? "$prog: unmatched parentheses\n" - : "Perl matching not supported in a --disable-perl-regexp build\n" + ? "$prog: unmatched parentheses $ENV{PCRE_WORKS}\n" + : "$prog: Perl matching not supported in a --disable-perl-regexp build\n" }, ], |