From: Stefano Lattarini Date: Sat, 11 Aug 2012 19:51:28 +0000 (+0200) Subject: [ng] contrib: rewrite and fix 'check-html' and 'recheck-html' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40f7fa0c2341f7d350a854f041e8ba5b7c9f5bfd;p=thirdparty%2Fautomake.git [ng] contrib: rewrite and fix 'check-html' and 'recheck-html' That has actually been broken for some time, due to the changes done in Automake-NG proper in the meantime. * contrib/check-html.am (.log.html): Re-declare this suffix rule ... (%.html: %.log): ... as a pattern rule. (mostlyclean-check-html): Remove, instead ... (MOSTLYCLEANFILES): ... appending to this variable. Not only this reduce the code size, but will give us resilience against possible exceeded command line length limits for free. (check-html, recheck-html): Rewrite as static pattern rules. Fix the recursive "make check" and "make recheck" invocation to override TESTS, not TEST_LOGS (the latter override is not honoured anymore by the new incarnation of the parallel-test rules). * contrib/t/parallel-tests-html-recursive.sh: Adjust a little, by initializing 'MOSTLYCLEANFILES' (to empty) in all the 'Makefile.am' files that use 'check-html.am'. * contrib/t/parallel-tests-html.sh: Likewise. Also, since the parallel-tests API does not allow command-line overriding of TEST_LOGS anymore, stop doing that. Signed-off-by: Stefano Lattarini --- diff --git a/contrib/check-html.am b/contrib/check-html.am index 2604c5ec8..ddcb5015c 100644 --- a/contrib/check-html.am +++ b/contrib/check-html.am @@ -21,14 +21,11 @@ TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) -mostlyclean-local: mostlyclean-check-html -.PHONY: mostlyclean-check-html -mostlyclean-check-html: -## Expand $(TEST_LOGS) only once, to avoid exceeding line length limits. - list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list - rm -f $(TEST_SUITE_HTML) +## This expects MOSTLYCLEANFILES to be pre-defined by the clients (even +## if just to the empty value). Not ans unreasonable request. +MOSTLYCLEANFILES += $(TEST_SUITE_HTML) $(TEST_LOGS:.log=.html) -.log.html: +%.html: %.log @list='$(RST2HTML) rst2html rst2html.py'; \ while :; do \ for r2h in $$list; do \ @@ -45,12 +42,11 @@ mostlyclean-check-html: # 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 recheck-html: - @target=`echo $@ | sed 's/-html$$//'`; \ - rv=0; $(MAKE) $$target || rv=$$?; \ -## The nullification of $(TEST_LOGS) is required to ensure that +check-html recheck-html: %-html: + @rv=0; $(MAKE) $* || rv=$$?; \ +## The nullification of $(TESTS) is required to ensure that ## "make recheck-html" do not try to uselessly re-run tests. - $(MAKE) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \ + $(MAKE) $(TEST_SUITE_HTML) TESTS= || exit 4; \ exit $$rv .PHONY: check-html recheck-html diff --git a/contrib/t/parallel-tests-html-recursive.sh b/contrib/t/parallel-tests-html-recursive.sh index 12d967ecf..e58cca904 100755 --- a/contrib/t/parallel-tests-html-recursive.sh +++ b/contrib/t/parallel-tests-html-recursive.sh @@ -34,6 +34,9 @@ cp "$am_top_srcdir"/contrib/check-html.am . \ cat >> configure.ac << 'END' AM_EXTRA_RECURSIVE_TARGETS([check-html]) +# This variable must be defined in each Makefile.am that includes +# 'check-html.am'. It's simpler to do this once here. +AC_SUBST([MOSTLYCLEANFILES], []) AC_CONFIG_FILES([sub/Makefile sub/more/Makefile]) AC_OUTPUT END @@ -106,7 +109,6 @@ test ! -f test.log test -f x.txt END - cat > sub/more/mu << 'END' #!/bin/sh exit 99 diff --git a/contrib/t/parallel-tests-html.sh b/contrib/t/parallel-tests-html.sh index 78cae7a19..6e853ab07 100755 --- a/contrib/t/parallel-tests-html.sh +++ b/contrib/t/parallel-tests-html.sh @@ -45,6 +45,8 @@ check_SCRIPTS = bla bla: echo bla > $@ CLEANFILES = bla +## Initialization of this required by 'check-html.am', below. +MOSTLYCLEANFILES = include $(srcdir)/check-html.am END @@ -120,7 +122,7 @@ test ! -e mylog.html $MAKE clean test ! -e mylog.html -$MAKE check-html TEST_LOGS=foo.log +$MAKE check-html TESTS=foo test -f bla test -f foo.log test ! -e bar.log