tests: zgrep-context assumes grep knows context
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 12 Jun 2013 03:23:28 +0000 (20:23 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 12 Jun 2013 03:23:50 +0000 (20:23 -0700)
* tests/Makefile.am (TESTS_ENVIRONMENT): Pass GREP too.
* tests/zgrep-context: Check that the underlying grep supports
context options.  Problem reported by Steven M. Schweda in
<http://lists.gnu.org/archive/html/bug-gzip/2013-06/msg00010.html>.

tests/Makefile.am
tests/zgrep-context

index 53bfffa19021774a2740621129595e26c88483b6..37c7b8cdfc633eddbcd299a7fc6478d63fb363c6 100644 (file)
@@ -79,6 +79,7 @@ TESTS_ENVIRONMENT =                           \
   srcdir='$(srcdir)'; export srcdir;                                   \
   top_srcdir='$(top_srcdir)'; export top_srcdir;                       \
   CC='$(CC)'; export CC;                                               \
+  GREP='$(GREP)'; export GREP;                                         \
   GZIP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'`; export GZIP_TEST_NAME; \
   MAKE=$(MAKE); export MAKE;                                           \
   PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'; export PACKAGE_BUGREPORT;  \
index f2e26d261fb925117fdbfb55eee881761ff68f55..a3871ebd5b9a92b33611bf92f4dbbfa13c17e2d3 100755 (executable)
@@ -34,6 +34,12 @@ seq 40 > in || framework_failure_
 gzip < in > in.gz || framework_failure_
 seq 2 32 > exp || framework_failure_
 
+: ${GREP=grep}
+$GREP -15 17 - < in > out && compare exp out || {
+  echo >&2 "$0: $GREP does not support context options; skipping this test"
+  exit 77
+}
+
 fail=0
 zgrep -15 17 - < in.gz > out || fail=1
 compare exp out || fail=1