summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-01-16 18:35:50 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-01-16 18:35:50 +0100
commit3d6197fe647445ecbcfaac6c004449246471d5b6 (patch)
tree5adf87662b33a7df7c6dcaad4b5c5930e4c7c6a2
parent12dc0ec5e3c7e1a12569d5cfdbb8ceaa5a5f5f58 (diff)
parent8fec2399264ee4822ecf2c0d9275d890edbc8e50 (diff)
downloadautomake-3d6197fe647445ecbcfaac6c004449246471d5b6.tar.gz
Merge branch 'check-html-deprecate' into maint
* check-html-deprecate: recheck: fix interaction with "make -n" recheck: behave better with non-GNU make check: separate .log -> .html conversion from core testsuite harness docs: deprecate .log -> .html conversion by parallel-tests
-rw-r--r--NEWS4
-rw-r--r--automake.in6
-rw-r--r--doc/automake.texi38
-rw-r--r--lib/am/Makefile.am3
-rw-r--r--lib/am/check-html.am61
-rw-r--r--lib/am/check.am103
-rwxr-xr-xtests/check.test4
-rw-r--r--tests/list-of-tests.mk1
-rwxr-xr-xtests/parallel-tests-dryrun.test93
-rwxr-xr-xtests/parallel-tests2.test35
10 files changed, 255 insertions, 93 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/automake.in b/automake.in
index 50a9d8730..24d5872dd 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.
@@ -4971,7 +4973,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 +5088,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/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
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..13f0a47a8
--- /dev/null
+++ b/lib/am/check-html.am
@@ -0,0 +1,61 @@
+## 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 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
+
+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..e0a453b32 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
@@ -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=<subset>'),
-## 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=<subset>'), 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,59 +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
-
-## -------------- ##
-## 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 \
- 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
@@ -313,12 +270,28 @@ 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"'"'
+## 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. 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.
+recheck: %CHECK_DEPS%
+
+AM_RECURSIVE_TARGETS += check recheck
+
+.PHONY: 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/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/list-of-tests.mk b/tests/list-of-tests.mk
index fd095b326..6e4412f5d 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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+:
diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test
index 9cfe14fc1..78d5a762c 100755
--- a/tests/parallel-tests2.test
+++ b/tests/parallel-tests2.test
@@ -76,14 +76,49 @@ 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
+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
+
: