if (var ('TESTS'))
{
push (@check_tests, 'check-TESTS');
+ my $check_deps = "@check";
$output_rules .= &file_contents ('check', new Automake::Location,
COLOR => !! option 'color-tests',
- PARALLEL_TESTS => !! option 'parallel-tests');
+ PARALLEL_TESTS => !! option 'parallel-tests',
+ CHECK_DEPS => $check_deps);
# Tests that are known programs should have $(EXEEXT) appended.
# For matching purposes, we need to adjust XFAIL_TESTS as well.
# Beware of concurrent executions. Run "check" not "check-TESTS", as
# check-SCRIPTS and other dependencies are rebuilt by the former only.
# And expect check to fail.
-check-html:
- @if $(MAKE) $(AM_MAKEFLAGS) check; then \
- rv=0; else rv=$$?; \
- fi; \
- $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4; \
+check-html recheck-html:
+ @target=`echo $@ | sed 's/-html$$//'`; \
+ rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \
+## The nullification of $(TEST_LOGS) is required to ensure that
+## "make recheck-html" do not try to uselessly re-run tests.
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \
exit $$rv
-## Rerun all FAILed or XPASSed tests.
-recheck-html:
- @list='' list2='$(TEST_LOGS)'; \
- for f in $$list2; do \
- test -f $$f || continue; \
- if test -r $$f && read line < $$f; then \
- case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \
- fi; \
-## Be careful to avoid extra whitespace in the definition of $list, since
-## its value will be passed to the recursive make invocation below through
-## the TEST_LOGS macro, and leading/trailing white space in a make macro
-## definition can be problematic. In this particular case, trailing white
-## space was known to cause a segmentation fault on Solaris 10 XPG4 make:
-## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html>
- if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \
- done; \
- $(MAKE) $(AM_MAKEFLAGS) check-html AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"'
-
AM_RECURSIVE_TARGETS += check-html recheck-html
.PHONY: check-html recheck-html
RECHECK_LOGS = $(TEST_LOGS)
-# Run all the tests.
-check-TESTS:
+check-TESTS recheck:
+## If we are running "make recheck", it's not the user which can decide
+## which tests to consider for re-execution, so we must ignore the value
+## of $(RECHECK_LOGS).
+ @if test $@ != recheck; then \
## Expand $(RECHECK_LOGS) only once, to avoid exceeding line length limits.
- @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \
+ fi
## We always have to remove TEST_SUITE_LOG, to ensure its rule is run
## in any case even in lazy mode: otherwise, if no test needs rerunning,
-## or a prior run plus reruns all happen within the same timestamp
-## (can happen with a prior `make TESTS=<subset>'),
-## then we get no log output.
+## or a prior run plus reruns all happen within the same timestamp (can
+## happen with a prior `make TESTS=<subset>'), then we get no log output.
## OTOH, this means that, in the rule for `$(TEST_SUITE_LOG)', we
## cannot use `$?' to compute the set of lazily rerun tests, lest
## we rely on .PHONY to work portably.
## 3.80 to erroneously expand $(TESTS_LOGS) to `foo.log .log'.
## Work around this bug.
test .log = $$f && continue; \
-## Be careful to avoid extra whitespace in the definition of $list. See
-## comments in `recheck' below for why this might be useful.
- if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \
- done; \
- $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list"
-
-AM_RECURSIVE_TARGETS += check
-
-## -------------------- ##
-## Rechecking failures. ##
-## -------------------- ##
-
-## Rerun all FAILed or XPASSed tests.
-recheck:
- @list='' list2='$(TEST_LOGS)'; \
- for f in $$list2; do \
- test -f $$f || continue; \
- if test -r $$f && read line < $$f; then \
- case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \
+## If running a "make recheck", we must only consider tests that had
+## an unexpected outcome (FAIL or XPASS) in the earlier run.
+ if test $@ = recheck; then \
+ test -f $$f || continue; \
+ if test -r $$f && read line < $$f; then \
+ case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \
+ fi; \
fi; \
## Be careful to avoid extra whitespace in the definition of $list, since
## its value will be passed to the recursive make invocation below through
## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html>
if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \
done; \
- $(MAKE) $(AM_MAKEFLAGS) check AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"'
+## Under "make recheck", remove the logs of the files to recheck, so that
+## those will be rerun by the "make test-suite.log" recursive invocation
+## below.
+ test $@ != recheck || test -z "$$list" || rm -f $$list || exit 1; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list"
+
+## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
+recheck: %CHECK_DEPS%
+
+AM_RECURSIVE_TARGETS += check recheck
.PHONY: recheck
.MAKE: recheck
-AM_RECURSIVE_TARGETS += recheck
-
## ----------------------------------------------- ##
## Produce HTML. To be removed in automake 1.12. ##
## ----------------------------------------------- ##