]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] check: AM_LAZY_CHECK="yes", not RECHECK_TESTS="", for lazy re-runs
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 8 May 2012 09:23:38 +0000 (11:23 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 16 May 2012 08:04:59 +0000 (10:04 +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 <stefano.lattarini@gmail.com>
NG-NEWS
defs
doc/automake.texi
lib/am/check.am
syntax-checks.mk
t/README
t/parallel-tests-extra-programs.sh
t/parallel-tests.sh
t/tap-lazy-check.sh [moved from t/tap-recheck-logs.sh with 77% similarity]
t/test-trs-recover.sh

diff --git a/NG-NEWS b/NG-NEWS
index 1f638b6db1951bd9c282ba5194efe3f6eb5ed863..b28fcccd6a930acc10bf5ad9e442756925639a6c 100644 (file)
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -113,6 +113,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.
+
 Pattern rules and suffix rules
 ==============================
 
diff --git a/defs b/defs
index 36f298ce737657acc183e888a5b5ce910df95f8e..32b60b6347a2dd654f7742c783e2228b8272b934 100644 (file)
--- 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
index 471c2a42178d1e59af09e4eed0e290d87f03176c..046ab5f89eddd4f74b5202e9befbd7212908a1e3 100644 (file)
@@ -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
-@c FIXME: this should become "RECHECK_TESTS", for consistency.
-@c FIXME: this will imply a change to the API, of course.
-@vindex RECHECK_LOGS
+@vindex AM_LAZY_CHECK
 @cindex lazy test execution
-By default, the test harness removes all old per-test @file{.log} and
-@file{.trs} 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
+@file{.trs} 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
-@code{recheck} target, @code{RECHECK_LOGS} variable, and lazy reruns
-of tests;
+@code{recheck} target and on-demand lazy reruns of tests;
 @item
 inter-test dependencies;
 @item
index 77f31c56010f139eecf0219c28dbc0f75a9015af..428242cc44e218aa9c0b5790c47b9691acf6f3b3 100644 (file)
@@ -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
index 420d737328e616e5d6912b4fae69527b10ea66fa..9804378d00834bce3aa6cad730e1f49473410768 100644 (file)
@@ -67,6 +67,7 @@ sc_no_DIST_SOURCES \
 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 \
@@ -336,6 +337,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
@@ -482,7 +498,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:
index f1cdc5ff6a0372d114ecaf06bda8200a0f1bd7c0..8628f1e218836feea2604cc16a4d70e63dc9e2d0 100644 (file)
--- 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:
 
index a42bb5d2c5d3c64d5a74e363309911cf500227f8..8cc2df7d20804da3ad808380031174688d793139 100755 (executable)
@@ -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
index 63949a2fb311a87c49d38f2d757f80e7ca3ef52f..538ee75509344d13e7025eb4ef1e37a40333934f 100755 (executable)
@@ -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
similarity index 77%
rename from t/tap-recheck-logs.sh
rename to t/tap-lazy-check.sh
index 36a59ca7af3b93bb19dfd51a22ded43d3a2a4987..de92c3d6b98bae1f2cf45aa0250c34174dec7d63 100755 (executable)
@@ -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
-
 :
index de3b77191283378599003b4ff7d98472c37cc234..25cb363681870edaa1ec845f3028582648e75ecf 100755 (executable)
@@ -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