That feature is to be deprecated in the 1.11.x series, and removed from the automake core in the 1.12 release, where it will instead be offered in a semi-independent extra '*.am' fragment. So let's start better separating the .log -> .html conversion from the "core code" of the parallel-tests harness.
Reference: <http://lists.gnu.org/archive/html/automake/2012-01/msg00005.html> * lib/am/check.am (.log.html, check-html, recheck-html): Move these targets ... * automake.in (handle_tests): ... and the initialization of the TEST_SUITE_HTML variable and the cleaning of the $(TEST_SUITE_HTML) file ... * lib/am/check-html.am: ... in this new file, with related (minor) refactorings, enhancements and simplifications. * lib/am/check.am (.MAKE. PHONY, AM_RECURSIVE_TARGETS): Adjust. * lib/am/Makefile.am (dist_am_DATA): Add 'check-html.am'. * tests/parallel-tests2.test: Improve coverage. --- automake.in | 2 - lib/am/Makefile.am | 3 +- lib/am/check-html.am | 78 ++++++++++++++++++++++++++++++++++++++++++++ lib/am/check.am | 58 ++++++++------------------------ tests/parallel-tests2.test | 20 +++++++++++ 5 files changed, 115 insertions(+), 46 deletions(-) create mode 100644 lib/am/check-html.am diff --git a/automake.in b/automake.in index a689b63..96376d0 100644 --- a/automake.in +++ b/automake.in @@ -4971,7 +4971,6 @@ sub handle_tests if (option 'parallel-tests') { define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL); my $suff = '.test'; my $at_exeext = ''; my $handle_exeext = exists $configure_vars{'EXEEXT'}; @@ -5087,7 +5086,6 @@ sub handle_tests $clean_files{'$(TEST_LOGS_TMP)'} = MOSTLY_CLEAN; $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_HTML)'} = MOSTLY_CLEAN; } } } diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index a255f70..7b37989 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -3,7 +3,7 @@ ## Makefile for Automake lib/am. # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2008, -# 2009 Free Software Foundation, Inc. +# 2009, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ amdir = $(pkgvdatadir)/am dist_am_DATA = \ ansi2knr.am \ check.am \ +check-html.am \ check2.am \ clean-hdr.am \ clean.am \ diff --git a/lib/am/check-html.am b/lib/am/check-html.am new file mode 100644 index 0000000..7cbdf8a --- /dev/null +++ b/lib/am/check-html.am @@ -0,0 +1,78 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +## Free Software Foundation, Inc. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +## Makefile.am fragment to produce HTML output from RST-formatted +## log files produced by the parallel-tests output. +## This fragment was part of the automake core in the 1.11.x release +## series, but is to be moved out in the 1.12 release. + +TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) + +mostlyclean-am: am--mostlyclean-test-html +.PHONY: am--mostlyclean-test-html +am--mostlyclean-test-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) + +.log.html: + @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ + for r2h in $$list; do \ + if ($$r2h --version) >/dev/null 2>&1; then \ + R2H=$$r2h; \ + fi; \ + done; \ + if test -z "$$R2H"; then \ + echo >&2 "cannot find rst2html, cannot create $@"; \ + exit 2; \ + fi; \ + $$R2H $< >$@.tmp + @mv $@.tmp $@ + +# Be sure to run check first, and then to convert the result. +# 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: + @if $(MAKE) $(AM_MAKEFLAGS) check; then \ + rv=0; else rv=$$?; \ + fi; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4; \ + exit $$rv + +## Rerun all FAILed or XPASSed tests. +recheck-html: + @list='' list2='$(TEST_LOGS)'; \ + for f in $$list2; do \ + test -f $$f || continue; \ + if test -r $$f && read line < $$f; then \ + case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ + fi; \ +## Be careful to avoid extra whitespace in the definition of $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 was known to cause a segmentation fault on Solaris 10 XPG4 make: +## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html> + if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ + done; \ + $(MAKE) $(AM_MAKEFLAGS) check-html AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' + +AM_RECURSIVE_TARGETS += check-html recheck-html + +.PHONY: check-html recheck-html +.MAKE: check-html recheck-html diff --git a/lib/am/check.am b/lib/am/check.am index 29faa38..bca7763 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -1,6 +1,6 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011 Free -## Software Foundation, Inc. +## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +## Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -259,48 +259,14 @@ check-TESTS: AM_RECURSIVE_TARGETS += check -## -------------- ## -## Produce HTML. ## -## -------------- ## - -.log.html: - @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ - for r2h in $$list; do \ - if ($$r2h --version) >/dev/null 2>&1; then \ - R2H=$$r2h; \ - fi; \ - done; \ - if test -z "$$R2H"; then \ - echo >&2 "cannot find rst2html, cannot create $@"; \ - exit 2; \ - fi; \ - $$R2H $< >$@.tmp - @mv $@.tmp $@ - -# Be sure to run check first, and then to convert the result. -# 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: - @if $(MAKE) $(AM_MAKEFLAGS) check; then \ - rv=0; else rv=$$?; \ - fi; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4; \ - exit $$rv - -.PHONY: check-html -.MAKE: check-html - -AM_RECURSIVE_TARGETS += check-html - ## -------------------- ## ## Rechecking failures. ## ## -------------------- ## ## Rerun all FAILed or XPASSed tests. -recheck recheck-html: - @target=`echo $@ | sed 's,^re,,'`; \ - list='' list2='$(TEST_LOGS)'; for f in $$list2; do \ +recheck: + @list='' list2='$(TEST_LOGS)'; \ + for f in $$list2; do \ test -f $$f || continue; \ if test -r $$f && read line < $$f; then \ case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ @@ -313,12 +279,18 @@ recheck recheck-html: ## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html> if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ done; \ - $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' + $(MAKE) $(AM_MAKEFLAGS) check AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' + +.PHONY: recheck +.MAKE: recheck + +AM_RECURSIVE_TARGETS += recheck -.PHONY: recheck recheck-html -.MAKE: recheck recheck-html +## ----------------------------------------------- ## +## Produce HTML. To be removed in automake 1.12. ## +## ----------------------------------------------- ## -AM_RECURSIVE_TARGETS += recheck recheck-html +include check-html.am else !%?PARALLEL_TESTS% diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test index 9cfe14f..aa2afef 100755 --- a/tests/parallel-tests2.test +++ b/tests/parallel-tests2.test @@ -76,6 +76,26 @@ env TESTS=foo.test $MAKE -e recheck-html >stdout || { cat stdout; Exit 1; } cat stdout test -f mylog.html +# Create HTML output for an individual test. +$MAKE foo.html +grep 'this is .*foo\.test' foo.html +test ! -f bar.html +test ! -f baz.html + +# Create HTML output for individual tests. Since the pre-existing log +# files are expected to be used for the HTML conversion, this should +# go smoothly even for failed tests. +$MAKE bar.html baz.html +grep 'this is .*bar\.test' bar.html +grep 'this is .*baz\.test' baz.html + +# HTML output removed by mostlyclean. +$MAKE mostlyclean +test ! -f foo.html +test ! -f bar.html +test ! -f baz.html +test ! -f mylog.html + # check-html and recheck-html should cause check_SCRIPTS to be created, # and recheck-html should rerun no tests if check has not been run. $MAKE clean -- 1.7.7.3