]> code.delx.au - gnu-emacs/blobdiff - test/Makefile.in
Add a new function `buffer-hash'
[gnu-emacs] / test / Makefile.in
index 1e76675ac76207cdd2e1d1c9bdb709c5c4cb3e55..26d7e591c7a2b23b77fa5064418d3c4512a6d47a 100644 (file)
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2010-2015 Free Software Foundation, Inc.
+# Copyright (C) 2010-2016 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -21,7 +21,8 @@
 
 ## Some targets:
 ## check: re-run all tests, writing to .log files.
-## check-maybe: run all tests whose .log file needs updating
+## check-maybe: run all tests which are outdated with their .log file
+## or the source files they are testing.
 ## filename.log: run tests from filename.el(c) if .log file needs updating
 ## filename: re-run tests from filename.el(c), with no logging
 
@@ -32,6 +33,8 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 VPATH = $(srcdir)
 
+MKDIR_P = @MKDIR_P@
+
 SEPCHAR = @SEPCHAR@
 
 # We never change directory before running Emacs, so a relative file
@@ -87,6 +90,23 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
 ## 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!
+SELECTOR_DEFAULT = (quote (not (tag :expensive-test)))
+SELECTOR_EXPENSIVE = nil
+ifdef SELECTOR
+SELECTOR_ACTUAL=$(SELECTOR)
+else ifndef MAKECMDGOALS
+SELECTOR_ACTUAL=$(SELECTOR_DEFAULT)
+else ifeq ($(MAKECMDGOALS),all)
+SELECTOR_ACTUAL=$(SELECTOR_DEFAULT)
+else ifeq ($(MAKECMDGOALS),check)
+SELECTOR_ACTUAL=$(SELECTOR_DEFAULT)
+else ifeq ($(MAKECMDGOALS),check-maybe)
+SELECTOR_ACTUAL=$(SELECTOR_DEFAULT)
+else
+SELECTOR_ACTUAL=$(SELECTOR_EXPENSIVE)
+endif
+
+
 %.log: %.el
        @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
          loadfile=$<; \
@@ -96,9 +116,9 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
        fi; \
        echo Testing $$loadfile; \
        stat=OK ; \
-       mkdir --parents $(dir $@) ; \
+       ${MKDIR_P} $(dir $@) ; \
        $(emacs) -l ert -l $$loadfile \
-         -f ert-run-tests-batch-and-exit ${WRITE_LOG}
+         --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
 
 ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
                -path "*resources" -prune -o -name "*el" -print)
@@ -129,24 +149,39 @@ endef
 $(foreach test,${TESTS},$(eval $(call test_template,${test})))
 
 ## Include dependencies between test files and the files they test.
-## We do this without the file and eval directly, but then we would
-## have to run Emacs for every make invocation, and it might not be
-## available during clean.
+## We could do this without the file and eval directly, but then we
+## would have to run Emacs for every make invocation, and it might not
+## be available during clean.
 -include make-test-deps.mk
-
-## Re-run all the tests every time.
-check:
-       -@for f in $(LOGFILES); do test ! -f $$f || mv $$f $$f~; done
-       @${MAKE} check-maybe
-
-## Only re-run tests whose .log is older than the test.
+## Rerun all default tests.
+check: mostlyclean
+       @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
+
+## Rerun all default and expensive tests.
+.PHONY: check-expensive
+check-expensive: mostlyclean
+       @${MAKE} check-doit SELECTOR="${SELECTOR_EXPENSIVE}"
+
+## Re-run all tests which are outdated. A test is outdated if its
+## logfile is out-of-date with either the test file, or the source
+## files that the tests depend on. The source file dependencies are
+## determined by a heuristic and does not identify the full dependency
+## graph. See make-test-deps.emacs-lisp for details.
 .PHONY: check-maybe
-check-maybe: ${LOGFILES}
+check-maybe:
+       @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
+
+## Run the tests.
+.PHONY: check-doit
+check-doit: ${LOGFILES}
        $(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^
 
 .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
 
-clean mostlyclean:
+mostlyclean:
+       -@for f in ${LOGFILES}; do test ! -f $$f || mv $$f $$f~; done
+
+clean:
        -rm -f ${LOGFILES} ${LOGSAVEFILES}
        -rm make-test-deps.mk