automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] {maint} tests: better idiom to override make macro defs on the cmd


From: Stefano Lattarini
Subject: [FYI] {maint} tests: better idiom to override make macro defs on the cmdline
Date: Tue, 21 May 2013 17:39:44 +0200

We now do so with a new wrapper shell function 'run_make()', which
relies on the use of AM_MAKEFLAGS, avoiding the use of the '-e' make
option.  The use of that option (that causes the environment variables
to take precedence over the macro definitions in the Makefile) has
proved to be quite brittle in the past, causing annoying and sometimes
problematic spurious failures.  This has worsened in some still
unpublished work going on in development branches.  It's time to solve
the issue once and for all.

Note that we do not convert all uses of $MAKE in the testsuite right
away; we might do so in follow-up changes, with leisure, to avoid a
"patch bomb" effect (this commit is already too much of a bomb itself).
What we do in this commit is to get rid of all "$MAKE -e" invocations.

We admit that the implementation and feature-set of 'run_make()' are
far from perfect, but good enough for our current purposes.  We'll
improve 'run_make()' if and when the need arises.

* syntax-checks.mk (sc_tests_no_make_e): New syntax check, guard against
the use of "$MAKE -e".
(syntax_check_rules): Add it.
(sc_tests_overriding_macros_on_cmdline): Adjust.
(lint): New, alias for 'maintainer-check', for lazy typists.  Idea
backported from the 'maint' branch (Automake 1.13a).
* t/ax/am-test-lib.sh (run_make): New function.  Run $MAKE with the
given command-line arguments, handling command-line override of variable
definitions in a smart way (using AM_MAKEFLAGS if a non-GNU make
implementation is detected to be in use).
(useless_vpath_rebuild): Adjust to use 'run_make', to avoid a spurious
maintainer check failure.
(yl_distcheck): Use 'run_make' rather than bare '$MAKE'.
(single_quote, append_single_quoted, is_valid_varname): New auxiliary
function, used, directly or indirectly, by it.
* Many tests: Adjust to avoid the use of "$MAKE -e", and prefer the
use of 'run_make' in few other contexts as well, where it makes sense.
Other minor fixlets while at it.

Signed-off-by: Stefano Lattarini <address@hidden>

squash

Signed-off-by: Stefano Lattarini <address@hidden>
---
 contrib/t/parallel-tests-html.sh           |   8 +-
 syntax-checks.mk                           |  37 ++++++---
 t/ax/am-test-lib.sh                        | 125 ++++++++++++++++++++++++++++-
 t/ax/tap-summary-aux.sh                    |   6 +-
 t/ax/testsuite-summary-checks.sh           |  10 +--
 t/check-concurrency-bug9245.sh             |   9 +--
 t/check10.sh                               |  29 +++----
 t/check11.sh                               |   4 +-
 t/check5.sh                                |   2 +-
 t/check7.sh                                |   2 +-
 t/color-tests.sh                           |   7 +-
 t/distcheck-configure-flags.sh             |   3 +-
 t/distcheck-override-infodir.sh            |   2 +-
 t/distdir.sh                               |   2 +-
 t/exeext.sh                                |   4 +-
 t/instdir-java.sh                          |  12 +--
 t/instdir-lisp.sh                          |  11 ++-
 t/instdir-ltlib.sh                         |  18 ++---
 t/instdir-no-empty.sh                      |   6 +-
 t/instdir-prog.sh                          |  17 ++--
 t/instdir-python.sh                        |  11 ++-
 t/instdir-texi.sh                          |  13 ++-
 t/instdir.sh                               |  11 ++-
 t/instdir2.sh                              |  11 ++-
 t/insthook.sh                              |   2 +-
 t/instmany-mans.sh                         |  42 +++++++---
 t/instmany-python.sh                       |  42 +++++++---
 t/instmany.sh                              |  42 +++++++---
 t/instspc.tap                              |   2 +-
 t/javaflags.sh                             |   2 +-
 t/lflags.sh                                |   2 +-
 t/lflags2.sh                               |   2 +-
 t/libtool9.sh                              |  11 ++-
 t/link_cond.sh                             |   8 +-
 t/lisp-flags.sh                            |   6 +-
 t/man3.sh                                  |   2 +-
 t/mmodely.sh                               |   3 +-
 t/parallel-tests-basics.sh                 |  12 +--
 t/parallel-tests-cmdline-override.sh       |   2 +-
 t/parallel-tests-empty-testlogs.sh         |   4 +-
 t/parallel-tests-exit-statuses.sh          |  51 +++++-------
 t/parallel-tests-extra-programs.sh         |   7 +-
 t/parallel-tests-fork-bomb.sh              |   2 +-
 t/parallel-tests-harderror.sh              |   5 +-
 t/parallel-tests-log-compiler-1.sh         |   2 +-
 t/parallel-tests-log-override-1.sh         |  10 +--
 t/parallel-tests-log-override-2.sh         |   4 +-
 t/parallel-tests-log-override-recheck.sh   |   4 +-
 t/parallel-tests-no-color-in-log.sh        |   2 +-
 t/parallel-tests-recheck-pr11791.sh        |   6 +-
 t/remake-subdir-long-time.sh               |   4 +-
 t/remake-timing-bug-pr8365.sh              |   5 +-
 t/subst-no-trailing-empty-line.sh          |   4 +-
 t/suffix-custom-subobj.sh                  |   2 +-
 t/suffix11.tap                             |   2 +-
 t/suffix6c.sh                              |   4 +-
 t/suffix8.tap                              |   2 +-
 t/tap-autonumber.sh                        |   2 +-
 t/tap-bailout-leading-space.sh             |   2 +-
 t/tap-bailout-suppress-later-errors.sh     |   2 +-
 t/tap-bailout.sh                           |   2 +-
 t/tap-basic.sh                             |   4 +-
 t/tap-color.sh                             |   8 +-
 t/tap-diagnostic.sh                        |   2 +-
 t/tap-doc2.sh                              |   4 +-
 t/tap-global-log.sh                        |   3 +-
 t/tap-global-result.sh                     |   4 +-
 t/tap-log.sh                               |   4 +-
 t/tap-merge-stdout-stderr.sh               |   2 +-
 t/tap-msg0-bailout.sh                      |   2 +-
 t/tap-msg0-planskip.sh                     |   2 +-
 t/tap-out-of-order.sh                      |   2 +-
 t/tap-passthrough-exit.sh                  |   2 +-
 t/tap-passthrough.sh                       |   6 +-
 t/tap-plan-corner.sh                       |  16 ++--
 t/tap-plan-leading-zero.sh                 |   4 +-
 t/tap-plan-malformed.sh                    |   2 +-
 t/tap-plan-middle.sh                       |   4 +-
 t/tap-plan-whitespace.sh                   |   2 +-
 t/tap-plan.sh                              |   4 +-
 t/tap-planskip-and-logging.sh              |   2 +-
 t/tap-planskip-case-insensitive.sh         |   2 +-
 t/tap-planskip-late.sh                     |   2 +-
 t/tap-planskip-unplanned-corner.sh         |   2 +-
 t/tap-planskip-whitespace.sh               |   2 +-
 t/tap-planskip.sh                          |   4 +-
 t/tap-recheck-logs.sh                      |  12 +--
 t/tap-test-number-0.sh                     |   2 +-
 t/tap-unplanned.sh                         |   2 +-
 t/test-driver-custom-multitest-recheck2.sh |  18 ++---
 t/test-driver-custom-multitest.sh          |   2 +-
 t/test-log.sh                              |   4 +-
 t/test-missing.sh                          |   6 +-
 t/test-trs-basic.sh                        |  14 ++--
 t/test-trs-recover.sh                      |   6 +-
 t/test-trs-recover2.sh                     |   2 +-
 t/testsuite-summary-reference-log.sh       |   4 +-
 t/txinfo-many-output-formats-vpath.sh      |   2 +-
 t/txinfo-many-output-formats.sh            |   2 +-
 t/yflags-cmdline-override.sh               |   9 +--
 t/yflags.sh                                |   6 +-
 t/yflags2.sh                               |   6 +-
 102 files changed, 510 insertions(+), 346 deletions(-)

diff --git a/contrib/t/parallel-tests-html.sh b/contrib/t/parallel-tests-html.sh
index d4951b1..209dda8 100755
--- a/contrib/t/parallel-tests-html.sh
+++ b/contrib/t/parallel-tests-html.sh
@@ -87,12 +87,12 @@ test ! -e bla
 
 # Always create the HTML output, even if there were no failures.
 rm -f mylog.html
-env TESTS=foo.test $MAKE -e check-html
+run_make TESTS=foo.test check-html
 test -f mylog.html
 
 # Create summarizing HTML output also with recheck-html.
 rm -f mylog.html
-env TESTS=foo.test $MAKE -e recheck-html
+run_make TESTS=foo.test recheck-html
 test -f mylog.html
 
 # Create HTML output for an individual test.
@@ -120,7 +120,7 @@ test ! -e mylog.html
 
 $MAKE clean
 test ! -e mylog.html
-env TEST_LOGS=foo.log $MAKE -e check-html
+run_make TEST_LOGS=foo.log check-html
 test -f bla
 test -f foo.log
 test ! -e bar.log
@@ -128,7 +128,7 @@ test ! -e baz.log
 test -f mylog.html
 
 $MAKE clean
-env TESTS=foo.test $MAKE -e recheck-html
+run_make TESTS=foo.test recheck-html
 test -f bla
 test ! -e foo.log
 test -f mylog.html
diff --git a/syntax-checks.mk b/syntax-checks.mk
index 8808ae7..3feb400 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -66,6 +66,7 @@ sc_tests_exit_not_Exit \
 sc_tests_automake_fails \
 sc_tests_required_after_defs \
 sc_tests_overriding_macros_on_cmdline \
+sc_tests_no_make_e \
 sc_tests_plain_sleep \
 sc_tests_ls_t \
 sc_m4_am_plain_egrep_fgrep \
@@ -354,6 +355,17 @@ sc_tests_required_after_defs:
          fi; \
        done
 
+# "make -e" is brittle and unsafe, since it let *all* the environment
+# win over the macro definitions in the Makefiles.  Since we offer
+# AM_MAKEFLAGS to allow the user to portably override macro definitions
+# from the command line in a safe way, we should encourage users to use
+# it.
+sc_tests_no_make_e:
+       @if grep -E '\$$MAKE\b.* -[a-zA-Z0-9]*e' $(xtests); then \
+         echo '"make -e" is brittle, use "run_make" instead.' 1>&2; \
+         exit 1; \
+       fi
+
 ## Overriding a Makefile macro on the command line is not portable when
 ## recursive targets are used.  Better use an envvar.  SHELL is an
 ## exception, POSIX says it can't come from the environment.  V, DESTDIR,
@@ -362,11 +374,6 @@ sc_tests_required_after_defs:
 ## Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
 ## ok to override it from the command line.
 sc_tests_overriding_macros_on_cmdline:
-       @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
-         echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e 
SHELL=$$SHELL"' 1>&2; \
-         echo ' in the above lines, it is more portable.' 1>&2; \
-         exit 1; \
-       fi
 # The first s/// tries to account for usages like "$MAKE || st=$?".
 # 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
 # their definitions, hence the more complex last three substitutions below.
@@ -379,16 +386,17 @@ sc_tests_overriding_macros_on_cmdline:
                -e "s/ exp='[^']*'/ /" \
                -e 's/ exp="[^"]*"/ /' \
                -e 's/ exp=[^ ]/ /' \
-             $(xtests) | grep '\$$MAKE .*='; then \
-         echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above 
lines,' 1>&2; \
-         echo 'it is more portable.' 1>&2; \
+             $(filter-out %/am-test-lib.sh,$(xtests)) \
+               | grep '\$$MAKE .*='; then \
+         echo 'Rewrite "$$MAKE foo=bar" as "run_make foo=bar" in the lines 
above,'; \
+         echo 'it is more portable.'; \
          exit 1; \
-       fi
+       fi >&2
        @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
-         echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 
1>&2; \
-         echo 'the above lines.' 1>&2; \
+         echo '$$MAKE ignores the SHELL envvar, use "run_make SHELL=$$SHELL"'; 
\
+         echo 'in the above lines.'; \
          exit 1; \
-       fi
+       fi >&2
 
 ## Prefer use of our 'is_newest' auxiliary script over the more hacky
 ## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
@@ -521,3 +529,8 @@ maintainer-check: $(syntax_check_rules)
 ## Check that the list of tests given in the Makefile is equal to the
 ## list of all test scripts in the Automake testsuite.
 maintainer-check: maintainer-check-list-of-tests
+
+# I'm a lazy typist.
+lint: maintainer-check
+.PHONY: lint
+
diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index b323200..4f5c895 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -121,6 +121,127 @@ is_blocked_signal ()
   fi
 }
 
