summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-06-27 12:47:17 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-06-27 13:18:27 +0200
commit2a3e45d6f3083c5152d94156f8b4e21366090c0f (patch)
tree8ef5620eebe733a542afc4d489703da9fbb6ad31 /lib
parentf7132aee3c5c0024b91c925e712f249838b98c46 (diff)
downloadautomake-2a3e45d6f3083c5152d94156f8b4e21366090c0f.tar.gz
parallel-tests: "recheck" behaves better in case of compilation failures
With this change, the "recheck" target behaves better in the face of build failures related to previously failed tests. For example, if a test is a compiled program that must be rerun by "make recheck", and its compilation fails, that test will still be rerun by further "make recheck" invocations. Previously, its '.log' and '.trs' would have both been lost, so that the test would have not been re-run. This change fixes automake bug#11791. * NEWS: Update. * lib/am/check.am (recheck, check-TESTS): Adjust to cater to scenario described above. * t/parallel-tests-recheck-pr11791.sh: New test. * t/list-of-tests.mk: Add it. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/am/check.am43
1 files changed, 35 insertions, 8 deletions
diff --git a/lib/am/check.am b/lib/am/check.am
index ba4de46b2..6816398d6 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -418,7 +418,7 @@ check-TESTS recheck:
## 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); \
+ @set +e; $(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.
@@ -434,15 +434,42 @@ check-TESTS recheck:
## be problematic. In this particular case, trailing white space is known
## to have caused 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".
+## Under "make recheck", 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 test $@ != recheck || $(am__make_dryrun); then :; else \
- test -z "$$log_list" || rm -f $$log_list; \
- test -z "$$trs_list" || rm -f $$trs_list; \
+ 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 test $@ != recheck || $(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; \
- $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"
+## Be sure to exit with the proper exit status. The use of "exit" below
+## is required to work around a FreeBSD make bug (present only when
+## running in concurrent mode). See automake bug#9245:
+## <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9245>
+## and FreeBSD PR bin/159730:
+## <http://www.freebsd.org/cgi/query-pr.cgi?pr=159730>.
+ exit $$st;
## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
## It must also depend on the 'all' target. See automake bug#11252.