tests: work even if non-GNU gzip is installed in /usr/local/bin
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 10 Apr 2013 22:26:47 +0000 (15:26 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 10 Apr 2013 22:27:16 +0000 (15:27 -0700)
Problem reported by Antonio Diaz Diaz in
<http://lists.gnu.org/archive/html/bug-gzip/2013-04/msg00004.html>.
* tests/help-version (zdiff_setup, zcat_setup, znew_setup, zgrep_setup)
(gzexe_setup): Pass --__bindir so that subsidiary programs are our
own's, not /usr/local/bin's.  This requires using 'eval' on the result.
(zcmp_setup, gunzip_setup, zmore_setup, zless_setup, zforce_setup)
(zegrep_setup, zfgrep_setup): Invoke one of the other setup functions,
to make the patterns more obvious and simplify future maintenance.
* zcmp.in, zegrep.in, zfgrep.in: Pass __bindir to subsidiary program.

tests/help-version
zcmp.in
zegrep.in
zfgrep.in

index 24f16f9dd634cd5398676bbd3b583f5b0ca93acc..695b3841eb033c5a76ab8db6204884ca01197a51 100755 (executable)
@@ -151,18 +151,18 @@ cmp_setup () { args="$tmp_in $tmp_in2"; }
 # The transfer rate would vary between runs.
 dd_setup () { args=status=noxfer; }
 
-zdiff_setup () { args="$zin $zin2"; }
-zcmp_setup () { args="$zin $zin2"; }
-zcat_setup () { args=$zin; }
-gunzip_setup () { args=$zin; }
-zmore_setup () { args=$zin; }
-zless_setup () { args=$zin; }
-znew_setup () { args=$bigZ_in; }
-zforce_setup () { args=$zin; }
-zgrep_setup () { args="z $zin"; }
-zegrep_setup () { args="z $zin"; }
-zfgrep_setup () { args="z $zin"; }
-gzexe_setup () { args=$tmp_in; }
+zdiff_setup () { args="--__bindir '$abs_top_builddir' $zin $zin2"; }
+zcmp_setup () { zdiff_setup; }
+zcat_setup () { args="--__bindir '$abs_top_builddir' $zin"; }
+gunzip_setup () { zcat_setup; }
+zmore_setup () { zcat_setup; }
+zless_setup () { zcat_setup; }
+znew_setup () { args="--__bindir '$abs_top_builddir' $bigZ_in"; }
+zforce_setup () { zcat_setup; }
+zgrep_setup () { args="--__bindir '$abs_top_builddir' z $zin"; }
+zegrep_setup () { zgrep_setup; }
+zfgrep_setup () { zgrep_setup; }
+gzexe_setup () { args="--__bindir '$abs_top_builddir' $tmp_in"; }
 
 # We know that $tmp_in contains a "0"
 grep_setup () { args="0 $tmp_in"; }
@@ -257,7 +257,7 @@ for i in $built_programs; do
   else
     args=
   fi
-  if env $i $args < $tmp_in > $tmp_out; then
+  if eval "env \$i $args < \$tmp_in > \$tmp_out"; then
     : # ok
   else
     echo FAIL: $i
diff --git a/zcmp.in b/zcmp.in
index 3752cc1f6a8e5ded2699ba4c4b925742468cecba..28b9350c2139afadc272f2ad03965415d7394f63 100644 (file)
--- a/zcmp.in
+++ b/zcmp.in
@@ -48,4 +48,4 @@ case $1 in
 --version) echo "$version" || st=2; exit $st;;
 esac
 
-exec zdiff --__cmp "$@"
+exec zdiff --__bindir "$bindir" --__cmp "$@"
index 800210f48fa5fd435a6eddc3937c3c28005f5312..99855efa02efba931966dc88406e155470ff118b 100644 (file)
--- a/zegrep.in
+++ b/zegrep.in
@@ -4,4 +4,4 @@ case $1 in
 --__bindir) bindir=${2?}; shift; shift;;
 esac
 PATH=$bindir:$PATH
-exec zgrep -E "$@"
+exec zgrep --__bindir "$bindir" -E "$@"
index c458d96c00a9da37848ed19c88ea791a0daaa6a9..df172010f8b3c5e75b9d243ccd59c7751faeba3e 100644 (file)
--- a/zfgrep.in
+++ b/zfgrep.in
@@ -4,4 +4,4 @@ case $1 in
 --__bindir) bindir=${2?}; shift; shift;;
 esac
 PATH=$bindir:$PATH
-exec zgrep -F "$@"
+exec zgrep --__bindir "$bindir" -F "$@"