+# single_quote STRING
+# -------------------
+# Single-quote STRING for the shell, also dealing with embedded single
+# quotes. Place the result in the '$am_result', that is thus to be
+# considered public.
+single_quote ()
+{
+  am_result=$1
+  case $am_result in
+    *\'*) am_result=$(printf '%s\n' "$*" | sed -e "s/'/'\\\\''/g");;
+  esac
+  am_result="'$am_result'"
+}
+
+# append_single_quoted VARIABLE STRING
+# ------------------------------------
+append_single_quoted ()
+{
+  am__var=$1; shift
+  single_quote "$1" # Sets 'am_result'.
+  eval "${am__var}=\${$am__var:+\"\${$am__var} \"}\$am_result"
+  unset am__var am_result
+}
+
+# is_valid_varname STRING
+# -----------------------
+# Tell whether STRING is a valid name for a shell variable.  Return 0
+# if yes, return 1 if not.
+is_valid_varname ()
+{
+  # FIXME: is the below truly portable even for LC_COLLATE != "C" ?
+  case $1 in
+    [0-9]*) return 1;;
+    *[!a-zA-Z0-9_]*) return 1;;
+  esac
+  return 0
+}
+
+# run_make [-e STATUS] [--] [VAR=VAL ...] [MAKE-ARGS...]
+# ------------------------------------------------------
+# Run $MAKE with the given command-line, and fail if it doesn't exit with
+# STATUS (default: 0).  If STATUS is "FAIL", then any exit status > 0 is
+# acceptable.  If STATUS is "IGNORE", any exit value is acceptable.
+# This function also handle command-line override of variable definition
+# in a smart way, using AM_MAKEFLAGS if a non-GNU make implementation
+# is in use.
+run_make ()
+{
+  # Follow-up code might want to analyse these, so don't make them as
+  # private, nor unset them later.
+  am_make_rc_exp=0
+  am_make_rc_got=0
+  # Parse options for this function.
+  while test $# -gt 0; do
+    case $1 in
+      -e) am_make_rc_exp=$2; shift;;
+      --) shift; break;;
+       *) break;;
+    esac
+    shift
+  done
+  am__make_flags=
+  if using_gmake; then
+    # We can trust GNU make to correctly pass macro definitions given
+    # on the command line down to sub-make invocations, and this allow
+    # us to have a vary simple implementation: delegate all the work
+    # to GNU make.
+    :
+  else
+    # We have to explicitly parse arguments passed to make.  Not 100%
+    # safe w.r.t. options like '-I' that can have an argument, but
+    # should be good enough for our usages so far.
+    for am__x
+    do
+      case $am__x in
+        *=*)
+        am__maybe_var=${am__x%%=*}
+        am__maybe_val=${am__x#*=}
+        am__maybe_def="${am__maybe_var}=${am__maybe_val}"
+        # Some variables should be portably overridable from the command
+        # line, even when using non-GNU make.
+        case $am__maybe_var in
+          V|\
+          DESTDIR|\
+          SHELL|\
+          VERBOSE|\
+          DISABLE_HARD_ERRORS|\
+          DISTCHECK_CONFIGURE_FLAGS)
+            ;;
+          *)
+            if is_valid_varname "$am__maybe_var"; then
+              append_single_quoted am__make_flags "$am__maybe_def"
+            fi
+        esac
+        unset am__maybe_var am__maybe_val am__maybe_def
+        ;;
+      esac
+    done
+    unset am__x
+  fi
+  if test x"$am__make_flags" != x; then
+    $MAKE AM_MAKEFLAGS="$am__make_flags" ${1+"$@"} || am_make_rc_got=$?
+  else
+    $MAKE ${1+"$@"} || am_make_rc_got=$?
+  fi
+  unset am__make_flags
+  case $am_make_rc_exp in
+    IGNORE)
+      : Ignore exit status
+      ;;
+    FAIL)
+      test $am_make_rc_got -gt 0 || return 1
+      ;;
+    *)
+     test $am_make_rc_exp -ge 0 && test $am_make_rc_exp -le 255 \
+       || fatal_ "invalid expected exit status: '$am_make_rc_exp'"
+     test $am_make_rc_exp -eq $am_make_rc_got || return 1
+     ;;
+  esac
+}
+
 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
 # -----------------------------------------------------------------
 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
@@ -311,7 +432,7 @@ useless_vpath_rebuild ()
         .a.b: ; cp $< $@
         baz: bar ; cp ../baz bar
 END
-    if $MAKE all && test ! -e foo.b && test ! -e bar; then
+    if run_make all && test ! -e foo.b && test ! -e bar; then
       am__useless_vpath_rebuild=no
     else
       am__useless_vpath_rebuild=yes
@@ -328,7 +449,7 @@ END
 }
 am__useless_vpath_rebuild=""
 
-yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
+yl_distcheck () { useless_vpath_rebuild || run_make distcheck ${1+"$@"}; }
 
 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
 # -----------------------------------------------------------------------
diff --git a/t/ax/tap-summary-aux.sh b/t/ax/tap-summary-aux.sh
index 1872caa..2270079 100644
--- a/t/ax/tap-summary-aux.sh
+++ b/t/ax/tap-summary-aux.sh
@@ -57,11 +57,11 @@ do_check ()
   if test $use_colors = yes; then
     # Forced colorization should take place also with non-ANSI terminals;
     # hence the "TERM=dumb" definition.
-    make_cmd="env TERM=dumb AM_COLOR_TESTS=always $MAKE -e"
+    make_args='TERM=dumb AM_COLOR_TESTS=always'
   else
-    make_cmd=$MAKE
+    make_args=
   fi
-  $make_cmd check > stdout || st=$?
+  run_make $make_args check > stdout || st=$?
   cat stdout
   if test $expect_failure = yes; then
     test $st -gt 0 || exit 1
diff --git a/t/ax/testsuite-summary-checks.sh b/t/ax/testsuite-summary-checks.sh
index 63f3f91..94de72d 100644
--- a/t/ax/testsuite-summary-checks.sh
+++ b/t/ax/testsuite-summary-checks.sh
@@ -69,19 +69,17 @@ do_check ()
   cat > summary.exp
   expect_failure=false
   xfail_tests=''
-  tests="TESTS='$*'"
+  tests="$*"
   for t in $*; do
     case $t in fail*|xpass*|error*) expect_failure=:;; esac
     case $t in xfail*|xpass*) xfail_tests="$xfail_tests $t";; esac
   done
-  test -z "$xfail_tests" || xfail_tests="XFAIL_TESTS='$xfail_tests'"
-  st=0
-  eval "env $tests $xfail_tests \$MAKE -e check > stdout || st=\$?"
+  run_make -e IGNORE check TESTS="$tests" XFAIL_TESTS="$xfail_tests" >stdout
   cat stdout
   if $expect_failure; then
-    test $st -gt 0 || exit 1
+    test $am_make_rc_got -gt 0 || exit 1
   else
-    test $st -eq 0 || exit 1
+    test $am_make_rc_got -eq 0 || exit 1
   fi
   $PERL "$am_testaux_srcdir"/extract-testsuite-summary.pl stdout >summary.got \
    || fatal_ "cannot extract testsuite summary"
diff --git a/t/check-concurrency-bug9245.sh b/t/check-concurrency-bug9245.sh
index eaf66d9..abe01d3 100644
--- a/t/check-concurrency-bug9245.sh
+++ b/t/check-concurrency-bug9245.sh
@@ -42,16 +42,15 @@ $AUTOMAKE -a
 
 ./configure
 
-# Some make implementations don't grok the '-j' option.
-$MAKE -j1 || exit 77
+$MAKE -j1 || skip_ "'$MAKE' doesn't support the -j option"
 
 for j in '' -j1 -j2; do
   $MAKE $j check && exit 1
-  TESTS=foo.test $MAKE $j -e check && exit 1
+  run_make -e FAIL -- $j TESTS=foo.test check
   $MAKE $j recheck && exit 1
-  TEST_LOGS=foo.log $MAKE $j -e check && exit 1
+  run_make -e FAIL -- $j TEST_LOGS=foo.log check
   rm -f test-suite.log
-  $MAKE $j test-suite.log && exit 1
+  run_make -e FAIL $j test-suite.log
   test -f test-suite.log || exit 1
 done
 
diff --git a/t/check10.sh b/t/check10.sh
index d66ad2c..3bb180b 100644
--- a/t/check10.sh
+++ b/t/check10.sh
@@ -55,22 +55,19 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-(
-  # Do not check for failure in this subshell
-  set +e
-  env TESTS=pass $MAKE -e check
-  env TESTS=fail $MAKE -e check
-  env TESTS=skip $MAKE -e check
-  env TESTS=xfail $MAKE -e check
-  env TESTS=xpass $MAKE -e check
-  env TESTS="pass pass2" $MAKE -e check
-  env TESTS="fail fail2" $MAKE -e check
-  env TESTS="skip skip2" $MAKE -e check
-  env TESTS="xfail xfail2" $MAKE -e check
-  env TESTS="xpass xpass2" $MAKE -e check
-  env TESTS='pass skip xfail' $MAKE -e check
-  $MAKE check
-  :
+( 
+  run_make -e IGNORE TESTS=pass check
+  run_make -e IGNORE TESTS=fail check
+  run_make -e IGNORE TESTS=skip check
+  run_make -e IGNORE TESTS=xfail check
+  run_make -e IGNORE TESTS=xpass check
+  run_make -e IGNORE TESTS="pass pass2" check
+  run_make -e IGNORE TESTS="fail fail2" check
+  run_make -e IGNORE TESTS="skip skip2" check
+  run_make -e IGNORE TESTS="xfail xfail2" check
+  run_make -e IGNORE TESTS="xpass xpass2" check
+  run_make -e IGNORE TESTS='pass skip xfail' check
+  run_make -e IGNORE check
 ) >stdout || { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/check11.sh b/t/check11.sh
index 61b95be..3526d84 100644
--- a/t/check11.sh
+++ b/t/check11.sh
@@ -40,7 +40,7 @@ $AUTOMAKE -a
 
 ./configure
 
-env TESTS=skip $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS=skip check >stdout || { cat stdout; exit 1; }
 cat stdout
 if test x"$am_serial_tests" = x"yes"; then
   grep '1.*passed' stdout && exit 1
@@ -49,7 +49,7 @@ else
   count_test_results total=1 pass=0 fail=0 skip=1 xfail=0 xpass=0 error=0
 fi
 
-env TESTS="skip skip2" $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS="skip skip2" check >stdout || { cat stdout; exit 1; }
 cat stdout
 if test x"$am_serial_tests" = x"yes"; then
   grep '2.*passed' stdout && exit 1
diff --git a/t/check5.sh b/t/check5.sh
index 2b2d743..a708839 100644
--- a/t/check5.sh
+++ b/t/check5.sh
@@ -52,7 +52,7 @@ cp one.c two.c
 ./configure
 $MAKE check
 test -f ok
-EXEEXT=.bin $MAKE -e print-tests >stdout || { cat stdout; exit 1; }
+run_make EXEEXT=.bin print-tests >stdout || { cat stdout; exit 1; }
 cat stdout
 $FGREP 'BEG: one.bin two.bin :END' stdout
 # No am__EXEEXT_* variable is needed.
diff --git a/t/check7.sh b/t/check7.sh
index 5f19af0..5575f95 100644
--- a/t/check7.sh
+++ b/t/check7.sh
@@ -60,7 +60,7 @@ $AUTOMAKE -a
 
 ./configure
 $MAKE check
-EXEEXT=.bin $MAKE -e print-xfail-tests >stdout || {  cat stdout; exit 1; }
+run_make EXEEXT=.bin print-xfail-tests >stdout || {  cat stdout; exit 1; }
 cat stdout
 $FGREP 'BEG: a.bin b c.bin d.bin :END' stdout
 
diff --git a/t/color-tests.sh b/t/color-tests.sh
index ae6ef68..9a0d435 100644
--- a/t/color-tests.sh
+++ b/t/color-tests.sh
@@ -134,12 +134,13 @@ for vpath in false :; do
 
   # Forced colorization should take place also with non-ANSI terminals;
   # hence the "TERM=dumb" definition.
-  TERM=dumb AM_COLOR_TESTS=always $MAKE -e check >stdout \
-    && { cat stdout; exit 1; }
+  AM_COLOR_TESTS=always; export AM_COLOR_TESTS
+  run_make TERM=dumb check >stdout && { cat stdout; exit 1; }
   cat stdout
   test_color
 
-  TERM=ansi $MAKE -e check >stdout && { cat stdout; exit 1; }
+  unset AM_COLOR_TESTS
+  run_make TERM=ansi check >stdout && { cat stdout; exit 1; }
   cat stdout
   test_no_color
 
diff --git a/t/distcheck-configure-flags.sh b/t/distcheck-configure-flags.sh
index 3c23117..dece1c4 100644
--- a/t/distcheck-configure-flags.sh
+++ b/t/distcheck-configure-flags.sh
@@ -40,8 +40,9 @@ $AUTOCONF
 # It should be ok to define DISTCHECK_CONFIGURE_FLAGS either on the
 # make command line or in the environment.
 
+# Not 'make -e' below, deliberately.
 env DISTCHECK_CONFIGURE_FLAGS='--enable-success sentence=it\ works\ :-\)' \
-  $MAKE distcheck # Not 'make -e' here, deliberately.
+  $MAKE distcheck
 
 $MAKE distcheck \
   DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes sentence='it works :-)'"
diff --git a/t/distcheck-override-infodir.sh b/t/distcheck-override-infodir.sh
index cc2a5d6..6127f2b 100644
--- a/t/distcheck-override-infodir.sh
+++ b/t/distcheck-override-infodir.sh
@@ -72,7 +72,7 @@ $AUTOCONF
 $MAKE
 
 $MAKE distcheck
-infodir="$(pwd)/_info" $MAKE -e distcheck
+run_make infodir="$(pwd)/_info" distcheck
 test -f _info/dir || exit 99 # Sanity check.
 
 :
diff --git a/t/distdir.sh b/t/distdir.sh
index a050d3e..94de0d2 100644
--- a/t/distdir.sh
+++ b/t/distdir.sh
@@ -68,7 +68,7 @@ test -d foo && exit 1
 
 rm -rf $me-1.0
 # Remove the dot from VERSION for the next grep.
-VERSION=10 MKDIR_P='echo MKDIR_P' $MAKE -e distdir >stdout || :
+run_make -e IGNORE VERSION=10 MKDIR_P='echo MKDIR_P' distdir >stdout
 cat stdout
 
 # Make sure no './' appear in the directory names.  srcdir is '..', so
diff --git a/t/exeext.sh b/t/exeext.sh
index 35b1a21..604e9a5 100644
--- a/t/exeext.sh
+++ b/t/exeext.sh
@@ -69,7 +69,7 @@ grep 'maude3__EXEEXT__OBJECTS' Makefile.in && exit 1
 
 ./configure
 
-EXEEXT=.foo $MAKE -e print > stdout
+run_make EXEEXT=.foo print > stdout
 cat stdout
 
 grep '1BEG: maude.foo mt.foo :END1' stdout
@@ -79,7 +79,7 @@ grep '4BEG: rmt.foo :END4' stdout
 
 ./configure revert=yes
 
-EXEEXT=.foo $MAKE -e print > stdout
+run_make EXEEXT=.foo print > stdout
 cat stdout
 
 grep '1BEG: maude.foo :END1' stdout
diff --git a/t/instdir-java.sh b/t/instdir-java.sh
index 97eff57..547ec5f 100644
--- a/t/instdir-java.sh
+++ b/t/instdir-java.sh
@@ -45,16 +45,16 @@ cd build
 ../configure --prefix="$instdir"
 $MAKE
 
-javadir=
-export javadir
-$MAKE -e install
+nukedirs='javadir='
+
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
 grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/instdir-lisp.sh b/t/instdir-lisp.sh
index 0c31b81..9760557 100644
--- a/t/instdir-lisp.sh
+++ b/t/instdir-lisp.sh
@@ -42,17 +42,16 @@ cd build
 ../configure --prefix="$instdir"
 $MAKE
 
-lispdir=
-export lispdir
+nukedirs='lispdir='
 
-$MAKE -e install
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
 grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh
index 32d8d40..0299d5a 100644
--- a/t/instdir-ltlib.sh
+++ b/t/instdir-ltlib.sh
@@ -69,20 +69,16 @@ cd build
              am_cv_python_pyexecdir="$instdir/pyexec"
 $MAKE
 
-bindir= libdir= pyexecdir=
-export bindir libdir pyexecdir
-$MAKE -e install
+nukedirs='bindir= libdir= pyexecdir='
+
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
-cat stdout
-# Creative quoting below to please maintainer-check.
-grep 'rm'' ' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
-# Creative quoting below to please maintainer-check.
-grep 'rm'' ' stdout && exit 1
+grep 'rm -f' stdout && exit 1
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/instdir-no-empty.sh b/t/instdir-no-empty.sh
index 66d76f2..03e1862 100644
--- a/t/instdir-no-empty.sh
+++ b/t/instdir-no-empty.sh
@@ -99,7 +99,7 @@ cwd=$(pwd) || fatal_ "getting current working directory"
 
 doinst ()
 {
-  $MAKE install install-pdf install-ps install-dvi ${1+"$@"}
+  run_make install install-pdf install-ps install-dvi ${1+"$@"}
 }
 
 : > foo.sh
@@ -108,14 +108,14 @@ doinst ()
 doinst
 test ! -e inst || { find inst; exit 1; }
 $MAKE uninstall
-doinst bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh'
+doinst bin_SCRIPTS=foo.sh
 test -f inst/bin/foo.sh
 
 ./configure
 doinst DESTDIR="$cwd/dest"
 test ! -e dest || { find dest; exit 1; }
 $MAKE uninstall
-doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh'
+doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh
 test -f dest/usr/local/bin/foo.sh
 
 :
diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh
index 2fa14e5..2c57157 100644
--- a/t/instdir-prog.sh
+++ b/t/instdir-prog.sh
@@ -68,20 +68,19 @@ cd build
              am_cv_python_pyexecdir="$instdir/pyexec"
 $MAKE
 
-bindir= libdir= pyexecdir=
-export bindir libdir pyexecdir
-$MAKE -e install
+nukedirs='bindir= libdir= pyexecdir='
+
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
-cat stdout
-# Creative quoting below to please maintainer-check.
-grep 'rm'' ' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout \
+  || { cat stdout; exit 1; }
 cat stdout
 # Creative quoting below to please maintainer-check.
 grep 'rm'' ' stdout && exit 1
+run_make $nukedirs uninstall DESTDIR="$destdir" > stdout \
+  || { cat stdout; exit 1; }
 
 :
diff --git a/t/instdir-python.sh b/t/instdir-python.sh
index 680f97f..e431a06 100644
--- a/t/instdir-python.sh
+++ b/t/instdir-python.sh
@@ -46,17 +46,16 @@ cd build
 ../configure --prefix="$instdir"
 $MAKE
 
-pythondir=
-export pythondir
+nukedirs='pythondir='
 
-$MAKE -e install
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
 grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/instdir-texi.sh b/t/instdir-texi.sh
index fa08e3e..5cdaddb 100644
--- a/t/instdir-texi.sh
+++ b/t/instdir-texi.sh
@@ -56,18 +56,17 @@ cd build
 $MAKE all dvi ps pdf html
 ls -l
 
-infodir= htmldir= dvidir= psdir= pdfdir=
-export infodir htmldir dvidir psdir pdfdir
+nukedirs='infodir= htmldir= dvidir= psdir= pdfdir='
 
-$MAKE -e install install-html install-dvi install-ps install-pdf
+run_make $nukedirs install install-html install-dvi install-ps install-pdf
 test ! -e "$instdir"
-$MAKE -e install install-html install-dvi install-ps install-pdf \
-         DESTDIR="$destdir"
+run_make $nukedirs install install-html install-dvi install-ps install-pdf \
+                   DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
 grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/instdir.sh b/t/instdir.sh
index 06e14ac..bd5915b 100644
--- a/t/instdir.sh
+++ b/t/instdir.sh
@@ -55,17 +55,16 @@ cd build
 ../configure --prefix="$instdir"
 $MAKE
 
-bindir= datadir= includedir= foodir= bardir= man1dir= man2dir=
-export bindir datadir includedir foodir bardir man1dir man2dir
+nukedirs='bindir= datadir= includedir= foodir= bardir= man1dir=  man2dir='
 
-$MAKE -e install
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
 grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/instdir2.sh b/t/instdir2.sh
index 834078b..78a8acc 100644
--- a/t/instdir2.sh
+++ b/t/instdir2.sh
@@ -77,17 +77,16 @@ cd build
 ../configure --prefix="$instdir"
 $MAKE
 
-bindir= datadir= includedir= foodir= bardir= man1dir= man2dir=
-export bindir datadir includedir foodir bardir man1dir man2dir
+nukedirs='bindir= datadir= includedir= foodir= bardir= man1dir=  man2dir='
 
-$MAKE -e install
+run_make $nukedirs install
 test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+run_make $nukedirs install DESTDIR="$destdir"
 test ! -e "$instdir"
 test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+run_make $nukedirs uninstall > stdout || { cat stdout; exit 1; }
 cat stdout
 grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+run_make $nukedirs uninstall DESTDIR="$destdir"
 
 :
diff --git a/t/insthook.sh b/t/insthook.sh
index 92840df..d2558e2 100644
--- a/t/insthook.sh
+++ b/t/insthook.sh
@@ -59,7 +59,7 @@ test -f ok
 ./configure "--bindir=$(pwd)/bin"
 $MAKE install
 echo b > foo
-VERSION=2.0 $MAKE -e install
+run_make VERSION=2.0 install
 test $(cat bin/foo-1.0) = a
 test $(cat bin/foo-2.0) = b
 test $(cat bin/foo)     = b
diff --git a/t/instmany-mans.sh b/t/instmany-mans.sh
index 2cb3ce9..35539dd 100644
--- a/t/instmany-mans.sh
+++ b/t/instmany-mans.sh
@@ -30,26 +30,35 @@ subdir=long_subdir_name_with_many_characters
 nfiles=81
 list=$(seq_ 1 $nfiles)
 
-sed "s|@limit@|$limit|g" >myinstall.in <<'END'
+oPATH=$PATH; export oPATH
+nPATH=$(pwd)/x-bin$PATH_SEPARATOR$PATH; export nPATH
+
+mkdir x-bin
+
+sed "s|@limit@|$limit|g" >x-bin/my-install <<'END'
 #! /bin/sh
 # Fake install script.  This doesn't really install
 # (the INSTALL path below would be wrong outside this directory).
 address@hidden@
-INSTALL='@INSTALL@'
-len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
+PATH=$oPATH; export PATH
+if test -z "$orig_INSTALL"; then
+  echo "$0: \$orig_INSTALL variable not set" >&2
+  exit 1
+fi
+len=`expr "$orig_INSTALL $*" : ".*" 2>/dev/null || echo $limit`
 if test $len -ge $limit; then
   echo "$0: safe command line limit of $limit characters exceeded" >&2
   exit 1
 fi
-exit 0
+exec $orig_INSTALL "$@"
+exit 1
 END
 
 # Creative quoting in the next line to please maintainer-check.
-sed "s|@limit@|$limit|g" >'rm' <<'END'
+sed "s|@limit@|$limit|g" >x-bin/'rm' <<'END'
 #! /bin/sh
 address@hidden@
-PATH=$save_PATH
-export PATH
+PATH=$oPATH; export PATH
 RM='rm -f'
 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
 if test $len -ge $limit; then
@@ -60,10 +69,14 @@ exec $RM "$@"
 exit 1
 END
 
-chmod +x rm
+chmod +x x-bin/rm x-bin/my-install
+
+cat > setenv.in <<'END'
+orig_INSTALL='@INSTALL@'; export orig_INSTALL
+END
 
 cat >>configure.ac <<END
-AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
+AC_CONFIG_FILES([setenv.sh:setenv.in])
 AC_CONFIG_FILES([$subdir/Makefile])
 AC_OUTPUT
 END
@@ -104,17 +117,24 @@ instdir=$(pwd)/inst
 mkdir build
 cd build
 ../configure --prefix="$instdir"
+. ./setenv.sh
+test -n "$orig_INSTALL"
 $MAKE
 # Try whether native install (or install-sh) works.
 $MAKE install
+test -f "$instdir/share/man/man1/page1.1"
 # Multiple uninstall should work, too.
 $MAKE uninstall
 $MAKE uninstall
 test $(find "$instdir" -type f -print | wc -l) -eq 0
 
 # Try whether we don't exceed the low limit.
-INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
-env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
+PATH=$nPATH; export PATH
+run_make INSTALL=my-install install
+test -f "$instdir/share/man/man1/page1.1"
+run_make INSTALL=my-install uninstall
+test $(find "$instdir" -type f -print | wc -l) -eq 0
+PATH=$oPATH; export PATH
 
 cd $subdir
 srcdir=../../$subdir
diff --git a/t/instmany-python.sh b/t/instmany-python.sh
index ee8b94e..eea5dc4 100644
--- a/t/instmany-python.sh
+++ b/t/instmany-python.sh
@@ -26,26 +26,35 @@ subdir=long_subdir_name_with_many_characters
 nfiles=81
 list=$(seq_ 1 $nfiles)
 
-sed "s|@limit@|$limit|g" >myinstall.in <<'END'
+oPATH=$PATH; export oPATH
+nPATH=$(pwd)/x-bin$PATH_SEPARATOR$PATH; export nPATH
+
+mkdir x-bin
+
+sed "s|@limit@|$limit|g" >x-bin/my-install <<'END'
 #! /bin/sh
 # Fake install script.  This doesn't really install
 # (the INSTALL path below would be wrong outside this directory).
 address@hidden@
-INSTALL='@INSTALL@'
-len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
+PATH=$oPATH; export PATH
+if test -z "$orig_INSTALL"; then
+  echo "$0: \$orig_INSTALL variable not set" >&2
+  exit 1
+fi
+len=`expr "$orig_INSTALL $*" : ".*" 2>/dev/null || echo $limit`
 if test $len -ge $limit; then
   echo "$0: safe command line limit of $limit characters exceeded" >&2
   exit 1
 fi
-exit 0
+exec $orig_INSTALL "$@"
+exit 1
 END
 
 # Creative quoting in the next line to please maintainer-check.
-sed "s|@limit@|$limit|g" >'rm' <<'END'
+sed "s|@limit@|$limit|g" >x-bin/'rm' <<'END'
 #! /bin/sh
 address@hidden@
-PATH=$save_PATH
-export PATH
+PATH=$oPATH; export PATH
 RM='rm -f'
 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
 if test $len -ge $limit; then
@@ -56,11 +65,15 @@ exec $RM "$@"
 exit 1
 END
 
-chmod +x rm
+chmod +x x-bin/rm x-bin/my-install
+
+cat > setenv.in <<'END'
+orig_INSTALL='@INSTALL@'; export orig_INSTALL
+END
 
 cat >>configure.ac <<END
 AM_PATH_PYTHON
-AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
+AC_CONFIG_FILES([setenv.sh:setenv.in])
 AC_CONFIG_FILES([$subdir/Makefile])
 AC_OUTPUT
 END
@@ -95,17 +108,24 @@ instdir=$(pwd)/inst
 mkdir build
 cd build
 ../configure --prefix="$instdir"
+. ./setenv.sh
+test -n "$orig_INSTALL"
 $MAKE
 # Try whether native install (or install-sh) works.
 $MAKE install
+test -n "$(find "$instdir" -name python1.py)"
 # Multiple uninstall should work, too.
 $MAKE uninstall
 $MAKE uninstall
 test $(find "$instdir" -type f -print | wc -l) -eq 0
 
 # Try whether we don't exceed the low limit.
-INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
-env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
+PATH=$nPATH; export PATH
+run_make INSTALL=my-install install
+test -n "$(find "$instdir" -name python1.py)"
+run_make INSTALL=my-install uninstall
+test $(find "$instdir" -type f -print | wc -l) -eq 0
+PATH=$oPATH; export PATH
 
 cd $subdir
 srcdir=../../$subdir
diff --git a/t/instmany.sh b/t/instmany.sh
index 62697c5..357b59c 100644
--- a/t/instmany.sh
+++ b/t/instmany.sh
@@ -38,26 +38,35 @@ subdir=long_subdir_name_with_many_characters
 nfiles=81
 list=$(seq_ 1 $nfiles)
 
-sed "s|@limit@|$limit|g" >myinstall.in <<'END'
+oPATH=$PATH; export oPATH
+nPATH=$(pwd)/x-bin$PATH_SEPARATOR$PATH; export nPATH
+
+mkdir x-bin
+
+sed "s|@limit@|$limit|g" >x-bin/my-install <<'END'
 #! /bin/sh
 # Fake install script.  This doesn't really install
 # (the INSTALL path below would be wrong outside this directory).
 address@hidden@
-INSTALL='@INSTALL@'
-len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
+PATH=$oPATH; export PATH
+if test -z "$orig_INSTALL"; then
+  echo "$0: \$orig_INSTALL variable not set" >&2
+  exit 1
+fi
+len=`expr "$orig_INSTALL $*" : ".*" 2>/dev/null || echo $limit`
 if test $len -ge $limit; then
   echo "$0: safe command line limit of $limit characters exceeded" >&2
   exit 1
 fi
-exit 0
+exec $orig_INSTALL "$@"
+exit 1
 END
 
 # Creative quoting in the next line to please maintainer-check.
-sed "s|@limit@|$limit|g" >'rm' <<'END'
+sed "s|@limit@|$limit|g" >x-bin/'rm' <<'END'
 #! /bin/sh
 address@hidden@
-PATH=$save_PATH
-export PATH
+PATH=$oPATH; export PATH
 RM='rm -f'
 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
 if test $len -ge $limit; then
@@ -68,10 +77,14 @@ exec $RM "$@"
 exit 1
 END
 
-chmod +x rm
+chmod +x x-bin/rm x-bin/my-install
+
+cat > setenv.in <<'END'
+orig_INSTALL='@INSTALL@'; export orig_INSTALL
+END
 
 cat >>configure.ac <<END
-AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
+AC_CONFIG_FILES([setenv.sh:setenv.in])
 AC_CONFIG_FILES([$subdir/Makefile])
 AC_OUTPUT
 END
@@ -118,17 +131,24 @@ instdir=$(pwd)/inst
 mkdir build
 cd build
 ../configure --prefix="$instdir"
+. ./setenv.sh
+test -n "$orig_INSTALL"
 $MAKE
 # Try whether native install (or install-sh) works.
 $MAKE install
+test -f "$instdir/bin/script1"
 # Multiple uninstall should work, too.
 $MAKE uninstall
 $MAKE uninstall
 test $(find "$instdir" -type f -print | wc -l) -eq 0
 
 # Try whether we don't exceed the low limit.
-INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
-env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
+PATH=$nPATH; export PATH
+run_make INSTALL=my-install install
+test -f "$instdir/bin/script1"
+run_make INSTALL=my-install uninstall
+test $(find "$instdir" -type f -print | wc -l) -eq 0
+PATH=$oPATH; export PATH
 
 cd $subdir
 srcdir=../../$subdir
diff --git a/t/instspc.tap b/t/instspc.tap
index 5ca2b92..8266356 100644
--- a/t/instspc.tap
+++ b/t/instspc.tap
@@ -308,7 +308,7 @@ for test_name in $test_names_list; do
     r=ok
     ../configure --prefix "/$test_string-prefix" \
       && $MAKE all \
-      && DESTDIR="$dest" file="./$test_string" $MAKE -e test-inst \
+      && DESTDIR="$dest" file="./$test_string" $MAKE test-inst \
       || r='not ok'
 
     description="$test_name in ${where}dir"
diff --git a/t/javaflags.sh b/t/javaflags.sh
index bb9ab26..ec405d6 100644
--- a/t/javaflags.sh
+++ b/t/javaflags.sh
@@ -50,7 +50,7 @@ grep '\$(JAVACFLAGS).*\$(AM_JAVACFLAGS)' Makefile.in && exit 1
 
 $AUTOCONF
 ./configure
-env JAVACFLAGS=__user_flags__ $MAKE -e
+run_make JAVACFLAGS=__user_flags__
 
 ls -l
 
diff --git a/t/lflags.sh b/t/lflags.sh
index 18268b1..ce6ccc8 100644
--- a/t/lflags.sh
+++ b/t/lflags.sh
@@ -62,7 +62,7 @@ grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
 
 $AUTOCONF
 ./configure
-env LFLAGS=__user_flags__ $MAKE -e foo.c bar-bar.c
+run_make LFLAGS=__user_flags__ foo.c bar-bar.c
 
 cat foo.c
 cat bar-bar.c
diff --git a/t/lflags2.sh b/t/lflags2.sh
index a959aea..d21afad 100644
--- a/t/lflags2.sh
+++ b/t/lflags2.sh
@@ -61,7 +61,7 @@ grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
 
 $AUTOCONF
 ./configure
-env LFLAGS=__user_flags__ $MAKE -e foo.cc bar-bar.c++
+run_make LFLAGS=__user_flags__ foo.cc bar-bar.c++
 
 cat foo.cc
 cat bar-bar.c++
diff --git a/t/libtool9.sh b/t/libtool9.sh
index 26eb5f1..9ab4d97 100644
--- a/t/libtool9.sh
+++ b/t/libtool9.sh
@@ -85,9 +85,14 @@ $AUTOCONF
 $AUTOMAKE --add-missing --copy
 
 ./configure
-env LDFLAGS=ldflags AM_LDFLAGS=am_ldflags libmod1_la_LDFLAGS=lm1_la_ldflags \
-    CFLAGS=cflags AM_CFLAGS=am_cflags prg2_CFLAGS=prg2_cflags \
-    $MAKE -e print >output 2>&1 || { cat output; exit 1; }
+run_make \
+  LDFLAGS=ldflags \
+  AM_LDFLAGS=am_ldflags \
+  libmod1_la_LDFLAGS=lm1_la_ldflags \
+  CFLAGS=cflags \
+  AM_CFLAGS=am_cflags \
+  prg2_CFLAGS=prg2_cflags \
+  print >output 2>&1 || { cat output; exit 1; }
 cat output
 grep '1BEG: libmod1.la mod2.la :END1' output
 grep '2BEG: mod2.la :END2' output
diff --git a/t/link_cond.sh b/t/link_cond.sh
index 43f06d8..98b523b 100644
--- a/t/link_cond.sh
+++ b/t/link_cond.sh
@@ -60,11 +60,11 @@ main ()
 END
 
 ./configure have_cxx=no
-CXX=false $MAKE -e
+run_make CXX=false
 
 # Sanity check.
 rm -f foo foo.exe
-CC=false $MAKE -e && exit 99
+run_make CC=false && exit 99
 
 $MAKE distclean
 
@@ -79,10 +79,10 @@ int main (void)
 END
 
 ./configure have_cxx=yes
-CC=false $MAKE -e
+run_make CC=false
 
 # Sanity check.
 rm -f foo foo.exe
-CXX=false $MAKE -e && exit 99
+run_make CXX=false && exit 99
 
 :
diff --git a/t/lisp-flags.sh b/t/lisp-flags.sh
index a31bcfd..ee156d7 100644
--- a/t/lisp-flags.sh
+++ b/t/lisp-flags.sh
@@ -18,10 +18,6 @@
 
 . test-init.sh
 
-# Don't get fooled when running as an Emacs subprocess.  This is
-# for the benefit of the "make -e" invocation below.
-unset EMACS
-
 cat > Makefile.am << 'EOF'
 lisp_LISP = foo.el
 AM_ELCFLAGS = __am_elcflags__
@@ -39,7 +35,7 @@ $AUTOMAKE --add-missing
 ./configure EMACS='echo >$@' --with-lispdir="$(pwd)/unused"
 
 : > foo.el
-ELCFLAGS='__usr_elcflags__' $MAKE -e
+run_make ELCFLAGS='__usr_elcflags__'
 grep '__am_elcflags__.*__usr_elcflags__' foo.elc
 
 :
diff --git a/t/man3.sh b/t/man3.sh
index 24a2392..31c2832 100644
--- a/t/man3.sh
+++ b/t/man3.sh
@@ -39,6 +39,6 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 ./configure
-DISTCHECK_CONFIGURE_FLAGS=foo=bar $MAKE -e distcheck
+run_make DISTCHECK_CONFIGURE_FLAGS='foo=bar' distcheck
 
 :
diff --git a/t/mmodely.sh b/t/mmodely.sh
index cb3152d..42f8ca4 100644
--- a/t/mmodely.sh
+++ b/t/mmodely.sh
@@ -87,8 +87,7 @@ PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH
 # per GNU Standard.
 $MAKE maintainer-clean
 ./configure
-YACC="myyacc.sh" LEX="mylex.sh" \
-   LEX_OUTPUT_ROOT='lex.yy' $MAKE -e zardoz.c joe.c
+run_make YACC=myyacc.sh LEX=mylex.sh LEX_OUTPUT_ROOT=lex.yy zardoz.c joe.c
 $FGREP zardoz.y zardoz.c
 $FGREP joe.l joe.c
 
diff --git a/t/parallel-tests-basics.sh b/t/parallel-tests-basics.sh
index d86e054..4d0fe95 100644
--- a/t/parallel-tests-basics.sh
+++ b/t/parallel-tests-basics.sh
@@ -87,7 +87,7 @@ test ! -e test-suite.log
 # Note that this usage has a problem: the summary will only
 # take bar.log into account, because the $(TEST_SUITE_LOG) rule
 # does not "see" baz.log.  Hmm.
-env TESTS='bar.test' $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS='bar.test' check >stdout && { cat stdout; exit 1; }
 cat stdout
 grep '^FAIL: baz\.test$' stdout
 grep '^ERROR: bar\.test$' stdout
@@ -103,7 +103,7 @@ test -f test-suite.log
 # Note that the previous test and this one taken together expose the timing
 # issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
 # before running the tests lazily.
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check > stdout && { cat stdout; exit 1; }
 cat stdout
 test -f foo.log
 grep '^PASS: foo\.test$' stdout
@@ -115,7 +115,7 @@ grep '^# ERROR: *1$' stdout
 
 # Now, explicitly retry with all test logs already updated, and ensure
 # that the summary is still displayed.
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep foo.test stdout && exit 1
 grep bar.test stdout && exit 1
@@ -125,7 +125,7 @@ grep '^# FAIL: *1$' stdout
 grep '^# ERROR: *1$' stdout
 
 # Lazily rerunning only foo should only rerun this one test.
-env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS=foo.log check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep foo.test stdout
 grep bar.test stdout && exit 1
@@ -135,14 +135,14 @@ grep '^# FAIL: *1$' stdout
 grep '^# ERROR: *1$' stdout
 
 $MAKE clean
-env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make TEST_LOGS=baz.log check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep foo.test stdout && exit 1
 grep bar.test stdout && exit 1
 grep baz.test stdout
 
 $MAKE clean
-env TESTS=baz.test $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make TESTS=baz.test check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep foo.test stdout && exit 1
 grep bar.test stdout && exit 1
diff --git a/t/parallel-tests-cmdline-override.sh 
b/t/parallel-tests-cmdline-override.sh
index ab27784..ef78c26 100644
--- a/t/parallel-tests-cmdline-override.sh
+++ b/t/parallel-tests-cmdline-override.sh
@@ -60,7 +60,7 @@ END
 
 do_check ()
 {
-  env "$@" $MAKE -e check >stdout || { cat stdout; exit 1; }
+  run_make "$@" check >stdout || { cat stdout; exit 1; }
   cat stdout
   grep '^PASS:' stdout | LC_ALL=C sort > got-out
   cat got-out
diff --git a/t/parallel-tests-empty-testlogs.sh 
b/t/parallel-tests-empty-testlogs.sh
index 995b831..95b3657 100644
--- a/t/parallel-tests-empty-testlogs.sh
+++ b/t/parallel-tests-empty-testlogs.sh
@@ -80,9 +80,9 @@ for vpath in : false; do
   VERBOSE=yes $MAKE check
   no_test_has_run
   cd ../sub2
-  VERBOSE=yes TESTS='' $MAKE -e check
+  run_make VERBOSE=yes TESTS= check
   no_test_has_run
-  VERBOSE=yes TEST_LOGS='' $MAKE -e check
+  run_make VERBOSE=yes TEST_LOGS= check
   no_test_has_run
   cd ..
   $MAKE check
diff --git a/t/parallel-tests-exit-statuses.sh 
b/t/parallel-tests-exit-statuses.sh
index d77c3b4..8612004 100644
--- a/t/parallel-tests-exit-statuses.sh
+++ b/t/parallel-tests-exit-statuses.sh
@@ -62,40 +62,33 @@ $AUTOMAKE -a
   for st in $failure_statuses; do
     echo "FAIL: $st"
   done
-} | LC_ALL=C sort > exp-fail
+} | LC_ALL=C sort > exp-0
 
-sed 's/^FAIL:/XFAIL:/' exp-fail | LC_ALL=C sort > exp-xfail-1
-sed '/^ERROR:/d' exp-xfail-1 > exp-xfail-2
+sed 's/^FAIL:/XFAIL:/' exp-0 | LC_ALL=C sort > exp-1
+sed '/^ERROR:/d' exp-1 > exp-2
 
-sort exp-fail
-sort exp-xfail-1
-sort exp-xfail-2
+sort exp-0
+sort exp-1
+sort exp-2
 
 ./configure
 
-st=1
-$MAKE check >stdout && st=0
-cat stdout
-cat test-suite.log
-test $st -gt 0 || exit 1
-LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-fail
-diff exp-fail got-fail
-
-st=1
-XFAIL_TESTS="$failure_statuses 99" $MAKE -e check >stdout && st=0
-cat stdout
-cat test-suite.log
-test $st -gt 0 || exit 1
-LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-1
-diff exp-xfail-1 got-xfail-1
+mk_ ()
+{
+  n=$1; shift
+  unset am_make_rc_got
+  run_make -e IGNORE ${1+"$@"} check > stdout
+  cat stdout
+  cat test-suite.log
+  LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-$n
+  diff exp-$n got-$n
+}
 
-st=0
-XFAIL_TESTS="$failure_statuses" TESTS="0 77 $failure_statuses" \
-  $MAKE -e check >stdout || st=$?
-cat stdout
-cat test-suite.log
-test $st -eq 0 || exit 1
-LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-2
-diff exp-xfail-2 got-xfail-2
+mk_ 0
+test $am_make_rc_got -gt 0
+mk_ 1 XFAIL_TESTS="$failure_statuses 99"
+test $am_make_rc_got -gt 0
+mk_ 2 XFAIL_TESTS="$failure_statuses" TESTS="0 77 $failure_statuses"
+test $am_make_rc_got -eq 0
 
 :
diff --git a/t/parallel-tests-extra-programs.sh 
b/t/parallel-tests-extra-programs.sh
index 73e2fda..b8d7a99 100644
--- a/t/parallel-tests-extra-programs.sh
+++ b/t/parallel-tests-extra-programs.sh
@@ -158,11 +158,10 @@ $sleep
 
 echo 'int main (void) { return 0; }' > none.c
 
-st=0
-RECHECK_LOGS= $MAKE -e check >stdout || st=$?
+run_make -e IGNORE RECHECK_LOGS= check >stdout
 cat stdout
-ls -l
-test $st -eq 0 || exit 1
+ls -l # For debugging.
+test $am_make_rc_got -eq 0 || exit 1
 
 # For debugging.
 stat stamp foo.log bar.log baz.log || :
diff --git a/t/parallel-tests-fork-bomb.sh b/t/parallel-tests-fork-bomb.sh
index 215294b..e63c0d7 100644
--- a/t/parallel-tests-fork-bomb.sh
+++ b/t/parallel-tests-fork-bomb.sh
@@ -100,7 +100,7 @@ do_check ()
 {
   st=0
   log=$1; shift
-  env "$@" $MAKE -e check >output 2>&1 || st=$?
+  run_make "$@" check >output 2>&1 || st=$?
   cat output
   $FGREP '::OOPS::' output && exit 1 # Possible infinite recursion.
   # Check that at least we don't create a botched global log file.
diff --git a/t/parallel-tests-harderror.sh b/t/parallel-tests-harderror.sh
index 3563cfe..26832a6 100644
--- a/t/parallel-tests-harderror.sh
+++ b/t/parallel-tests-harderror.sh
@@ -64,13 +64,12 @@ DISABLE_HARD_ERRORS=x $MAKE check
 # But an empty values for DISABLE_HARD_ERRORS means that hard errors
 # are not to be counted like normal failures.
 
-$MAKE check DISABLE_HARD_ERRORS='' && exit 1
+$MAKE check DISABLE_HARD_ERRORS= && exit 1
 cat test-suite.log
 grep '^ERROR: foo$' test-suite.log
 
 cd sub
-# The '-e' is wanted here.
-DISABLE_HARD_ERRORS='' $MAKE -e check && exit 1
+$MAKE check DISABLE_HARD_ERRORS= && exit 1
 cat test-suite.log
 grep '^ERROR: bar$' test-suite.log
 cd ..
diff --git a/t/parallel-tests-log-compiler-1.sh 
b/t/parallel-tests-log-compiler-1.sh
index 6434ae9..fd1f1c6 100644
--- a/t/parallel-tests-log-compiler-1.sh
+++ b/t/parallel-tests-log-compiler-1.sh
@@ -111,7 +111,7 @@ test -f bla.log
 test -f bli.suff.log
 test -f sub/test.log
 
-T_LOG_FLAGS=--bad $MAKE -e check && exit 1
+run_make -e FAIL T_LOG_FLAGS=--bad check
 cat test-suite.log
 cat bla.log
 # With the above flag overridden, bla.t should fail ...
diff --git a/t/parallel-tests-log-override-1.sh 
b/t/parallel-tests-log-override-1.sh
index 46520b6..49fba56 100644
--- a/t/parallel-tests-log-override-1.sh
+++ b/t/parallel-tests-log-override-1.sh
@@ -76,19 +76,19 @@ $MAKE clean
 test -f test-suite.log && exit 99 # Sanity check.
 
 # Check that we can override the testsuite log file at runtime.
-TEST_SUITE_LOG=zardoz.log $MAKE -e check
+run_make TEST_SUITE_LOG=zardoz.log check
 ls -l
 test ! -e test-suite.log
 cat zardoz.log
 test_log_expected zardoz.log
 # Sanity check the distribution too (this also does minimal checks on
 # VPATH support).
-TEST_SUITE_LOG=zardoz.log $MAKE -e distcheck
+run_make TEST_SUITE_LOG=zardoz.log distcheck
 
 # Check that cleanup rules remove the correct file even when
 # user overrides are in place.
 cp orig test-suite.log
-TEST_SUITE_LOG=zardoz.log $MAKE -e clean
+run_make TEST_SUITE_LOG=zardoz.log clean
 ls -l
 test ! -e zardoz.log
 diff orig test-suite.log
@@ -97,11 +97,11 @@ diff orig test-suite.log
 # Also check that the testsuite log file doesn't need to be named
 # accordingly to the '*.log' pattern.
 chmod a-w test-suite.log
-TEST_SUITE_LOG=TheLogFile $MAKE -e check
+run_make TEST_SUITE_LOG=TheLogFile check
 ls -l
 diff orig test-suite.log
 test_log_expected TheLogFile
-TEST_SUITE_LOG=TheLogFile $MAKE -e clean
+run_make TEST_SUITE_LOG=TheLogFile clean
 ls -l
 test ! -e TheLogFile
 diff orig test-suite.log
diff --git a/t/parallel-tests-log-override-2.sh 
b/t/parallel-tests-log-override-2.sh
index 8accc7b..54e2ed9 100644
--- a/t/parallel-tests-log-override-2.sh
+++ b/t/parallel-tests-log-override-2.sh
@@ -60,8 +60,8 @@ for test_list_override in \
   'TESTS=pass.test skip.test' \
   'TEST_LOGS=pass.log skip.log'
 do
-  env TEST_SUITE_LOG=partial.log "$test_list_override" \
-    $MAKE -e check >stdout || { cat stdout; exit 1; }
+  run_make TEST_SUITE_LOG=partial.log "$test_list_override" check >stdout \
+    || { cat stdout; exit 1; }
   cat stdout
   ls -l
   count_test_results total=2 pass=1 fail=0 skip=1 xfail=0 xpass=0 error=0
diff --git a/t/parallel-tests-log-override-recheck.sh 
b/t/parallel-tests-log-override-recheck.sh
index d1fec7f..ff6f582 100644
--- a/t/parallel-tests-log-override-recheck.sh
+++ b/t/parallel-tests-log-override-recheck.sh
@@ -67,7 +67,7 @@ cat stdout
 using_gmake || $sleep # Required by BSD make.
 
 chmod a-rw test-suite.log
-TEST_SUITE_LOG=my.log $MAKE -e recheck >stdout \
+run_make TEST_SUITE_LOG=my.log recheck >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 ls -l
@@ -82,7 +82,7 @@ done
 using_gmake || $sleep # Required by BSD make.
 
 chmod a-rw my.log
-BAZ_EXIT_STATUS=0 TEST_SUITE_LOG=my2.log $MAKE -e recheck >stdout \
+run_make BAZ_EXIT_STATUS=0 TEST_SUITE_LOG=my2.log recheck >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 ls -l
diff --git a/t/parallel-tests-no-color-in-log.sh 
b/t/parallel-tests-no-color-in-log.sh
index b8a5681..9665016 100644
--- a/t/parallel-tests-no-color-in-log.sh
+++ b/t/parallel-tests-no-color-in-log.sh
@@ -45,7 +45,7 @@ $AUTOMAKE --add-missing
 
 ./configure
 mv config.log config-log # Avoid possible false positives below.
-AM_COLOR_TESTS=always $MAKE -e check && exit 1
+run_make -e FAIL AM_COLOR_TESTS=always check
 # Not a useless use of cat; see above comments "grep-nonprinting"
 # requirement in 'test-init.sh'.
 cat *.log | grep "$esc" && exit 1
diff --git a/t/parallel-tests-recheck-pr11791.sh 
b/t/parallel-tests-recheck-pr11791.sh
index ac3a389..d0629f6 100644
--- a/t/parallel-tests-recheck-pr11791.sh
+++ b/t/parallel-tests-recheck-pr11791.sh
@@ -14,8 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# parallel-tests: "make recheck" "make -k recheck" in the face of build
-# failures for the test cases.  See automake bug#11791.
+# parallel-tests: "make recheck" and "make -k recheck" in the face of
+# build failures for the test cases.  See automake bug#11791.
 
 required='cc native'
 . test-init.sh
@@ -42,6 +42,7 @@ $MAKE check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
 
+$sleep # Required to avoid a spurious failure with some FreeBSD makes.
 st=0; $MAKE -k recheck >stdout || st=$?
 cat stdout
 # Don't trust the exit status of "make -k" for non-GNU makes.
@@ -61,6 +62,7 @@ $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
 test -f foo.log
 test -f foo.trs
 
+$sleep # Required to avoid a spurious failure with some FreeBSD makes.
 st=0; $MAKE -k recheck >stdout || st=$?
 cat stdout
 # Don't trust the exit status of "make -k" for non-GNU makes.
diff --git a/t/remake-subdir-long-time.sh b/t/remake-subdir-long-time.sh
index 1cbd02e..cf03335 100644
--- a/t/remake-subdir-long-time.sh
+++ b/t/remake-subdir-long-time.sh
@@ -93,14 +93,14 @@ rm -f automake-has-run aclocal-has-run
 
 ./configure
 # Sanity check: Makefile doesn't get updated uselessly.
-ACLOCAL=false AUTOMAKE=false AUTOCONF=false $MAKE -e
+run_make ACLOCAL=false AUTOMAKE=false AUTOCONF=false
 
 $sleep
 sed "s|magic|magic2|" configure.ac > t
 mv -f t configure.ac
 
 cd sub
-AUTOMAKE="$AUTOMAKE" ACLOCAL="$ACLOCAL" $MAKE -e Makefile
+run_make Makefile AUTOMAKE="$AUTOMAKE" ACLOCAL="$ACLOCAL"
 cd ..
 
 # For debugging.
diff --git a/t/remake-timing-bug-pr8365.sh b/t/remake-timing-bug-pr8365.sh
index 662b174..5060fd6 100644
--- a/t/remake-timing-bug-pr8365.sh
+++ b/t/remake-timing-bug-pr8365.sh
@@ -98,9 +98,8 @@ END
 
 chmod a+x aclocal-wrap automake-wrap autoconf-wrap
 
-env \
-  ACLOCAL=./aclocal-wrap AUTOMAKE=./automake-wrap AUTOCONF=./autoconf-wrap \
-  $MAKE -e Makefile
+run_make Makefile \
+  ACLOCAL=./aclocal-wrap AUTOMAKE=./automake-wrap AUTOCONF=./autoconf-wrap
 grep '^FOOBAR =' Makefile.in
 grep '^FOOBAR *= *zardoz *$' Makefile
 
diff --git a/t/subst-no-trailing-empty-line.sh 
b/t/subst-no-trailing-empty-line.sh
index 860b427..3fcb1b7 100644
--- a/t/subst-no-trailing-empty-line.sh
+++ b/t/subst-no-trailing-empty-line.sh
@@ -82,13 +82,13 @@ test $($EGREP -c "^[ address@hidden@ @address@hidden 
$tab]*$bs?$" Makefile.in) -eq 3
 cat t-programs
 grep '^ *$' t-programs && exit 1
 
-$MAKE print-programs >stdout || { cat stdout; exit 1; }
+run_make print-programs >stdout || { cat stdout; exit 1; }
 cat stdout
 grep '^BEG1: x :END1$' stdout
 grep '^BEG2: :END2$' stdout
 grep '^BEG3: zardoz x :END3$' stdout
 
-am__empty=X $MAKE -e print-programs >stdout || { cat stdout; exit 1; }
+run_make am__empty=X print-programs >stdout || { cat stdout; exit 1; }
 cat stdout
 grep '^BEG1: x X :END1$' stdout
 grep '^BEG2: X :END2$' stdout
diff --git a/t/suffix-custom-subobj.sh b/t/suffix-custom-subobj.sh
index 04d4350..6c01229 100644
--- a/t/suffix-custom-subobj.sh
+++ b/t/suffix-custom-subobj.sh
@@ -53,7 +53,7 @@ $AUTOMAKE -a
 
 ./configure
 
-OBJEXT=quux $MAKE -e test-fake
+run_make OBJEXT=quux test-fake
 $MAKE test-real
 
 :
diff --git a/t/suffix11.tap b/t/suffix11.tap
index 60d193b..5ee21af 100644
--- a/t/suffix11.tap
+++ b/t/suffix11.tap
@@ -68,7 +68,7 @@ command_ok_ "warn about unportable make usage" \
 command_ok_ "automake" $AUTOMAKE -a -Wno-portability
 
 command_ok_ "configure"  ./configure
-command_ok_ "make test-fake" env OBJEXT=foo $MAKE -e test-fake
+command_ok_ "make test-fake" run_make OBJEXT=foo test-fake
 command_ok_ "make test-real" $MAKE test-real
 
 directive=''; make_can_chain_suffix_rules || directive=TODO
diff --git a/t/suffix6c.sh b/t/suffix6c.sh
index 00c6da3..319b649 100644
--- a/t/suffix6c.sh
+++ b/t/suffix6c.sh
@@ -70,7 +70,7 @@ cat > foo.exp <<'END'
 %TWO%
 END
 echo %TWO% > foo.zoo
-OBJEXT=o $MAKE -e
+run_make OBJEXT=o
 cat foo.o
 cat foo.XxX
 diff foo.XxX foo.exp
@@ -82,7 +82,7 @@ cat > foo.exp <<'END'
 %THREE%
 END
 echo %THREE% > foo.zoo
-OBJEXT=obj $MAKE -e
+run_make OBJEXT=obj
 cat foo.obj
 cat foo.XxX
 diff foo.XxX foo.exp
diff --git a/t/suffix8.tap b/t/suffix8.tap
index 7da543f..12df48b 100644
--- a/t/suffix8.tap
+++ b/t/suffix8.tap
@@ -91,7 +91,7 @@ command_ok_ "aclocal"    $ACLOCAL
 command_ok_ "autoconf"   $AUTOCONF
 command_ok_ "automake"   $AUTOMAKE -a
 command_ok_ "configure"  protect_output ./configure
-command_ok_ "make test0" env OBJEXT=foo $MAKE -e test0
+command_ok_ "make test0" run_make OBJEXT=foo test0
 command_ok_ "make test1" $MAKE test1
 
 directive=''; make_can_chain_suffix_rules || directive=TODO
diff --git a/t/tap-autonumber.sh b/t/tap-autonumber.sh
index dbefb86..f1820ce 100644
--- a/t/tap-autonumber.sh
+++ b/t/tap-autonumber.sh
@@ -44,7 +44,7 @@ not ok
 ok
 END
 
-TESTS=all.test $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS=all.test check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=14 pass=6 fail=5 xpass=1 xfail=1 skip=1 error=0
 
diff --git a/t/tap-bailout-leading-space.sh b/t/tap-bailout-leading-space.sh
index fda4b36..c84c612 100644
--- a/t/tap-bailout-leading-space.sh
+++ b/t/tap-bailout-leading-space.sh
@@ -50,7 +50,7 @@ ERROR: b.test - Bail out!
 ERROR: c.test - Bail out! FUBAR!
 END
 
-TESTS='a.test b.test c.test' $MAKE -e check >stdout \
+run_make TESTS='a.test b.test c.test' check >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-bailout-suppress-later-errors.sh 
b/t/tap-bailout-suppress-later-errors.sh
index 936f71f..7f60294 100644
--- a/t/tap-bailout-suppress-later-errors.sh
+++ b/t/tap-bailout-suppress-later-errors.sh
@@ -52,7 +52,7 @@ ok 2
 ok 3
 END
 
-TESTS='foo.test bar.test baz.test' $MAKE -e check >stdout \
+run_make TESTS='foo.test bar.test baz.test' check >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-bailout.sh b/t/tap-bailout.sh
index 635b776..b6c0f56 100644
--- a/t/tap-bailout.sh
+++ b/t/tap-bailout.sh
@@ -118,7 +118,7 @@ echo "ERROR: e.test - Bail out!" >> exp
 # Doing the sums above, we have:
 test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5'
 
-TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+run_make TESTS='a.test b.test c.test d.test e.test' check >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-basic.sh b/t/tap-basic.sh
index 680d18d..5e4462b 100644
--- a/t/tap-basic.sh
+++ b/t/tap-basic.sh
@@ -127,7 +127,7 @@ Bail out!
 ok 1
 END
 
-TESTS=bail.test $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make check TESTS=bail.test >stdout && { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
@@ -146,7 +146,7 @@ $FGREP 'success.test' stdout && exit 1
 
 rm -f *.log *.test
 
-TEST_LOGS=ok.log $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make check TEST_LOGS=ok.log >stdout || { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
diff --git a/t/tap-color.sh b/t/tap-color.sh
index ca2ee17..997cb79 100644
--- a/t/tap-color.sh
+++ b/t/tap-color.sh
@@ -152,13 +152,13 @@ test_no_color ()
 
 # Forced colorization should take place also with non-ANSI terminals;
 # hence the "TERM=dumb" definition.
-TERM=dumb AM_COLOR_TESTS=always $MAKE check >stdout \
-  && { cat stdout; exit 1; }
+AM_COLOR_TESTS=always; export AM_COLOR_TESTS
+run_make TERM=dumb check >stdout && { cat stdout; exit 1; }
 cat stdout
 test_color
 
-TERM=ansi $MAKE -e check >stdout \
-  && { cat stdout; exit 1; }
+unset AM_COLOR_TESTS
+run_make TERM=ansi check >stdout && { cat stdout; exit 1; }
 cat stdout
 test_no_color
 
diff --git a/t/tap-diagnostic.sh b/t/tap-diagnostic.sh
index 7834f61..59b1bda 100644
--- a/t/tap-diagnostic.sh
+++ b/t/tap-diagnostic.sh
@@ -66,7 +66,7 @@ cat got
 diff exp got
 count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
 
-TEST_LOG_DRIVER_FLAGS="--no-comments" $MAKE -e check >stdout \
+run_make TEST_LOG_DRIVER_FLAGS="--no-comments" check >stdout \
   || { cat stdout; exit 1; }
 cat stdout
 $EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1
diff --git a/t/tap-doc2.sh b/t/tap-doc2.sh
index 0d4bf14..55c734b 100644
--- a/t/tap-doc2.sh
+++ b/t/tap-doc2.sh
@@ -106,10 +106,10 @@ diff exp got
 
 grep '^Please report to address@hidden' stdout
 
-env \
+run_make >stdout check \
   TESTS='foo.test baz.test' \
   TEST_LOG_DRIVER_FLAGS='--comments --ignore-exit' \
-  $MAKE -e check >stdout || { cat stdout; exit 1; }
+  || { cat stdout; exit 1; }
 
 cat > exp <<'END'
 PASS: foo.test 1 - Swallows fly
diff --git a/t/tap-global-log.sh b/t/tap-global-log.sh
index fc4a8fb..b303b4a 100644
--- a/t/tap-global-log.sh
+++ b/t/tap-global-log.sh
@@ -101,8 +101,7 @@ cat > skipall.test << 'END'
 1..0 # SKIP all
 END
 
-# We don't care about the exit status of "make check" here.
-TESTS="$(echo *.test)" $MAKE -e check || :
+run_make -e IGNORE TESTS="$(echo *.test)" check
 cat test-suite.log
 
 grep ':.*ok|not seen' test-suite.log && exit 1
diff --git a/t/tap-global-result.sh b/t/tap-global-result.sh
index f3718d3..a4a1fd1 100644
--- a/t/tap-global-result.sh
+++ b/t/tap-global-result.sh
@@ -140,7 +140,7 @@ END
 
 tests=$(echo *.test) # Also required later.
 
-TESTS="$tests" $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS="$tests" check >stdout && { cat stdout; exit 1; }
 cat stdout
 
 # Dirty trick required here.
@@ -149,7 +149,7 @@ for tst in $(echo " $tests " | sed 's/\.test / /'); do
 done
 
 rm -f test-suite.log
-TESTS="$tests" $MAKE -e test-suite.log && exit 1
+run_make -e FAIL TESTS="$tests" test-suite.log
 cat test-suite.log
 
 have_rst_section ()
diff --git a/t/tap-log.sh b/t/tap-log.sh
index ef54297..d7eab8a 100644
--- a/t/tap-log.sh
+++ b/t/tap-log.sh
@@ -85,7 +85,7 @@ END
 
 chmod a+x *.test
 
-TEST_SUITE_LOG=my.log $MAKE -e check && exit 1
+run_make -e FAIL TEST_SUITE_LOG=my.log check
 ls -l # For debugging.
 test ! -e test-suite.log
 test ! -e global.log
@@ -116,7 +116,7 @@ $FGREP 'xpass.test' my.log
 $FGREP 'error.test' my.log
 
 touch error2.log test-suite.log global.log
-TEST_SUITE_LOG=my.log $MAKE -e mostlyclean
+run_make TEST_SUITE_LOG=my.log mostlyclean
 ls -l # For debugging.
 test ! -e my.log
 test ! -e pass.log
diff --git a/t/tap-merge-stdout-stderr.sh b/t/tap-merge-stdout-stderr.sh
index ad95412..ef99d82 100644
--- a/t/tap-merge-stdout-stderr.sh
+++ b/t/tap-merge-stdout-stderr.sh
@@ -60,7 +60,7 @@ count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 
skip=0 error=1
 
 # See that the option '--no-merge' can override the effect of '--merge'.
 
-TEST_LOG_DRIVER_FLAGS=--no-merge $MAKE -e check >stdout \
+run_make TEST_LOG_DRIVER_FLAGS=--no-merge check >stdout \
   || { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-msg0-bailout.sh b/t/tap-msg0-bailout.sh
index c302425..9e2bdce 100644
--- a/t/tap-msg0-bailout.sh
+++ b/t/tap-msg0-bailout.sh
@@ -26,7 +26,7 @@
 echo 'Bail out! 0' > a.test
 echo 'Bail out! 0.0' > b.test
 
-TESTS='a.test b.test' $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS='a.test b.test' check >stdout && { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=2
diff --git a/t/tap-msg0-planskip.sh b/t/tap-msg0-planskip.sh
index 131d438..3c6252d 100644
--- a/t/tap-msg0-planskip.sh
+++ b/t/tap-msg0-planskip.sh
@@ -25,7 +25,7 @@
 echo '1..0 # SKIP 0' > a.test
 echo '1..0 # SKIP 0.0' > b.test
 
-TESTS='a.test b.test' $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS='a.test b.test' check >stdout || { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0
diff --git a/t/tap-out-of-order.sh b/t/tap-out-of-order.sh
index 6b98060..bac7acd 100644
--- a/t/tap-out-of-order.sh
+++ b/t/tap-out-of-order.sh
@@ -57,7 +57,7 @@ ok 16
 ok 17
 END
 
-TESTS='a.test b.test c.test d.test' $MAKE -e check >stdout \
+run_make TESTS='a.test b.test c.test d.test' check >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-passthrough-exit.sh b/t/tap-passthrough-exit.sh
index fbe7e9e..cf9ea46 100644
--- a/t/tap-passthrough-exit.sh
+++ b/t/tap-passthrough-exit.sh
@@ -52,7 +52,7 @@ for e in $exit_statuses; do
   done
 done
 
-env TEST_LOG_DRIVER_FLAGS='--ignore-exit' $MAKE -e check
+run_make check TEST_LOG_DRIVER_FLAGS='--ignore-exit'
 $FGREP ".test - exited with status" *.log && exit 1
 
 :
diff --git a/t/tap-passthrough.sh b/t/tap-passthrough.sh
index e7c9fca..8132f53 100644
--- a/t/tap-passthrough.sh
+++ b/t/tap-passthrough.sh
@@ -46,7 +46,7 @@ ok # SKIP who cares?
 $weirdchars
 END
 
-TESTS=ok.test $MAKE -e check || { cat ok.log; exit 1; }
+run_make TESTS=ok.test check || { cat ok.log; exit 1; }
 cat ok.log
 
 for rx in \
@@ -115,8 +115,8 @@ Last line
 END
 
 st=0
-env TESTS='tiny.test ok.test ko.test bail.test skip.test err.test' \
-  $MAKE -e check || st=$?
+run_make check \
+  TESTS='tiny.test ok.test ko.test bail.test skip.test err.test' || st=$?
 cat tiny.log
 cat ok.log
 cat ko.log
diff --git a/t/tap-plan-corner.sh b/t/tap-plan-corner.sh
index b3b81b8..27f41fd 100644
--- a/t/tap-plan-corner.sh
+++ b/t/tap-plan-corner.sh
@@ -36,7 +36,7 @@ ok 1
 END
 
 for pos in leading trailing; do
-  TESTS="$pos-repeated.test" $MAKE -e check >stdout \
+  run_make TESTS="$pos-repeated.test" check >stdout \
     && { cat stdout; exit 1; }
   cat stdout
   count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1
@@ -59,8 +59,8 @@ ok 2
 1..2
 END
 
-env TESTS="leading-repeated.test trailing-repeated.test" \
-  $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS="leading-repeated.test trailing-repeated.test" check >stdout \
+  && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=6 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=3
 grep "^ERROR: leading-repeated\\.test - multiple test plans$" stdout
@@ -90,8 +90,8 @@ cat > 4.test <<END
 1..0 # SKIP
 END
 
-env TESTS="1.test 2.test 3.test 4.test" \
-  $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS="1.test 2.test 3.test 4.test" check >stdout \
+  && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=8 pass=0 fail=0 xpass=0 xfail=0 skip=4 error=4
 for i in 1 2 3 4; do
@@ -112,7 +112,7 @@ ok 4
 ok 5
 END
 
-$MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=8 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=3
 
@@ -143,7 +143,7 @@ ok 2
 ok 3
 END
 
-$MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=5 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=3
 
@@ -174,7 +174,7 @@ ok 4
 ok 5
 END
 
-$MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=7 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=4
 
diff --git a/t/tap-plan-leading-zero.sh b/t/tap-plan-leading-zero.sh
index 3dff53e..00caeb4 100644
--- a/t/tap-plan-leading-zero.sh
+++ b/t/tap-plan-leading-zero.sh
@@ -47,8 +47,8 @@ done >> d.test
 echo 1..00 > e.test
 echo '1..000 # SKIP' > f.test
 
-env TESTS='a.test b.test c.test d.test e.test f.test' \
-  $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS='a.test b.test c.test d.test e.test f.test' check >stdout \
+  || { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=115 pass=113 xfail=0 skip=2 fail=0 xpass=0 error=0
diff --git a/t/tap-plan-malformed.sh b/t/tap-plan-malformed.sh
index 9d1f19e..e2dd7d0 100644
--- a/t/tap-plan-malformed.sh
+++ b/t/tap-plan-malformed.sh
@@ -47,7 +47,7 @@ END
 
 tests_list=$(echo *.test)
 
-TESTS="$tests_list" $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS="$tests_list" check >stdout && { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=9 pass=2 fail=0 xpass=0 xfail=2 skip=0 error=5
diff --git a/t/tap-plan-middle.sh b/t/tap-plan-middle.sh
index 303ece5..bfc473b 100644
--- a/t/tap-plan-middle.sh
+++ b/t/tap-plan-middle.sh
@@ -73,8 +73,8 @@ END
 tests=$(echo *.test)
 
 for tap_flags in "" "--comments"; do
-  env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" \
-    $MAKE -e check >stdout || { cat stdout; exit 1; }
+  run_make TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" check >stdout \
+    || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=12 pass=7 xfail=2 skip=3 fail=0 xpass=0 error=0
 done
diff --git a/t/tap-plan-whitespace.sh b/t/tap-plan-whitespace.sh
index b0363c9..659a7e7 100644
--- a/t/tap-plan-whitespace.sh
+++ b/t/tap-plan-whitespace.sh
@@ -32,7 +32,7 @@ cat > bar.test <<END
 ok 1
 END
 
-TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS='foo.test bar.test' check >stdout || { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=3 pass=3 fail=0 error=0 xpass=0 xfail=0 skip=0
diff --git a/t/tap-plan.sh b/t/tap-plan.sh
index 6a5332e..50ae426 100644
--- a/t/tap-plan.sh
+++ b/t/tap-plan.sh
@@ -41,8 +41,8 @@ ok
 END
 
 for tap_flags in "" "--comments"; do
-  env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS='top.test bot.test' \
-    $MAKE -e check >stdout || { cat stdout; exit 1; }
+  run_make TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS='top.test bot.test' \
+    check >stdout || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=7 pass=5 xfail=1 skip=1 fail=0 xpass=0 error=0
 done
diff --git a/t/tap-planskip-and-logging.sh b/t/tap-planskip-and-logging.sh
index 3c4bcb5..b3089e4 100644
--- a/t/tap-planskip-and-logging.sh
+++ b/t/tap-planskip-and-logging.sh
@@ -45,7 +45,7 @@ an early non-TAP line
 a later non-TAP line
 END
 
-TESTS='foo.test foo2.test bar.test' $MAKE -e check >stdout \
+run_make TESTS='foo.test foo2.test bar.test' check >stdout \
   || { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-planskip-case-insensitive.sh 
b/t/tap-planskip-case-insensitive.sh
index 8dc1757..54a644e 100644
--- a/t/tap-planskip-case-insensitive.sh
+++ b/t/tap-planskip-case-insensitive.sh
@@ -32,7 +32,7 @@ for c4 in p P; do
   echo "1..0 # $c1$c2$c3$c4 foobar" > $j.test
 done; done; done; done
 
-TESTS="$(echo *.test)" $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS="$(echo *.test)" check >stdout || { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=16 pass=0 fail=0 xpass=0 xfail=0 skip=16 error=0
diff --git a/t/tap-planskip-late.sh b/t/tap-planskip-late.sh
index 69cb9e6..ab3f336 100644
--- a/t/tap-planskip-late.sh
+++ b/t/tap-planskip-late.sh
@@ -32,7 +32,7 @@ cat > bar.test <<END
 1..0
 END
 
-TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS='foo.test bar.test' check >stdout || { cat stdout; exit 1; }
 cat stdout
 
 grep '^SKIP: foo\.test .* from the last line$' stdout
diff --git a/t/tap-planskip-unplanned-corner.sh 
b/t/tap-planskip-unplanned-corner.sh
index 1f7e7fe..2176469 100644
--- a/t/tap-planskip-unplanned-corner.sh
+++ b/t/tap-planskip-unplanned-corner.sh
@@ -32,7 +32,7 @@ ok 1 # SKIP
 1..0 # SKIP
 END
 
-TESTS='foo.test bar.test' $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TESTS='foo.test bar.test' check >stdout && { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=3
diff --git a/t/tap-planskip-whitespace.sh b/t/tap-planskip-whitespace.sh
index be2437b..9513ca2 100644
--- a/t/tap-planskip-whitespace.sh
+++ b/t/tap-planskip-whitespace.sh
@@ -34,7 +34,7 @@ cat > baz.test <<END
 1..0 #  SKIP${tab}  Strip${tab}external  preserve ${tab}middle  ${tab}${sp}
 END
 
-TESTS='foo.test bar.test baz.test' $MAKE -e check > stdout \
+run_make TESTS='foo.test bar.test baz.test' check > stdout \
   || { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-planskip.sh b/t/tap-planskip.sh
index bc9c0fd..d0ab692 100644
--- a/t/tap-planskip.sh
+++ b/t/tap-planskip.sh
@@ -56,8 +56,8 @@ cat > mu.test <<END
 1..0 # SKIP $weirdchars
 END
 
-env TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
-  $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
+  check >stdout || { cat stdout; exit 1; }
 cat stdout
 
 count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
diff --git a/t/tap-recheck-logs.sh b/t/tap-recheck-logs.sh
index 166de6e..a4d52aa 100644
--- a/t/tap-recheck-logs.sh
+++ b/t/tap-recheck-logs.sh
@@ -58,14 +58,14 @@ grep_summary ()
   grep '^# ERROR: *1$' stdout
 }
 
-$MAKE -e check && exit 1
+run_make -e FAIL check
 test -f foo.log
 test -f bar.log
 test -f baz.log
 
 rm -f foo.log bar.log
 
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check > stdout && { cat stdout; exit 1; }
 cat stdout
 test -f foo.log
 test -f bar.log
@@ -80,7 +80,7 @@ touch foo.test
 # We re-run only a successful test, but the tests that failed in the
 # previous run should still be taken into account, and cause an overall
 # failure.
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep '^PASS: foo\.test 1$' stdout
 grep '^PASS: foo\.test 2$' stdout
@@ -90,7 +90,7 @@ grep_summary
 
 $sleep
 touch zardoz
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep '^ERROR: baz\.test' stdout
 $EGREP '(foo|bar)\.test' stdout && exit 1
@@ -99,7 +99,7 @@ grep_summary
 
 # Now, explicitly retry with all test logs already updated, and ensure
 # that the summary is still displayed.
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check > stdout && { cat stdout; exit 1; }
 cat stdout
 $EGREP '(foo|bar|baz)\.test' stdout && exit 1
 grep_summary
@@ -107,7 +107,7 @@ grep_summary
 # The following should re-run foo.test (and only foo.test), even if its
 # log file is up-to-date.
 : > older
-env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; exit 1; }
+run_make RECHECK_LOGS=foo.log check > stdout && { cat stdout; exit 1; }
 cat stdout
 grep '^PASS: foo\.test 1$' stdout
 grep '^PASS: foo\.test 2$' stdout
diff --git a/t/tap-test-number-0.sh b/t/tap-test-number-0.sh
index 03dc307..a42ff54 100644
--- a/t/tap-test-number-0.sh
+++ b/t/tap-test-number-0.sh
@@ -70,7 +70,7 @@ cat > e.test <<END
 ok 0 # TODO
 END
 
-TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+run_make TESTS='a.test b.test c.test d.test e.test' check >stdout \
   && { cat stdout; exit 1; }
 cat stdout
 
diff --git a/t/tap-unplanned.sh b/t/tap-unplanned.sh
index 6362335..11b68a3 100644
--- a/t/tap-unplanned.sh
+++ b/t/tap-unplanned.sh
@@ -53,7 +53,7 @@ ok 3
 not ok 4
 ok 5 # SKIP
 END
-XFAIL_TESTS=all.test $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make XFAIL_TESTS=all.test check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=6 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=4
 grep '^ERROR: all\.test - too many tests run (expected 2, got 5)$' stdout
diff --git a/t/test-driver-custom-multitest-recheck2.sh 
b/t/test-driver-custom-multitest-recheck2.sh
index c6c0d89..0c435de 100644
--- a/t/test-driver-custom-multitest-recheck2.sh
+++ b/t/test-driver-custom-multitest-recheck2.sh
@@ -83,7 +83,7 @@ for vpath in : false; do
   $srcdir/configure
 
   : Run the tests for the first time.
-  $MAKE check >stdout && { cat stdout; exit 1; }
+  run_make check >stdout && { cat stdout; exit 1; }
   cat stdout
   # All the test scripts should have run.
   test -f a.run
@@ -95,7 +95,7 @@ for vpath in : false; do
 
   : An empty '$(TESTS)' or '$(TEST_LOGS)' means that no test should be run.
   for var in TESTS TEST_LOGS; do
-    env "$var=" $MAKE -e recheck >stdout || { cat stdout; exit 1; }
+    run_make "$var=" recheck >stdout || { cat stdout; exit 1; }
     cat stdout
     count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
     test ! -e a.run
@@ -106,7 +106,7 @@ for vpath in : false; do
 
   : a.test was successful the first time, no need to re-run it.
   using_gmake || $sleep # Required by BSD make.
-  env TESTS=a.test $MAKE -e recheck >stdout \
+  run_make TESTS=a.test recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
@@ -117,7 +117,7 @@ for vpath in : false; do
   : b.test failed, it should be re-run.  And make it pass this time.
   using_gmake || $sleep # Required by BSD make.
   echo OK > b.ok
-  TEST_LOGS=b.log $MAKE -e recheck >stdout \
+  run_make TEST_LOGS=b.log recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
   test ! -e a.run
@@ -129,7 +129,7 @@ for vpath in : false; do
 
   : No need to re-run a.test or b.test anymore.
   using_gmake || $sleep # Required by BSD make.
-  TEST_LOGS=b.log $MAKE -e recheck >stdout \
+  run_make TEST_LOGS=b.log recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
@@ -137,7 +137,7 @@ for vpath in : false; do
   test ! -e b.run
   test ! -e c.run
   using_gmake || $sleep # Required by BSD make.
-  TESTS='a.test b.test' $MAKE -e recheck >stdout \
+  run_make TESTS='a.test b.test' recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
@@ -149,7 +149,7 @@ for vpath in : false; do
   : as it contained an XPASS.  And this time, make it fail with
   : an hard error.
   echo dummy > c.err
-  env TEST_LOGS='a.log c.log' $MAKE -e recheck >stdout \
+  run_make TEST_LOGS='a.log c.log' recheck >stdout \
     && { cat stdout; exit 1; }
   cat stdout
   count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
@@ -164,7 +164,7 @@ for vpath in : false; do
   # Use 'echo', not ':'; see comments above for why.
   using_gmake || $sleep # Required by BSD make.
   echo dummy > c.ok
-  env TESTS='c.test a.test' $MAKE -e recheck >stdout \
+  run_make TESTS='c.test a.test' recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
@@ -177,7 +177,7 @@ for vpath in : false; do
   : Nothing should be rerun anymore, as all tests have been eventually
   : successful.
   using_gmake || $sleep # Required by BSD make.
-  $MAKE recheck >stdout || { cat stdout; exit 1; }
+  run_make recheck >stdout || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
   test ! -e a.run
diff --git a/t/test-driver-custom-multitest.sh 
b/t/test-driver-custom-multitest.sh
index 5727af2..a21174a 100644
--- a/t/test-driver-custom-multitest.sh
+++ b/t/test-driver-custom-multitest.sh
@@ -158,7 +158,7 @@ for vpath in : false; do
   grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log
   test $(grep -c '%% ' test-suite.log) -eq 4
 
-  TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \
+  run_make TESTS='pass.t pass3-skip2-xfail.t' check >stdout \
     || { cat stdout; cat test-suite.log; exit 1; }
   cat test-suite.log
   cat stdout
diff --git a/t/test-log.sh b/t/test-log.sh
index 54b7e81..f0da927 100644
--- a/t/test-log.sh
+++ b/t/test-log.sh
@@ -88,7 +88,7 @@ $AUTOMAKE -a
 
 ./configure
 
-TEST_SUITE_LOG=my.log $MAKE -e check && exit 1
+run_make -e FAIL TEST_SUITE_LOG=my.log check
 ls -l # For debugging.
 test ! -e test-suite.log
 test ! -e global.log
@@ -130,7 +130,7 @@ have_rst_section 'XPASS: xpass' my.log
 have_rst_section 'ERROR: error' my.log
 
 touch error2.log test-suite.log global.log
-TEST_SUITE_LOG=my.log $MAKE -e mostlyclean
+run_make TEST_SUITE_LOG=my.log mostlyclean
 ls -l # For debugging.
 test ! -e my.log
 test ! -e pass.log
diff --git a/t/test-missing.sh b/t/test-missing.sh
index 0e46cf5..b3d42d9 100644
--- a/t/test-missing.sh
+++ b/t/test-missing.sh
@@ -44,13 +44,15 @@ grep '^PASS: ok\.test' output
 $FGREP 'zardoz.log' output
 test ! -e test-suite.log
 
-TESTS='zardoz2.test' $MAKE -e check >output 2>&1 \
+# FIXME: this redirection is fishy... run_make needs to be enhanced
+run_make TESTS='zardoz2.test' check >output 2>&1 \
   && { cat output; exit 1; }
 cat output
 $FGREP 'zardoz2.log' output
 test ! -e test-suite.log
 
-TEST_LOGS='zardoz3.log' $MAKE -e check >output 2>&1 \
+# FIXME: this redirection is fishy... run_make needs to be enhanced
+run_make TEST_LOGS='zardoz3.log' check >output 2>&1 \
   && { cat output; exit 1; }
 cat output
 $FGREP 'zardoz3.log' output
diff --git a/t/test-trs-basic.sh b/t/test-trs-basic.sh
index 525d5bf..a7f77d5 100644
--- a/t/test-trs-basic.sh
+++ b/t/test-trs-basic.sh
@@ -71,7 +71,7 @@ for vpath in : false; do
   test x"$(cat tb)" = x"foo bar sub/zardoz"
   rm -f tb
   # Please don't change the order of the stuff in TESTS, below.
-  TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' $MAKE -e tb
+  run_make TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' tb
   test x"$(cat tb)" = x"foo foo2 foo-log foolog a.log.b 0.exe"
   rm -f tb
 
@@ -116,18 +116,18 @@ test -f sub/foo.trs
 # Try with a subset of TESTS.
 #
 
-TESTS=foo.test $MAKE -e check
+run_make TESTS=foo.test check
 test -f foo.trs
 test ! -e bar.trs
 test ! -e sub/zardoz.trs
 $MAKE clean
 test ! -e foo.trs
-TESTS='foo.test bar.sh' $MAKE -e check
+run_make TESTS='foo.test bar.sh' check
 test -f foo.trs
 test -f bar.trs
 test ! -e sub/zardoz.trs
 # "make clean" shouldn't remove '.trs' files for tests not in $(TESTS).
-TESTS=bar.sh $MAKE -e clean
+run_make TESTS=bar.sh clean
 test -f foo.trs
 test ! -e bar.trs
 
@@ -137,19 +137,19 @@ $MAKE clean
 # Try with a subset of TEST_LOGS.
 #
 
-TEST_LOGS=sub/zardoz.log $MAKE -e check
+run_make TEST_LOGS=sub/zardoz.log check
 test ! -e foo.trs
 test ! -e bar.trs
 test -f sub/zardoz.trs
 $MAKE clean
 test ! -e sub/zardoz.trs
-TEST_LOGS='foo.log bar.log' $MAKE -e check
+run_make TEST_LOGS='foo.log bar.log' check
 test -f foo.trs
 test -f bar.trs
 test ! -e sub/zardoz.trs
 # "make clean" shouldn't remove '.trs' files for tests whose log
 # is not in $(TEST_LOGS).
-TEST_LOGS=foo.log $MAKE -e clean
+run_make TEST_LOGS=foo.log clean
 test ! -e foo.trs
 test -f bar.trs
 test ! -e sub/zardoz.trs
diff --git a/t/test-trs-recover.sh b/t/test-trs-recover.sh
index bf86bc7..d833d96 100644
--- a/t/test-trs-recover.sh
+++ b/t/test-trs-recover.sh
@@ -95,14 +95,14 @@ grep '^PASS: baz\.test' stdout
 
 : Recreate with a "make check" with redefined TESTS.
 rm -f foo.trs bar.trs baz.trs
-TESTS=foo.test $MAKE -e check
+run_make TESTS=foo.test check
 test -f foo.trs
 test ! -e bar.trs
 test ! -e baz.trs
 
 : Recreate with a "make check" with redefined TEST_LOGS.
 rm -f foo.trs bar.trs baz.trs
-TEST_LOGS=bar.log $MAKE -e check
+run_make TEST_LOGS=bar.log check
 test ! -e foo.trs
 test -f bar.trs
 test ! -e baz.trs
@@ -152,7 +152,7 @@ test -f baz.trs
 rm -f foo.trs
 update_stamp
 touch bar.test
-RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check >stdout || { cat stdout; exit 1; }
 cat stdout
 # Check that make has updated what it needed to, but no more.
 test -f foo.trs
diff --git a/t/test-trs-recover2.sh b/t/test-trs-recover2.sh
index 6fad290..f650961 100644
--- a/t/test-trs-recover2.sh
+++ b/t/test-trs-recover2.sh
@@ -107,7 +107,7 @@ $sleep
 touch stamp
 $sleep
 touch bar.test
-RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; exit 1; }
+run_make RECHECK_LOGS= check >stdout || { cat stdout; exit 1; }
 cat stdout
 test -r foo.trs
 is_newest bar.trs bar.test
diff --git a/t/testsuite-summary-reference-log.sh 
b/t/testsuite-summary-reference-log.sh
index d8e4936..2f2533f 100644
--- a/t/testsuite-summary-reference-log.sh
+++ b/t/testsuite-summary-reference-log.sh
@@ -50,7 +50,7 @@ cat stdout
 grep '^See \./my_test_suite\.log$' stdout
 
 mkdir bar
-TEST_SUITE_LOG=bar/bar.log $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TEST_SUITE_LOG=bar/bar.log check >stdout && { cat stdout; exit 1; }
 cat stdout
 grep '^See \./bar/bar\.log$' stdout
 
@@ -80,7 +80,7 @@ cat stdout
 grep '^See sub/test-suite\.log$' stdout
 cd ..
 
-TEST_SUITE_LOG=foo.log $MAKE -e check >stdout && { cat stdout; exit 1; }
+run_make TEST_SUITE_LOG=foo.log check >stdout && { cat stdout; exit 1; }
 cat stdout
 grep '^See sub/foo\.log$' stdout
 
diff --git a/t/txinfo-many-output-formats-vpath.sh 
b/t/txinfo-many-output-formats-vpath.sh
index 74b04eb..e31a2e1 100644
--- a/t/txinfo-many-output-formats-vpath.sh
+++ b/t/txinfo-many-output-formats-vpath.sh
@@ -118,7 +118,7 @@ test ! -e sub/main2.html
 test ! -e rec/main3.html
 
 # Test production of a single HTML file.
-MAKEINFOFLAGS=--no-split $MAKE -e html
+run_make MAKEINFOFLAGS=--no-split html
 test -f main.html
 test -f sub/main2.html
 test -f rec/main3.html
diff --git a/t/txinfo-many-output-formats.sh b/t/txinfo-many-output-formats.sh
index 9d0bd8b..e3eb0c9 100644
--- a/t/txinfo-many-output-formats.sh
+++ b/t/txinfo-many-output-formats.sh
@@ -118,7 +118,7 @@ test ! -e sub/main2.html
 test ! -e rec/main3.html
 
 # Test production of a single HTML file.
-MAKEINFOFLAGS=--no-split $MAKE -e html
+run_make MAKEINFOFLAGS=--no-split html
 test -f main.html
 test -f sub/main2.html
 test -f rec/main3.html
diff --git a/t/yflags-cmdline-override.sh b/t/yflags-cmdline-override.sh
index 3eea823..03c0483 100644
--- a/t/yflags-cmdline-override.sh
+++ b/t/yflags-cmdline-override.sh
@@ -20,8 +20,6 @@
 required='cc yacc'
 . test-init.sh
 
-unset YFLAGS
-
 cat >> configure.ac <<'END'
 AC_PROG_CC
 AC_PROG_YACC
@@ -36,8 +34,9 @@ foo_SOURCES = foo.y
 # would be useful in general, so it's probably better to be
 # conservative).
 CLEANFILES = foo.output
-# Another automake wart: '-d' flag won't be given at automake time,
-# so automake won't be able to generate code to clean 'foo.h' :-(
+# As the '-d' flag won't be given at automake time, automake won't
+# be able to generate code to clean 'foo.h'.  We can't really blame
+# automake for that.
 MAINTAINERCLEANFILES = foo.h
 END
 
@@ -76,7 +75,7 @@ $MAKE maintainer-clean
 ls -l
 
 ./configure YFLAGS='-v'
-YFLAGS=-d $MAKE -e
+run_make YFLAGS=-d
 ls -l
 test -f foo.c
 test -f foo.h
diff --git a/t/yflags.sh b/t/yflags.sh
index f8fe7a4..7485516 100644
--- a/t/yflags.sh
+++ b/t/yflags.sh
@@ -28,10 +28,6 @@ echo 'extern int dummy;' >> y.tab.c
 END
 chmod a+x fake-yacc
 
-# Remove Yacc from the environment, so that it won't interfere
-# with 'make -e' below.
-unset YACC
-
 cat >> configure.ac <<'END'
 AC_SUBST([CC], [false])
 # Simulate presence of Yacc using our fake-yacc script.
@@ -59,7 +55,7 @@ grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && exit 1
 
 $AUTOCONF
 ./configure
-env YFLAGS=__user_flags__ $MAKE -e foo.c bar-bar.c
+run_make YFLAGS=__user_flags__ foo.c bar-bar.c
 
 cat foo.c
 cat bar-bar.c
diff --git a/t/yflags2.sh b/t/yflags2.sh
index 12eb5d7..1987cac 100644
--- a/t/yflags2.sh
+++ b/t/yflags2.sh
@@ -28,10 +28,6 @@ echo 'extern int dummy;' >> y.tab.c
 END
 chmod a+x fake-yacc
 
-# Remove Yacc from the environment, so that it won't interfere
-# with 'make -e' below.
-unset YACC
-
 cat >> configure.ac <<'END'
 AC_SUBST([CXX], [false])
 # Simulate presence of Yacc using our fake-yacc script.
@@ -59,7 +55,7 @@ grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && exit 1
 
 $AUTOCONF
 ./configure
-env YFLAGS=__user_flags__ $MAKE -e foo.cc bar-bar.c++
+run_make YFLAGS=__user_flags__ foo.cc bar-bar.c++
 
 cat foo.cc
 cat bar-bar.c++
-- 
1.8.3.rc2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]