[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 08/11] [ng] check: AM_LAZY_CHECK="yes", not RECHECK
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 08/11] [ng] check: AM_LAZY_CHECK="yes", not RECHECK_TESTS="", for lazy re-runs |
Date: |
Wed, 9 May 2012 11:30:13 +0200 |
This causes a backward-incompatibility with mainline automake, but will
also offer a cleaner API and a possibility to further simplify the
implementation of the 'check' and 'recheck' targets in the future.
* doc/automake.texi, NG-NEWS, t/README: Update.
* lib/am/check.am (am__remove_if_not_lazy_check): New internal function,
expanding to shell code that removes the given list of files unless the
'AM_LAZY_CHECK' variable is set to "yes".
(check-TESTS): Use it instead of the contents of 'RECHECK_LOGS' top
decide which .log and .trs files to remove.
(RECHECK_LOGS): Don't define anymore.
* t/parallel-tests.sh: Adjust.
* t/parallel-tests-extra-programs.sh: Likewise.
* t/test-trs-recover.sh: Likewise.
* t/tap-recheck-logs.sh: Rename ...
* t/tap-lazy-check.sh: ... to this, and adjust.
* defs: Don't unset 'RECHECK_LOGS'; unset 'AM_LAZY_CHECK' instead.
* syntax-checks.mk: Adjust some comments.
(sc_no_RECHECK_LOGS): New maintainer check, guard against uses of
the now-obsolete 'RECHECK_LOGS' variable.
(syntax_check_rules): Add it.
Signed-off-by: Stefano Lattarini <address@hidden>
---
NG-NEWS | 10 ++++++++++
defs | 2 +-
doc/automake.texi | 27 ++++++++++----------------
lib/am/check.am | 13 +++++++------
syntax-checks.mk | 18 ++++++++++++++++-
t/README | 2 +-
t/parallel-tests-extra-programs.sh | 2 +-
t/parallel-tests.sh | 16 +++------------
t/{tap-recheck-logs.sh => tap-lazy-check.sh} | 24 ++++++-----------------
t/test-trs-recover.sh | 2 +-
10 files changed, 57 insertions(+), 59 deletions(-)
rename t/{tap-recheck-logs.sh => tap-lazy-check.sh} (77%)
diff --git a/NG-NEWS b/NG-NEWS
index da2fb20..6a66622 100644
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -118,6 +118,16 @@ Parallel testsuite harness
# "foo.test", "bar.test$(EXEEXT)" and "baz$(EXEEXT)".
make check TESTS="foo bar baz"
+* The use of 'RECHECK_LOGS' is not supported anymore. Thus, to lazily
+ re-run only the tests whose '.trs' or '.log' files are out-of-date,
+ one must now use:
+
+ make check AM_LAZY_CHECK=yes # New valid API.
+
+ instead of:
+
+ make check RECHECK_LOGS="" # Old API, won't work anymore.
+
Miscellaneous
=============
diff --git a/defs b/defs
index 36f298c..32b60b6 100644
--- a/defs
+++ b/defs
@@ -162,11 +162,11 @@ unset srcdir
unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
unset DISABLE_HARD_ERRORS
unset AM_COLOR_TESTS
+unset AM_LAZY_CHECK
unset TESTS
unset XFAIL_TESTS
unset TEST_LOGS
unset TEST_SUITE_LOG
-unset RECHECK_LOGS
unset VERBOSE
for pfx in TEST_ SH_ TAP_ ''; do
unset ${pfx}LOG_COMPILER
diff --git a/doc/automake.texi b/doc/automake.texi
index e45c5da..eb17778 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -9100,30 +9100,24 @@ will write the result of the partial testsuite runs to
the
@file{partial.log}, without touching @file{test-suite.log}.
@item
address@hidden FIXME: this should become "RECHECK_TESTS", for consistency.
address@hidden FIXME: this will imply a change to the API, of course.
address@hidden RECHECK_LOGS
address@hidden AM_LAZY_CHECK
@cindex lazy test execution
-By default, the test harness removes all old per-test @file{.log} and
address@hidden files before it starts running tests to regenerate them. The
-variable @code{RECHECK_LOGS} contains the set of @file{.log} (and, by
-implication, @file{.trs}) files which are removed. @code{RECHECK_LOGS}
-defaults to @code{TEST_LOGS}, which means all tests need to be rechecked.
-By overriding this variable, you can choose which tests need to be
-reconsidered. For example, you can lazily rerun only those tests which
-are outdated, i.e., older than their prerequisite test files, by setting
-this variable to the empty value:
+By default, the test harness will run all the tests anew. By setting
+the @code{AM_LAZY_CHECK} variable to @code{"yes"}, you can instruct the
+harness to re-run only those test scripts whose @file{.log} or
address@hidden is out-of-date (or non-existent):
@example
-make check RECHECK_LOGS=
+make check AM_LAZY_CHECK=yes
@end example
+In normal circumstances, this offers a simple way to lazily rerun only
+those tests which are outdated, i.e., older than their prerequisites.
+
@item
@trindex recheck
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 harness.
@end itemize
@noindent
@@ -9219,8 +9213,7 @@ concurrency through the use of @command{make}'s option
@option{-j};
per-test @file{.log} and @file{.trs} files, and generation of a summary
@file{.log} file from them;
@item
address@hidden target, @code{RECHECK_LOGS} variable, and lazy reruns
-of tests;
address@hidden target and on-demand lazy reruns of tests;
@item
inter-test dependencies;
@item
diff --git a/lib/am/check.am b/lib/am/check.am
index 77f31c5..428242c 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -326,17 +326,18 @@ $(TEST_SUITE_LOG): $(am__test_logs) $(am__test_results)
fi; \
$$success || exit 1
-RECHECK_LOGS = $(TEST_LOGS)
-
## ------------------------------------------ ##
## Running all tests, or rechecking failures. ##
## ------------------------------------------ ##
+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)
+
check-TESTS:
-## Here and below, we expand $(RECHECK_LOGS) only once, to avoid exceeding
-## line length limits.
- @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
- @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @$(call am__remove_if_not_lazy_check,$(am__test_results))
+ @$(call am__remove_if_not_lazy_check,$(am__test_logs))
## 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
diff --git a/syntax-checks.mk b/syntax-checks.mk
index c543fea..b797001 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -63,6 +63,7 @@ sc_no_am_makeflags \
sc_no_am_TEST_BASES \
sc_no_am_TEST_RESULTS \
sc_no_am_TEST_LOGS \
+sc_no_RECHECK_LOGS \
sc_tests_no_make_e \
sc_docs_no_make_e \
sc_make_simple_include \
@@ -313,6 +314,21 @@ sc_no_am_TEST_BASES sc_no_am_TEST_RESULTS
sc_no_am_TEST_LOGS: sc_no_am_% :
exit 1; \
fi
+sc_no_RECHECK_LOGS:
+ @files="\
+ $(xtests) \
+ $(pms) \
+ $(ams) \
+ $(srcdir)/doc/*.texi \
+ $(srcdir)/automake.in \
+ README t/README \
+ "; \
+ if grep -F 'RECHECK_LOGS' $$files; then \
+ echo "'RECHECK_LOGS' is obsolete and no more used." >&2; \
+ echo "You should use 'AM_LAZY_CHECK' instead." >&2; \
+ exit 1; \
+ fi
+
## "make -e" is brittle and unsafe, since it let *all* the environment
## win over the macro definitions in the Makefiles. We needed it when
## we couldn't assume GNU make, but now that the tide has turned, it's
@@ -459,7 +475,7 @@ sc_tests_no_configure_in:
## Rule to ensure that the testsuite has been run before. We don't depend
## on 'check' here, because that would be very wasteful in the common case.
-## We could run "make check RECHECK_LOGS=" and avoid toplevel races with
+## We could run "make check AM_LAZY_CHECK=yes" and avoid toplevel races with
## AM_RECURSIVE_TARGETS. Suggest keeping test directories around for
## greppability of the Makefile.in files.
sc_ensure_testsuite_has_run:
diff --git a/t/README b/t/README
index f1cdc5f..8628f1e 100644
--- a/t/README
+++ b/t/README
@@ -27,7 +27,7 @@ Running the tests
To run only tests that are newer than their last results:
- make -k check RECHECK_LOGS=
+ make -k check AM_LAZY_CHECK=yes
To run only selected tests:
diff --git a/t/parallel-tests-extra-programs.sh
b/t/parallel-tests-extra-programs.sh
index a42bb5d..8cc2df7 100755
--- a/t/parallel-tests-extra-programs.sh
+++ b/t/parallel-tests-extra-programs.sh
@@ -152,7 +152,7 @@ $sleep
echo 'int main (void) { return 0; }' > none.c
st=0
-$MAKE check RECHECK_LOGS= >stdout || st=$?
+$MAKE check AM_LAZY_CHECK=yes >stdout || st=$?
cat stdout
ls -l
test $st -eq 0 || Exit 1
diff --git a/t/parallel-tests.sh b/t/parallel-tests.sh
index 63949a2..538ee75 100755
--- a/t/parallel-tests.sh
+++ b/t/parallel-tests.sh
@@ -20,7 +20,7 @@
# - make clean
# - dependencies between tests
# - TESTS redefinition at runtime (with and without test suffixes)
-# - RECHECK_LOGS redefinition at runtime
+# - AM_LAZY_CHECK
am_parallel_tests=yes
. ./defs || Exit 1
@@ -98,7 +98,7 @@ test -f test-suite.log
# Note that the previous test and this one taken together expose the timing
# issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
# before running the tests lazily.
-$MAKE check RECHECK_LOGS= > stdout && { cat stdout; Exit 1; }
+$MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; Exit 1; }
cat stdout
test -f foo.log
grep '^PASS: foo\.test$' stdout
@@ -110,7 +110,7 @@ grep '^# ERROR: *1$' stdout
# Now, explicitly retry with all test logs already updated, and ensure
# that the summary is still displayed.
-$MAKE check RECHECK_LOGS= > stdout && { cat stdout; Exit 1; }
+$MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; Exit 1; }
cat stdout
grep foo.test stdout && Exit 1
grep bar.test stdout && Exit 1
@@ -119,16 +119,6 @@ grep '^# PASS: *1$' stdout
grep '^# FAIL: *1$' stdout
grep '^# ERROR: *1$' stdout
-# Lazily rerunning only foo should only rerun this one test.
-$MAKE check RECHECK_LOGS=foo.log > stdout && { cat stdout; Exit 1; }
-cat stdout
-grep foo.test stdout
-grep bar.test stdout && Exit 1
-grep baz.test stdout && Exit 1
-grep '^# PASS: *1$' stdout
-grep '^# FAIL: *1$' stdout
-grep '^# ERROR: *1$' stdout
-
$MAKE clean
$MAKE check TESTS=baz > stdout && { cat stdout; Exit 1; }
cat stdout
diff --git a/t/tap-recheck-logs.sh b/t/tap-lazy-check.sh
similarity index 77%
rename from t/tap-recheck-logs.sh
rename to t/tap-lazy-check.sh
index 36a59ca..de92c3d 100755
--- a/t/tap-recheck-logs.sh
+++ b/t/tap-lazy-check.sh
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# TAP support:
-# - RECHECK_LOGS
+# TAP support: AM_LAZY_CHECK
am_parallel_tests=yes
. ./defs || Exit 1
@@ -47,7 +46,7 @@ Bail out!
END
# Even the tests that are not re-run should contribute to the testsuite
-# summary when obtained by "make check RECHECK_LOGS=".
+# summary when obtained by "make check AM_LAZY_CHECK=yes".
grep_summary ()
{
grep '^# TOTAL: *4$' stdout
@@ -66,7 +65,7 @@ test -f baz.log
rm -f foo.log bar.log
-$MAKE RECHECK_LOGS= check > stdout && { cat stdout; Exit 1; }
+$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
cat stdout
test -f foo.log
test -f bar.log
@@ -81,7 +80,7 @@ touch foo.test
# We re-run only a successful test, but the tests that failed in the
# previous run should still be taken into account, and cause an overall
# failure.
-$MAKE RECHECK_LOGS= check > stdout && { cat stdout; Exit 1; }
+$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
cat stdout
grep '^PASS: foo\.test 1$' stdout
grep '^PASS: foo\.test 2$' stdout
@@ -91,7 +90,7 @@ grep_summary
$sleep
touch zardoz
-$MAKE RECHECK_LOGS= check > stdout && { cat stdout; Exit 1; }
+$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
cat stdout
grep '^ERROR: baz\.test' stdout
$EGREP '(foo|bar)\.test' stdout && Exit 1
@@ -100,20 +99,9 @@ grep_summary
# Now, explicitly retry with all test logs already updated, and ensure
# that the summary is still displayed.
-$MAKE RECHECK_LOGS= check > stdout && { cat stdout; Exit 1; }
+$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
cat stdout
$EGREP '(foo|bar|baz)\.test' stdout && Exit 1
grep_summary
-# The following should re-run foo.test (and only foo.test), even if its
-# log file is up-to-date.
-: > older
-$MAKE RECHECK_LOGS=foo.log check > stdout && { cat stdout; Exit 1; }
-cat stdout
-grep '^PASS: foo\.test 1$' stdout
-grep '^PASS: foo\.test 2$' stdout
-grep 'ba[rz]\.test' stdout && Exit 1
-is_newest foo.log older
-grep_summary
-
:
diff --git a/t/test-trs-recover.sh b/t/test-trs-recover.sh
index de3b771..25cb363 100755
--- a/t/test-trs-recover.sh
+++ b/t/test-trs-recover.sh
@@ -154,7 +154,7 @@ test -f baz.trs
rm -f foo.trs
update_stamp
touch bar.test
-$MAKE RECHECK_LOGS= check >stdout || { cat stdout; Exit 1; }
+$MAKE AM_LAZY_CHECK=yes check >stdout || { cat stdout; Exit 1; }
cat stdout
# Check that make has updated what it needed to, but no more.
test -f foo.trs
--
1.7.9.5
- [Automake-NG] [PATCH 00/11] Several changes to parallel-tests support, Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 03/11] [ng] check: refactoring to reduce code duplication, Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 04/11] [ng] check: refactor (better names for internal vars), Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 05/11] [ng] check: minor refactoring (reorder code), Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 02/11] [ng] refactor: get rid of am__EXEEXT (automake conditional and %transform), Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 01/11] [ng] check: big refactoring with semantic changes in parallel-tests support, Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 08/11] [ng] check: AM_LAZY_CHECK="yes", not RECHECK_TESTS="", for lazy re-runs,
Stefano Lattarini <=
- [Automake-NG] [PATCH 07/11] [ng] check: refactor: split recipes for check-TESTS and recheck, Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 06/11] [ng] check: minor refactoring (prefer make time over recipe time), Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 11/11] [ng] check: per-suffix dependencies for test cases, Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 10/11] [ng] check: few minor simplifications, Stefano Lattarini, 2012/05/09
- [Automake-NG] [PATCH 09/11] [ng] tests: remove overly picky test cases (and fix few typos), Stefano Lattarini, 2012/05/09
- Re: [Automake-NG] [PATCH 00/11] Several changes to parallel-tests support, Akim Demaille, 2012/05/09