diff options
| author | Noam Postavsky | 2017-12-16 20:06:11 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2018-06-12 07:26:06 -0400 |
| commit | b6b793bd77cb8be0a2d2745262e53037dc6798a0 (patch) | |
| tree | a2fb24fea13f9ca429424aecfa2bd1be0d48d0f5 | |
| parent | 1aa906f10d3a5dc3905c2f74cddbfd8c6cb8eb7a (diff) | |
| download | emacs-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.in | 33 | ||||
| -rw-r--r-- | test/README | 6 |
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. |
| 84 | EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT) | 84 | EMACSOPT = --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. |
| 87 | unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS | 87 | unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS |
| @@ -94,6 +94,15 @@ GDB = | |||
| 94 | # supported everywhere. | 94 | # supported everywhere. |
| 95 | TEST_LOCALE = C | 95 | TEST_LOCALE = C |
| 96 | 96 | ||
| 97 | # Set this to 'yes' to run the tests in an interactive instance. | ||
| 98 | TEST_INTERACTIVE ?= no | ||
| 99 | |||
| 100 | ifeq ($(TEST_INTERACTIVE),yes) | ||
| 101 | TEST_RUN_ERT = --eval "(ert ${SELECTOR_ACTUAL})" | ||
| 102 | else | ||
| 103 | TEST_RUN_ERT = --batch --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} | ||
| 104 | endif | ||
| 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. |
| 99 | TEST_LOAD_EL ?= yes | 108 | TEST_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). | ||
| 135 | TEST_HOME = /nonexistent | ||
| 136 | |||
| 123 | test_module_dir := $(srcdir)/data/emacs-module | 137 | test_module_dir := $(srcdir)/data/emacs-module |
| 124 | 138 | ||
| 125 | .PHONY: all check | 139 | .PHONY: all check |
| @@ -128,7 +142,7 @@ all: check | |||
| 128 | 142 | ||
| 129 | SELECTOR_DEFAULT = (quote (not (or (tag :expensive-test) (tag :unstable)))) | 143 | SELECTOR_DEFAULT = (quote (not (or (tag :expensive-test) (tag :unstable)))) |
| 130 | SELECTOR_EXPENSIVE = (quote (not (tag :unstable))) | 144 | SELECTOR_EXPENSIVE = (quote (not (tag :unstable))) |
| 131 | SELECTOR_ALL = nil | 145 | SELECTOR_ALL = t |
| 132 | ifdef SELECTOR | 146 | ifdef SELECTOR |
| 133 | SELECTOR_ACTUAL=$(SELECTOR) | 147 | SELECTOR_ACTUAL=$(SELECTOR) |
| 134 | else ifndef MAKECMDGOALS | 148 | else 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. |
| 151 | WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; } | 165 | WRITE_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 | ||
| 165 | ifeq (@HAVE_MODULES@, yes) | 179 | ifeq (@HAVE_MODULES@, yes) |
| 166 | maybe_exclude_module_tests := | 180 | maybe_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. |
| 262 | check-doit: | 276 | check-doit: |
| 277 | ifeq ($(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) | ||
| 282 | else | ||
| 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} |
| 285 | endif | ||
| 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 | ||
| 53 | The tests are run in batch mode by default; sometimes it's useful to | ||
| 54 | get precisely the same environment but run in interactive mode for | ||
| 55 | debugging. 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 | ||