Disable logging in the short form of the test Makefile rules
authorGlenn Morris <rgm@gnu.org>
Sat, 28 Jun 2014 17:05:00 +0000 (10:05 -0700)
committerGlenn Morris <rgm@gnu.org>
Sat, 28 Jun 2014 17:05:00 +0000 (10:05 -0700)
* test/automated/Makefile.in (WRITE_LOG): New variable.
(%.log): Use WRITE_LOG.
(test_template): Disable logging.

test/ChangeLog
test/automated/Makefile.in

index f67fad9..fca8c2b 100644 (file)
@@ -1,5 +1,9 @@
 2014-06-28  Glenn Morris  <rgm@gnu.org>
 
+       * automated/Makefile.in (WRITE_LOG): New variable.
+       (%.log): Use WRITE_LOG.
+       (test_template): Disable logging.
+
        * automated/Makefile.in (TESTS): New list of short PHONY aliases.
        (test_template): New definition.  Apply to TESTS.
 
index da14fda..b769ead 100644 (file)
 ### Commentary:
 
 ## Some targets:
-## check: re-run all tests
+## check: re-run all tests, writing to .log files.
 ## check-maybe: run all tests whose .log file needs updating
 ## filename.log: run tests from filename.el(c) if .log file needs updating
-## filename: re-run tests from filename.el(c)
+## filename: re-run tests from filename.el(c), with no logging
 
 ### Code:
 
@@ -60,10 +60,9 @@ all: check
        @$(emacs) -f batch-byte-compile $<
 
 ## Ignore any test errors so we can continue to test other files.
-## (It would be nice if we could get an error when running an
-## individual test, but not when running check.)
 ## But compilation errors are always fatal.
-##
+WRITE_LOG = >& $@ || { stat=ERROR; cat $@; }; echo $$stat: $@
+
 ## I'd prefer to use -emacs -f ert-run-tests-batch-and-exit rather
 ## than || true, since the former makes problems more obvious.
 ## I'd also prefer to @-hide the grep part and not the
@@ -74,7 +73,7 @@ all: check
 ## basename duplicates a file in lisp/ (eg eshell.el).
 ## ii) Although -l basename will automatically load .el or .elc,
 ## -l ./basename treats basename as a literal file (it would be nice
-## to change this).
+## to change this; bug#17848 - if that gets done, this can be simplified).
 ##
 ## Beware: it approximates `no-byte-compile', so watch out for false-positives!
 %.log: ${srcdir}/%.el
@@ -87,10 +86,7 @@ all: check
        echo Testing $$loadfile; \
        stat=OK ; \
        $(emacs) -l ert -l $$loadfile \
-         -f ert-run-tests-batch-and-exit >& $@ || { \
-           stat=ERROR; \
-           cat $@; }; \
-       echo $$stat: $@
+         -f ert-run-tests-batch-and-exit ${WRITE_LOG}
 
 ELFILES = $(wildcard ${srcdir}/*.el)
 LOGFILES = $(patsubst %.el,%.log,$(notdir ${ELFILES}))
@@ -102,11 +98,11 @@ TESTS = ${LOGFILES:.log=}
 
 .PHONY: ${TESTS}
 
-## The short aliases that always re-run the tests.
+## The short aliases that always re-run the tests, with no logging.
 define test_template
 $(1):
        @test ! -f $(1).log || mv $(1).log $(1).log~
-       @${MAKE} $(1).log
+       @${MAKE} $(1).log WRITE_LOG=
 endef
 
 $(foreach test,${TESTS},$(eval $(call test_template,${test})))