tests: better idiom to override make macro defs on the cmdline
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 20 May 2013 09:23:01 +0000 (11:23 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 21 May 2013 22:05:06 +0000 (00:05 +0200)
commitffd4ecc946c6b150f5ee5684fa04bd4f9e8b7af9
tree72baf668f0a9a464de82c11eb5c610a411cb334a
parent12cfd38f0d234af0922408bdd5a95e590d0d8e84
tests: better idiom to override make macro defs on the cmdline

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 <stefano.lattarini@gmail.com>
102 files changed:
contrib/t/parallel-tests-html.sh
syntax-checks.mk
t/ax/am-test-lib.sh
t/ax/tap-summary-aux.sh
t/ax/testsuite-summary-checks.sh
t/check-concurrency-bug9245.sh
t/check10.sh
t/check11.sh
t/check5.sh
t/check7.sh
t/color-tests.sh
t/distcheck-configure-flags.sh
t/distcheck-override-infodir.sh
t/distdir.sh
t/exeext.sh
t/instdir-java.sh
t/instdir-lisp.sh
t/instdir-ltlib.sh
t/instdir-no-empty.sh
t/instdir-prog.sh
t/instdir-python.sh
t/instdir-texi.sh
t/instdir.sh
t/instdir2.sh
t/insthook.sh
t/instmany-mans.sh
t/instmany-python.sh
t/instmany.sh
t/instspc.tap
t/javaflags.sh
t/lflags.sh
t/lflags2.sh
t/libtool9.sh
t/link_cond.sh
t/lisp-flags.sh
t/man3.sh
t/mmodely.sh
t/parallel-tests-basics.sh
t/parallel-tests-cmdline-override.sh
t/parallel-tests-empty-testlogs.sh
t/parallel-tests-exit-statuses.sh
t/parallel-tests-extra-programs.sh
t/parallel-tests-fork-bomb.sh
t/parallel-tests-harderror.sh
t/parallel-tests-log-compiler-1.sh
t/parallel-tests-log-override-1.sh
t/parallel-tests-log-override-2.sh
t/parallel-tests-log-override-recheck.sh
t/parallel-tests-no-color-in-log.sh
t/parallel-tests-recheck-pr11791.sh
t/remake-subdir-long-time.sh
t/remake-timing-bug-pr8365.sh
t/subst-no-trailing-empty-line.sh
t/suffix-custom-subobj.sh
t/suffix11.tap
t/suffix6c.sh
t/suffix8.tap
t/tap-autonumber.sh
t/tap-bailout-leading-space.sh
t/tap-bailout-suppress-later-errors.sh
t/tap-bailout.sh
t/tap-basic.sh
t/tap-color.sh
t/tap-diagnostic.sh
t/tap-doc2.sh
t/tap-global-log.sh
t/tap-global-result.sh
t/tap-log.sh
t/tap-merge-stdout-stderr.sh
t/tap-msg0-bailout.sh
t/tap-msg0-planskip.sh
t/tap-out-of-order.sh
t/tap-passthrough-exit.sh
t/tap-passthrough.sh
t/tap-plan-corner.sh
t/tap-plan-leading-zero.sh
t/tap-plan-malformed.sh
t/tap-plan-middle.sh
t/tap-plan-whitespace.sh
t/tap-plan.sh
t/tap-planskip-and-logging.sh
t/tap-planskip-case-insensitive.sh
t/tap-planskip-late.sh
t/tap-planskip-unplanned-corner.sh
t/tap-planskip-whitespace.sh
t/tap-planskip.sh
t/tap-recheck-logs.sh
t/tap-test-number-0.sh
t/tap-unplanned.sh
t/test-driver-custom-multitest-recheck2.sh
t/test-driver-custom-multitest.sh
t/test-log.sh
t/test-missing.sh
t/test-trs-basic.sh
t/test-trs-recover.sh
t/test-trs-recover2.sh
t/testsuite-summary-reference-log.sh
t/txinfo-many-output-formats-vpath.sh
t/txinfo-many-output-formats.sh
t/yflags-cmdline-override.sh
t/yflags.sh
t/yflags2.sh