aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2017-12-16 20:06:11 -0500
committerNoam Postavsky2018-06-12 07:26:06 -0400
commitb6b793bd77cb8be0a2d2745262e53037dc6798a0 (patch)
treea2fb24fea13f9ca429424aecfa2bd1be0d48d0f5
parent1aa906f10d3a5dc3905c2f74cddbfd8c6cb8eb7a (diff)
downloademacs-b6b793bd77cb8be0a2d2745262e53037dc6798a0.tar.gz
emacs-b6b793bd77cb8be0a2d2745262e53037dc6798a0.zip
; test/Makefile.in: Add TEST_INTERACTIVE option (Bug#31744).
* test/README: Note the new option.
-rw-r--r--test/Makefile.in33
-rw-r--r--test/README6
2 files changed, 33 insertions, 6 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index e6b3f77523c..451513a7474 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -81,7 +81,7 @@ EMACS_EXTRAOPT=
81# Command line flags for Emacs. 81# Command line flags for Emacs.
82# Apparently MSYS bash would convert "-L :" to "-L ;" anyway, 82# Apparently MSYS bash would convert "-L :" to "-L ;" anyway,
83# but we might as well be explicit. 83# but we might as well be explicit.
84EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT) 84EMACSOPT = --no-init-file --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT)
85 85
86# Prevent any settings in the user environment causing problems. 86# Prevent any settings in the user environment causing problems.
87unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS 87unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS
@@ -94,6 +94,15 @@ GDB =
94# supported everywhere. 94# supported everywhere.
95TEST_LOCALE = C 95TEST_LOCALE = C
96 96
97# Set this to 'yes' to run the tests in an interactive instance.
98TEST_INTERACTIVE ?= no
99
100ifeq ($(TEST_INTERACTIVE),yes)
101TEST_RUN_ERT = --eval "(ert ${SELECTOR_ACTUAL})"
102else
103TEST_RUN_ERT = --batch --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
104endif
105
97# Whether to run tests from .el files in preference to .elc, we do 106# Whether to run tests from .el files in preference to .elc, we do
98# this by default since it gives nicer stacktraces. 107# this by default since it gives nicer stacktraces.
99TEST_LOAD_EL ?= yes 108TEST_LOAD_EL ?= yes
@@ -120,6 +129,11 @@ emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \
120 EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ 129 EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \
121 $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT) 130 $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT)
122 131
132# Set HOME to a nonexistent directory to prevent tests from accessing
133# it accidentally (e.g., popping up a gnupg dialog if ~/.authinfo.gpg
134# exists, or writing to ~/.bzr.log when running bzr commands).
135TEST_HOME = /nonexistent
136
123test_module_dir := $(srcdir)/data/emacs-module 137test_module_dir := $(srcdir)/data/emacs-module
124 138
125.PHONY: all check 139.PHONY: all check
@@ -128,7 +142,7 @@ all: check
128 142
129SELECTOR_DEFAULT = (quote (not (or (tag :expensive-test) (tag :unstable)))) 143SELECTOR_DEFAULT = (quote (not (or (tag :expensive-test) (tag :unstable))))
130SELECTOR_EXPENSIVE = (quote (not (tag :unstable))) 144SELECTOR_EXPENSIVE = (quote (not (tag :unstable)))
131SELECTOR_ALL = nil 145SELECTOR_ALL = t
132ifdef SELECTOR 146ifdef SELECTOR
133SELECTOR_ACTUAL=$(SELECTOR) 147SELECTOR_ACTUAL=$(SELECTOR)
134else ifndef MAKECMDGOALS 148else ifndef MAKECMDGOALS
@@ -145,7 +159,7 @@ endif
145 159
146## Byte-compile all test files to test for errors. 160## Byte-compile all test files to test for errors.
147%.elc: %.el 161%.elc: %.el
148 $(AM_V_ELC)$(emacs) -f batch-byte-compile $< 162 $(AM_V_ELC)$(emacs) --batch -f batch-byte-compile $<
149 163
150## Save logs, and show logs for failed tests. 164## Save logs, and show logs for failed tests.
151WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; } 165WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; }
@@ -158,9 +172,9 @@ endif
158 172
159%.log: %.elc 173%.log: %.elc
160 $(AM_V_at)${MKDIR_P} $(dir $@) 174 $(AM_V_at)${MKDIR_P} $(dir $@)
161 $(AM_V_GEN)HOME=/nonexistent $(emacs) \ 175 $(AM_V_GEN)HOME=$(TEST_HOME) $(emacs) \
162 -l ert ${ert_opts} -l $(testloadfile) \ 176 -l ert ${ert_opts} -l $(testloadfile) \
163 --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} 177 $(TEST_RUN_ERT)
164 178
165ifeq (@HAVE_MODULES@, yes) 179ifeq (@HAVE_MODULES@, yes)
166maybe_exclude_module_tests := 180maybe_exclude_module_tests :=
@@ -260,8 +274,15 @@ check-maybe: check-no-automated-subdir
260## We can't put LOGFILES as prerequisites, because that would stop the 274## We can't put LOGFILES as prerequisites, because that would stop the
261## summarizing step from running when there is an error. 275## summarizing step from running when there is an error.
262check-doit: 276check-doit:
277ifeq ($(TEST_INTERACTIVE), yes)
278 HOME=$(TEST_HOME) $(emacs) \
279 -l ert ${ert_opts} \
280 $(patsubst %,-l %,$(if $(findstring $(TEST_LOAD_EL),yes),$ELFILES,$(ELFILES:.el=))) \
281 $(TEST_RUN_ERT)
282else
263 -@${MAKE} -k ${LOGFILES} 283 -@${MAKE} -k ${LOGFILES}
264 @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit ${LOGFILES} 284 @$(emacs) --batch -l ert -f ert-summarize-tests-batch-and-exit ${LOGFILES}
285endif
265 286
266.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean 287.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
267 288
diff --git a/test/README b/test/README
index 1cd9db3bb88..c1dde2e0d01 100644
--- a/test/README
+++ b/test/README
@@ -50,6 +50,12 @@ nicer backtraces. To run the compiled version of a test use
50 50
51 make TEST_LOAD_EL=no ... 51 make TEST_LOAD_EL=no ...
52 52
53The tests are run in batch mode by default; sometimes it's useful to
54get precisely the same environment but run in interactive mode for
55debugging. To do that, use
56
57 make TEST_INTERACTIVE=yes ...
58
53 59
54(Also, see etc/compilation.txt for compilation mode font lock tests.) 60(Also, see etc/compilation.txt for compilation mode font lock tests.)
55 61