.PHONY: check-TESTS
-if %?PARALLEL_TESTS%
+if !%?SERIAL_TESTS%
include inst-vars.am
## originally written at EPITA/LRDE, further developed at Gostai, then made
## its way from GNU coreutils to end up, largely rewritten, in Automake.
## The current version is an heavy rewrite of that, to allow for support
-## of more test metadata, and the use of custom test derivers and protocols
+## of more test metadata, and the use of custom test drivers and protocols
## (among them, TAP).
am__recheck_rx = ^[ ]*:recheck:[ ]*
## Running all tests, or rechecking failures. ##
## ------------------------------------------ ##
-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).
-## Here and below, we expand $(RECHECK_LOGS) only once, to avoid exceeding
-## line length limits.
- @if test $@ != recheck; then \
- list='$(RECHECK_LOGS)'; \
- test -z "$$list" || rm -f $$list; \
- fi
- @if test $@ != recheck; then \
- list='$(RECHECK_LOGS:.log=.trs)'; \
- test -z "$$list" || rm -f $$list; \
- fi
-## We always have to remove TEST_SUITE_LOG, to ensure its rule is run
+check-TESTS:
+ list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+## 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.
## cannot use '$?' to compute the set of lazily rerun tests, lest
## we rely on .PHONY to work portably.
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
- @$(am__set_TESTS_bases); \
- if test $@ = recheck; then \
-## If running a "make recheck", we must only consider tests that had an
-## unexpected outcome (FAIL or XPASS) in the earlier run.
- bases=`for i in $$bases; do echo $$i; done \
- | $(am__list_recheck_tests)` || exit 1; \
- fi; \
+ @set +e; $(am__set_TESTS_bases); \
log_list=`for i in $$bases; do echo $$i.log; done`; \
trs_list=`for i in $$bases; do echo $$i.trs; done`; \
-## Remove newlines and normalize whitespace, being careful to avoid extra
-## whitespace in the definition of $log_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 is known
-## to have caused segmentation faults on Solaris 10 XPG4 make:
+## Remove newlines and normalize whitespace. Trailing (and possibly
+## leading) whitespace is known to cause segmentation faults on
+## Solaris 10 XPG4 make.
log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
-## Under "make recheck", remove the .log and .trs files associated
-## with the files to recheck, so that those will be rerun by the
-## "make test-suite.log" recursive invocation below. But use a proper
-## hack to avoid extra files removal when running under "make -n".
- if test $@ != recheck || $(am__make_dryrun); then :; else \
- test -z "$$log_list" || rm -f $$log_list; \
- test -z "$$trs_list" || rm -f $$trs_list; \
- fi; \
- $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+## Be sure to exit with the proper exit status (automake bug#9245). See
+## comments in the recipe of $(TEST_SUITE_LOG) above for more information.
+ exit $$?;
## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
## It must also depend on the 'all' target. See automake bug#11252.
recheck: all %CHECK_DEPS%
+## See comments above in the check-TESTS recipe for why remove
+## $(TEST_SUITE_LOG) here.
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+## We must only consider tests that had an unexpected outcome (FAIL
+## or XPASS) in the earlier run.
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+## Remove newlines and normalize whitespace. Trailing (and possibly
+## leading) whitespace is known to cause segmentation faults on
+## Solaris 10 XPG4 make.
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+## Move the '.log' and '.trs' files associated with the tests to be
+## re-run out of the way, so that those tests will be re-run by the
+## "make test-suite.log" recursive invocation below.
+## Two tricky requirements:
+## - we must avoid extra files removal when running under "make -n";
+## - in case the test is a compiled program whose compilation fails,
+## we must ensure that any '.log' and '.trs' file referring to such
+## test are preserved, so that future "make recheck" invocations
+## will still try to re-compile and re-run it (automake bug#11791).
+## The extra contortions below cater to such requirements.
+ am_backupdir=.am-recheck; \
+ if $(am__make_dryrun); then :; else \
+ if test -n "$$trs_list$$log_list"; then \
+ { test ! -d $$am_backupdir || rm -rf $$am_backupdir; } \
+ && $(MKDIR_P) $$am_backupdir || exit 1; \
+ test -z "$$log_list" \
+ || mv -f $$log_list $$am_backupdir 2>/dev/null; \
+ test -z "$$trs_list" \
+ || mv -f $$trs_list $$am_backupdir 2>/dev/null; \
+ fi; \
+ fi; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ st=$$?; \
+ if $(am__make_dryrun) || test ! -d $$am_backupdir; then :; else \
+ for f in $$log_list $$trs_list; do \
+ test -f $$f || mv $$am_backupdir/$$f . || exit 1; \
+ done; \
+ rm -rf $$am_backupdir || exit 1; \
+ fi; \
+ exit $$st;
AM_RECURSIVE_TARGETS += check recheck
.PHONY: recheck
-else !%?PARALLEL_TESTS%
+else %?SERIAL_TESTS%
+
+## Obsolescent serial testsuite driver.
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
test "$$failed" -eq 0; \
else :; fi
-endif !%?PARALLEL_TESTS%
+endif %?SERIAL_TESTS%