Add short test aliases that always re-run the tests
authorGlenn Morris <rgm@gnu.org>
Sat, 28 Jun 2014 01:11:04 +0000 (21:11 -0400)
committerGlenn Morris <rgm@gnu.org>
Sat, 28 Jun 2014 01:11:04 +0000 (21:11 -0400)
* test/automated/Makefile.in (TESTS): New list of short PHONY aliases.
(test_template): New definition.  Apply to TESTS.

test/ChangeLog
test/automated/Makefile.in

index ba10d90..f67fad9 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-28  Glenn Morris  <rgm@gnu.org>
+
+       * automated/Makefile.in (TESTS): New list of short PHONY aliases.
+       (test_template): New definition.  Apply to TESTS.
+
 2014-06-27  Glenn Morris  <rgm@gnu.org>
 
        * automated/Makefile.in (check-maybe): Rename from check.
index fd5d92c..da14fda 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
+### Commentary:
+
+## Some targets:
+## check: re-run all tests
+## 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)
+
+### Code:
+
 SHELL = @SHELL@
 
 srcdir = @srcdir@
@@ -84,11 +94,24 @@ all: check
 
 ELFILES = $(wildcard ${srcdir}/*.el)
 LOGFILES = $(patsubst %.el,%.log,$(notdir ${ELFILES}))
+TESTS = ${LOGFILES:.log=}
 
 ## If we have to interrupt a hanging test, preserve the log so we can
 ## see what the problem was.
 .PRECIOUS: %.log
 
+.PHONY: ${TESTS}
+
+## The short aliases that always re-run the tests.
+define test_template
+$(1):
+       @test ! -f $(1).log || mv $(1).log $(1).log~
+       @${MAKE} $(1).log
+endef
+
+$(foreach test,${TESTS},$(eval $(call test_template,${test})))
+
+
 ## Re-run all the tests every time.
 check:
        -@for f in *.log; do test ! -f $$f || mv $$f $$f~; done