From: Stefano Lattarini Date: Tue, 8 May 2012 07:15:34 +0000 (+0200) Subject: [ng] check: refactor: split recipes for check-TESTS and recheck X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a2df0d1fe3c865a391ab2c88ca9c14c0be57c89;p=thirdparty%2Fautomake.git [ng] check: refactor: split recipes for check-TESTS and recheck Their implementation has diverged to the point that it's now simpler and clearer to keep them separate. * lib/am/check.am (check-TESTS, recheck): Split their recipes, and minor relate changes. * t/parallel-tests-dynamic.sh: Simplify an overly tricky check that has been broken by this change. Signed-off-by: Stefano Lattarini --- diff --git a/lib/am/check.am b/lib/am/check.am index 23eaef124..77f31c560 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -332,20 +332,11 @@ RECHECK_LOGS = $(TEST_LOGS) ## 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). +check-TESTS: ## 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 + @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 @@ -354,37 +345,26 @@ 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) - @bases='$(am__test_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; \ -## Remove newlines and normalize whitespace. - bases=`echo $$bases`; \ - fi; \ - 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. - 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) $(TEST_SUITE_LOG) am__test_bases="$$bases" + $(MAKE) $(TEST_SUITE_LOG) ## 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 in the 'check-TESTS' recipe above for why we need +## this manual removal. + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @bases='$(am__test_bases)'; \ +## 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; \ +## Remove newlines and normalize whitespace. + bases=`echo $$bases`; \ + $(MAKE) check-TESTS am__test_bases="$$bases" +.PHONY: recheck AM_RECURSIVE_TARGETS += check recheck -.PHONY: recheck - else !%?PARALLEL_TESTS% check-TESTS: $(TESTS) diff --git a/t/parallel-tests-dynamic.sh b/t/parallel-tests-dynamic.sh index a18662c7a..68a09841f 100755 --- a/t/parallel-tests-dynamic.sh +++ b/t/parallel-tests-dynamic.sh @@ -127,16 +127,13 @@ $MAKE check TESTS='$(shell echo t00 | sed "s/$$/-foo/") t99' test -f t00-foo.log test -f t99.log -# A little tricky in that we rely on the .log files created by -# the previous run to be present. -$MAKE check TESTS="\ - \$(patsubst %.log,%,\$(wildcard t[0-9]*.log)) \ - \$(call my_add_dirprefix, t, nosuffix) \ -" > stdout || { cat stdout; Exit 1; } +$MAKE check \ + foo='E9E9E' \ + TESTS='t$(subst E,,$(foo)) $(call my_add_dirprefix,t,nosuffix)' \ + > stdout || { cat stdout; Exit 1; } cat stdout -count_test_results total=3 pass=2 fail=0 xpass=0 xfail=1 skip=0 error=0 -grep '^PASS: t00-foo\.sh' stdout +count_test_results total=2 pass=1 fail=0 xpass=0 xfail=1 skip=0 error=0 grep '^PASS: t/nosuffix' stdout grep '^XFAIL: t99\.sh' stdout