From 20d99e05c9286ded040131e89c0c90a70334ed05 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 8 Jan 2012 19:26:18 +0100 Subject: docs: deprecate .log -> .html conversion by parallel-tests That feature is to be deprecated in the 1.11.x series, and removed in the 1.12 release. Reference: * doc/automake.texi (Simple Tests using parallel-tests): Deprecate the '.log' -> '.html' conversion and the targets 'check-html' and 'recheck-html'. Related rewording and reformatting. * NEWS (Future backward-incompatibilities): Update. --- NEWS | 4 ++++ doc/automake.texi | 38 ++++++++++++++++---------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index bd334fd6d..172889cad 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ New in 1.11.0a: * WARNING: Future backward-incompatibilities! + - The support for ".log -> .html" conversion and the check-html and + recheck-html targets will be removed in the next major Automake + release (1.12). + - The `lzma' compression format for distribution archives has been deprecated in favor of `xz' and `lzip', and will be removed in the next major Automake release (1.12). diff --git a/doc/automake.texi b/doc/automake.texi index 0c4dc0166..cb31053cd 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -8829,17 +8829,17 @@ by the tests, not the tests themselves. Of course you can set @section Simple Tests using @samp{parallel-tests} @cindex @option{parallel-tests}, Using -The option @option{parallel-tests} (@pxref{Options}) enables a test -suite driver that is mostly compatible to the simple test driver described -in the previous section, but provides a few more features and slightly different -semantics. It features concurrent execution of tests with @code{make -j}, -allows to specify inter-test dependencies, lazy reruns of tests that -have not completed in a prior run, summary and verbose output in -@samp{RST} (reStructuredText) and @samp{HTML} format, and hard errors -for exceptional failures. Similar to the simple test driver, -@code{TESTS_ENVIRONMENT}, @code{AM_COLOR_TESTS}, @code{XFAIL_TESTS}, and -the @code{check_*} variables are honored, and the environment variable -@env{srcdir} is set during test execution. +The option @option{parallel-tests} (@pxref{Options}) enables a test suite +driver that is mostly compatible to the simple test driver described in +the previous section, but provides a few more features and slightly +different semantics. It features concurrent execution of tests with +@code{make -j} and automatic collection of the test scripts output and +summary thereof in @file{.log} files, and allows to specify inter-test +dependencies, lazy reruns of tests that have not completed in a prior +run, and hard errors for exceptional failures. Similar to the simple +test driver, @code{TESTS_ENVIRONMENT}, @code{AM_COLOR_TESTS}, +@code{XFAIL_TESTS}, and the @code{check_*} variables are honored, +and the environment variable @env{srcdir} is set during test execution. This test driver is still experimental and may undergo changes in order to satisfy additional portability requirements. @@ -8918,16 +8918,13 @@ intermingled output. The output from failed tests is collected in the file is output after the summary. For best results, the tests should be verbose by default now. -@trindex mostlyclean @trindex check-html @vindex RST2HTML @vindex TEST_SUITE_HTML -With @code{make check-html}, the log files may be converted from RST -(reStructuredText, see @uref{http://docutils.sourceforge.net/@/rst.html}) -to HTML using @samp{RST2HTML}, which defaults to @command{rst2html} or -@command{rst2html.py}. The variable @samp{TEST_SUITE_HTML} contains the -set of converted log files. The log and HTML files are removed upon -@code{make mostlyclean}. +Previous versions of automake used to provide a @code{check-html} target +to convert the log files to HTML. This feature is now deprecated, and +@emph{will be removed} in the next major Automake release, so don't rely +on it anymore. @vindex DISABLE_HARD_ERRORS @cindex Exit status 99, special interpretation @@ -9002,13 +8999,10 @@ env RECHECK_LOGS= make -e check @item @trindex recheck -@trindex recheck-html You can ensure that all tests are rerun which have failed or passed unexpectedly, by running @code{make recheck} in the test directory. This convenience target will set @code{RECHECK_LOGS} appropriately -before invoking the main test driver. The @code{recheck-html} target -does the same as @code{recheck} but again converts the resulting log -file in HTML format, like the @code{check-html} target. +before invoking the main test driver. @end itemize In order to guarantee an ordering between tests even with @code{make -- cgit v1.2.1 From 20f2ac90d14d04caef07c6e445e7b3e582374701 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 13 Jan 2012 17:56:13 +0100 Subject: check: separate .log -> .html conversion from core testsuite harness 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: * 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 eb859e2fd..28f256ce1 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 a255f701d..7b37989db 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 000000000..7cbdf8a67 --- /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 . + +## 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: +## + 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 29faa3813..bca776316 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: ## 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 9cfe14fc1..aa2afef5e 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 -- cgit v1.2.1 From d9a7182ed15654aebdd049857282106e84962813 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 13 Jan 2012 18:53:43 +0100 Subject: recheck: behave better with non-GNU make * automake.in (handle_tests): Also substitute '%CHECK_DEPS%' with the value of the '@check' array, containing the list of early test dependencies like '$(check_SCRIPTS)', $(check_PROGRAMS)', etc. * lib/am/check.am (recheck): Explicitly depend on '%CHECK_DEPS%'. (check, recheck): Unify the implementation of their recipes, with different code paths taken depending on the name of the target. This makes the implementation of "recheck" less brittle in the process (especially when non-GNU make and AM_MAKEFLAGS overriding are involved). * lib/am/check-html.am (check-html, recheck-html): Likewise. * tests/check.test: Adjust to avoid spurious failure. * tests/parallel-tests2.test: Improve coverage. --- automake.in | 4 +++- lib/am/check-html.am | 29 ++++++------------------- lib/am/check.am | 54 ++++++++++++++++++++++------------------------ tests/check.test | 4 ++-- tests/parallel-tests2.test | 15 +++++++++++++ 5 files changed, 52 insertions(+), 54 deletions(-) diff --git a/automake.in b/automake.in index 28f256ce1..efa2aa225 100644 --- a/automake.in +++ b/automake.in @@ -4958,9 +4958,11 @@ sub handle_tests if (var ('TESTS')) { push (@check_tests, 'check-TESTS'); + my $check_deps = "@check"; $output_rules .= &file_contents ('check', new Automake::Location, COLOR => !! option 'color-tests', - PARALLEL_TESTS => !! option 'parallel-tests'); + PARALLEL_TESTS => !! option 'parallel-tests', + CHECK_DEPS => $check_deps); # Tests that are known programs should have $(EXEEXT) appended. # For matching purposes, we need to adjust XFAIL_TESTS as well. diff --git a/lib/am/check-html.am b/lib/am/check-html.am index 7cbdf8a67..13f0a47a8 100644 --- a/lib/am/check-html.am +++ b/lib/am/check-html.am @@ -47,31 +47,14 @@ am--mostlyclean-test-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: - @if $(MAKE) $(AM_MAKEFLAGS) check; then \ - rv=0; else rv=$$?; \ - fi; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4; \ +check-html recheck-html: + @target=`echo $@ | sed 's/-html$$//'`; \ + rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \ +## The nullification of $(TEST_LOGS) is required to ensure that +## "make recheck-html" do not try to uselessly re-run tests. + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || 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: -## - 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 diff --git a/lib/am/check.am b/lib/am/check.am index bca776316..47561ae6d 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -233,15 +233,18 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) RECHECK_LOGS = $(TEST_LOGS) -# Run all the tests. -check-TESTS: +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). + @if test $@ != recheck; then \ ## Expand $(RECHECK_LOGS) only once, to avoid exceeding line length limits. - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \ + fi ## 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 happen with a prior `make TESTS='), -## then we get no log output. +## or a prior run plus reruns all happen within the same timestamp (can +## happen with a prior `make TESTS='), then we get no log output. ## OTOH, this means that, in the rule for `$(TEST_SUITE_LOG)', we ## cannot use `$?' to compute the set of lazily rerun tests, lest ## we rely on .PHONY to work portably. @@ -251,25 +254,13 @@ check-TESTS: ## 3.80 to erroneously expand $(TESTS_LOGS) to `foo.log .log'. ## Work around this bug. test .log = $$f && continue; \ -## Be careful to avoid extra whitespace in the definition of $list. See -## comments in `recheck' below for why this might be useful. - if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ - done; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" - -AM_RECURSIVE_TARGETS += check - -## -------------------- ## -## Rechecking failures. ## -## -------------------- ## - -## Rerun all FAILed or XPASSed tests. -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; \ +## If running a "make recheck", we must only consider tests that had +## an unexpected outcome (FAIL or XPASS) in the earlier run. + if test $@ = recheck; then \ + test -f $$f || continue; \ + if test -r $$f && read line < $$f; then \ + case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ + fi; \ 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 @@ -279,13 +270,20 @@ recheck: ## if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ done; \ - $(MAKE) $(AM_MAKEFLAGS) check AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' +## Under "make recheck", remove the logs of the files to recheck, so that +## those will be rerun by the "make test-suite.log" recursive invocation +## below. + test $@ != recheck || test -z "$$list" || rm -f $$list || exit 1; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" + +## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc. +recheck: %CHECK_DEPS% + +AM_RECURSIVE_TARGETS += check recheck .PHONY: recheck .MAKE: recheck -AM_RECURSIVE_TARGETS += recheck - ## ----------------------------------------------- ## ## Produce HTML. To be removed in automake 1.12. ## ## ----------------------------------------------- ## diff --git a/tests/check.test b/tests/check.test index 0c258c5eb..300122821 100755 --- a/tests/check.test +++ b/tests/check.test @@ -29,8 +29,8 @@ END $ACLOCAL $AUTOMAKE -grep '^check-TESTS:' Makefile.in -grep '^check-DEJAGNU' Makefile.in && Exit 1 +grep 'check-TESTS.*:' Makefile.in +grep 'check-DEJAGNU' Makefile.in && Exit 1 # check-TESTS is phony. sed -n '/^\.PHONY:/,/^$/p' Makefile.in | grep check-TESTS diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test index aa2afef5e..78d5a762c 100755 --- a/tests/parallel-tests2.test +++ b/tests/parallel-tests2.test @@ -98,12 +98,27 @@ 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 +test ! -f mylog.html env TESTS=foo.test $MAKE -e check-html test -f bla +test -f foo.log +test ! -f bar.log +test ! -f baz.log + $MAKE clean env TESTS=foo.test $MAKE -e recheck-html test -f bla test ! -f foo.log test -f mylog.html + +$MAKE clean +$MAKE recheck-html +test -f bla +test ! -f foo.log +test ! -f bar.log +test ! -f baz.log +test -f mylog.html + : -- cgit v1.2.1 From 8fec2399264ee4822ecf2c0d9275d890edbc8e50 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 13 Jan 2012 22:39:47 +0100 Subject: recheck: fix interaction with "make -n" * lib/am/check.am (recheck): Ensure the recipe does not erroneously remove '.log' files when running under "make -n". For the sake of NetBSD make, this also means that ... (.MAKE): ... this cannot depend on 'recheck' anymore. * tests/parallel-tests-dryrun.test: New test. * tests/list-of-tests.mk: Add it. --- lib/am/check.am | 9 ++-- tests/list-of-tests.mk | 1 + tests/parallel-tests-dryrun.test | 93 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 3 deletions(-) create mode 100755 tests/parallel-tests-dryrun.test diff --git a/lib/am/check.am b/lib/am/check.am index 47561ae6d..e0a453b32 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -272,8 +272,12 @@ check-TESTS recheck: done; \ ## Under "make recheck", remove the logs of the files to recheck, so that ## those will be rerun by the "make test-suite.log" recursive invocation -## below. - test $@ != recheck || test -z "$$list" || rm -f $$list || exit 1; \ +## below. But use a proper hack to avoid extra files removal when running +## under "make -n". + if test $@ = recheck && test -n "$$list"; then \ + echo "am--clean: ; rm -f $$list" \ + | $(MAKE) $(AM_MAKEFLAGS) -f - am--clean || exit 1; \ + fi; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc. @@ -282,7 +286,6 @@ recheck: %CHECK_DEPS% AM_RECURSIVE_TARGETS += check recheck .PHONY: recheck -.MAKE: recheck ## ----------------------------------------------- ## ## Produce HTML. To be removed in automake 1.12. ## diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index 9d95e1858..e88ad1a4d 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -617,6 +617,7 @@ parallel-tests7.test \ parallel-tests8.test \ parallel-tests9.test \ parallel-tests10.test \ +parallel-tests-dryrun.test \ parallel-tests-harderror.test \ parallel-tests-unreadable-log.test \ parallel-tests-subdir.test \ diff --git a/tests/parallel-tests-dryrun.test b/tests/parallel-tests-dryrun.test new file mode 100755 index 000000000..c79a29386 --- /dev/null +++ b/tests/parallel-tests-dryrun.test @@ -0,0 +1,93 @@ +#! /bin/sh +# Copyright (C) 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 . + +# Check parallel-tests interactions with "make -n". + +parallel_tests=yes +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am <<'END' +TESTS = foo.test bar.test +$(TESTS): +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +# Avoid confusion with test logs. +rm -f config.log + +log_files='test-suite.log foo.log bar.log' +html_files='test-suite.html foo.html bar.html' +the_files="$log_files $html_files" + +all_exist () +{ + st=0 + for i in $*; do + test -f $i || { echo File $i not found; st=1; } + done + test $st -eq 0 +} + +none_exist () +{ + st=0 + for i in $*; do + { test -r $i || test -f $i; } && { echo File $i found; st=1; } + done + test $st -eq 0 +} + +for targ in check recheck check-html recheck-html $the_files; do + $MAKE -n "$targ" + none_exist $the_files +done + +touch $the_files + +$MAKE -n mostlyclean +all_exist $the_files +$MAKE -n clean +all_exist $the_files + +cat > foo.test <<'END' +#! /bin/sh +exit 0 +END + +cat > bar.test <<'END' +#! /bin/sh +exit 1 +END + +chmod a+x foo.test bar.test + +$MAKE check && Exit 1 + +for targ in recheck recheck-html clean mostlyclean distclean; do + $MAKE -n "$targ" + all_exist $the_files +done + +: -- cgit v1.2.1