Subject: bug#23146: grep 2.24: tests broken with --program-prefix

From: Paul Eggert <[email-masked]>
Date: Sun, 3 Apr 2016 01:01:55 -0700

Christian Weisgerber wrote:
> In GNU grep 2.24 and earlier, the regression tests
>
>    help-version
>    reversed-range-endpoints
>
> fail if grep is built with a program prefix (I use --program-prefix=g).

Jim fixed the second problem, and the attached patch should fix the first one, 
so I'll mark this bug as done. Thanks for reporting it.

>From 62fa4868439874fe0620798111ab24cf4525d93b Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 3 Apr 2016 00:59:56 -0700
Subject: [PATCH] tests: test egrep/fgrep help only if our grep

Problem reported by Christian Weisgerber in: http://bugs.gnu.org/23146
* tests/Makefile.am (TESTS_ENVIRONMENT):
Test egrep and fgrep only if they use our grep.
---
 tests/Makefile.am | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0326ff4..b65fc39 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -182,6 +182,14 @@ TESTS_ENVIRONMENT =				\
       done;						\
     };							\
   fi;							\
+							\
+  : 'Test egrep/fgrep help if they use our grep.';	\
+  grep=`echo grep | sed -e '$(transform)'` || exit;	\
+  if test "$$grep" = grep; then				\
+    built_programs='grep egrep fgrep';			\
+  else							\
+    built_programs='grep';				\
+  fi;							\
 						\
   export_with_values				\
   VERSION='$(VERSION)'				\
@@ -193,7 +201,7 @@ TESTS_ENVIRONMENT =				\
   abs_top_builddir='$(abs_top_builddir)'	\
   abs_top_srcdir='$(abs_top_srcdir)'		\
   abs_srcdir='$(abs_srcdir)'			\
-  built_programs='grep egrep fgrep'		\
+  built_programs="$$built_programs"		\
   srcdir='$(srcdir)'				\
   top_srcdir='$(top_srcdir)'			\
   CC='$(CC)'					\
-- 
2.5.5