From: Stefano Lattarini Date: Fri, 20 Jul 2012 10:28:46 +0000 (+0200) Subject: [ng] parallel-tests: do not exceed command line length limits X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbe978867032d47013b9e9bacf176f300e6e924d;p=thirdparty%2Fautomake.git [ng] parallel-tests: do not exceed command line length limits Fixes automake bug#7868. Two things worth noting: + a "make recheck" issued after a huge number of tests have failed can still hit command-line length issues; + the check-recipes now contain (first among the Automake-generated recipes) a use of the 'xargs' utility. These issues will likely be tackled by later patches. * Makefile.am (XFAIL_TESTS): Remove 't/parallel-tests-many.sh'. * lib/am/clean.am (.am.clean-cmd.f, .am.clean-cmd.d, .am.rm-f, .am.rm-rf): Move their definitions ... * lib/am/header-vars.am: ... here, because we need to use them ... * lib/am/parallel-tests.am: ... here as well. (am.test-harness.workdir, am.setup-test-harness-workdir, am.test-harness.append-to-list-of-bases): New internal variables. Use them to avoid hitting command-line length limits ... ($(TEST_SUITE_LOG), recheck): ... in this rules ... (am__remove_if_not_lazy_check): ... and in the shell code defined by this internal variable. Signed-off-by: Stefano Lattarini --- diff --git a/Makefile.am b/Makefile.am index 290d5f423..54de62fb9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -350,7 +350,6 @@ XFAIL_TESTS = \ t/interp3.sh \ t/java-nobase.sh \ t/objext-pr10128.sh \ - t/parallel-tests-many.sh \ t/pr8365-remake-timing.sh \ t/remake-am-pr10111.sh \ t/remake-m4-pr10111.sh \ diff --git a/lib/am/clean.am b/lib/am/clean.am index bc11bc4c7..aa463e579 100644 --- a/lib/am/clean.am +++ b/lib/am/clean.am @@ -14,12 +14,6 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -.am.rm-f = $(if $(strip $1),rm -f $(strip $1)$(am__newline)) -.am.rm-rf = $(if $(strip $1),rm -rf $(strip $1)$(am__newline)) - -.am.clean-cmd.f = $(call am.xargs-map,.am.rm-f,$1) -.am.clean-cmd.d = $(call am.xargs-map,.am.rm-rf,$1) - am__mostlyclean_files += $(MOSTLYCLEANFILES) am__clean_files += $(CLEANFILES) am__distclean_files += $(DISTCLEANFILES) diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am index 0549eaa19..6fe0212d7 100644 --- a/lib/am/header-vars.am +++ b/lib/am/header-vars.am @@ -294,6 +294,12 @@ $(if $2,$(strip \ )$(if $($0.counter),$(call $1,$(strip $($0.partial-args))))) endef +.am.rm-f = $(if $(strip $1),rm -f $(strip $1)$(am__newline)) +.am.rm-rf = $(if $(strip $1),rm -rf $(strip $1)$(am__newline)) + +.am.clean-cmd.f = $(call am.xargs-map,.am.rm-f,$1) +.am.clean-cmd.d = $(call am.xargs-map,.am.rm-rf,$1) + ## Some derived variables that have been found to be useful. pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am index 83b90d511..5544b1ce6 100644 --- a/lib/am/parallel-tests.am +++ b/lib/am/parallel-tests.am @@ -261,23 +261,49 @@ am__mostlyclean_files += $(am__test_results) $(am__test_logs) # $(TEST_LOGS) is a published interface. TEST_LOGS = $(am__test_logs) +am.test-harness.workdir = $(am__dir)/test-harness + +am.test-harness.append-to-list-of-bases = \ + @lst='$1'; for x in $$lst; do echo $$x; done \ + >> $(am.test-harness.workdir)/bases$(am__newline) + +!define am.setup-test-harness-workdir +! @rm -rf $(am.test-harness.workdir) +! @$(MKDIR_P) $(am.test-harness.workdir) +! @touch $(am.test-harness.workdir)/bases +! $(call am.xargs-map,am.test-harness.append-to-list-of-bases, \ +! $(am__test_bases)) +! @workdir='$(am.test-harness.workdir)' \ +! && sed 's/$$/.log/' $$workdir/bases > $$workdir/logs \ +! && sed 's/$$/.trs/' $$workdir/bases > $$workdir/trs +!endef + $(TEST_SUITE_LOG): $(am__test_logs) $(am__test_results) + $(am.setup-test-harness-workdir) @$(am__sh_e_setup); $(am__tty_colors); \ fatal () { echo "fatal: making $@: $$*" >&2; exit 1; }; \ -## Detect a possible circular dependency, and error out. - case ' $(strip $(am__test_logs)) ' in *' $(TEST_SUITE_LOG) '*) \ - fatal "depends on itself (check TESTS content)";; \ - esac; \ + workdir='$(am.test-harness.workdir)'; \ +## Detect a possible circular dependency, and error out if it's found. + grep '^$(TEST_SUITE_LOG:.log=)$$' $$workdir/bases \ + && fatal "depends on itself (check TESTS content)"; \ ws='[ ]'; \ count_result () \ { \ - r='$(strip $(am__test_results))'; \ - r=`grep "^$$ws*:test-result:$$ws*$${1-}" $$r $(TEST_SUITE_LOG).tmp; then \ mv -f $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ @@ -386,9 +411,7 @@ am__mostlyclean_files += $(TEST_SUITE_LOG) ## ------------------------------------------ ## am__remove_if_not_lazy_check = \ -## Expand the given list only once, to avoid exceeding line length limits. - $(if $(filter yes,$(AM_LAZY_CHECK)),, \ - list='$(strip $(1))'; test -z "$$list" || rm -f $$list) + $(if $(filter yes,$(AM_LAZY_CHECK)),,$(call .am.clean-cmd.f,$1)) check-TESTS: @$(call am__remove_if_not_lazy_check,$(am__test_results)) @@ -407,16 +430,21 @@ check-TESTS: ## 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% + +$(am.setup-test-harness-workdir) ## 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) - @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 \ + @bases=`while read b; do echo $$b; done \ + <$(am.test-harness.workdir)/bases \ | $(am__list_recheck_tests)` || exit 1; \ ## Remove newlines and normalize whitespace. bases=`echo $$bases`; \ +## FIXME: This could still cause command line length limits to be exceeded. +## But that could happen only if a huge number of tests had failed in the +## previous run, in which case we could expect the user to run "make check" +## for safeness. So, is this limitation worth lifting or not? $(MAKE) $(TEST_SUITE_LOG) .am/doing-recheck=yes am__test_bases="$$bases" .PHONY: recheck