diff options
| author | Noam Postavsky | 2017-05-30 23:31:18 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-05-31 07:43:54 -0400 |
| commit | 94306c8b0d61a53b19dcee18475ea8692b001f5d (patch) | |
| tree | 33b806f50e88a57098139209f6113af4bf94c435 | |
| parent | 7b4a0e2884004f44f3bdebecbcdfb6b6dcf99fdd (diff) | |
| download | emacs-94306c8b0d61a53b19dcee18475ea8692b001f5d.tar.gz emacs-94306c8b0d61a53b19dcee18475ea8692b001f5d.zip | |
Further simplify test/Makefile, optionally load elc tests
* test/Makefile.in: Use make's error ignoring feature instead of
suppressing test errors with shell. Compile test files in the main
make invocation instead of a recursive 'make' call. Optionally load
.elc test files if TEST_LOAD_EL is set to something other than 'yes'.
Remove obsolete commentary.
| -rw-r--r-- | test/Makefile.in | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 8880ee21936..0d1663a4cdd 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -81,6 +81,10 @@ GDB = | |||
| 81 | # supported everywhere. | 81 | # supported everywhere. |
| 82 | TEST_LOCALE = C | 82 | TEST_LOCALE = C |
| 83 | 83 | ||
| 84 | # Whether to run tests from .el files in preference to .elc, we do | ||
| 85 | # this by default since it gives nicer stacktraces. | ||
| 86 | TEST_LOAD_EL ?= yes | ||
| 87 | |||
| 84 | # The actual Emacs command run in the targets below. | 88 | # The actual Emacs command run in the targets below. |
| 85 | # Prevent any setting of EMACSLOADPATH in user environment causing problems. | 89 | # Prevent any setting of EMACSLOADPATH in user environment causing problems. |
| 86 | emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ | 90 | emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ |
| @@ -91,26 +95,6 @@ emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ | |||
| 91 | 95 | ||
| 92 | all: check | 96 | all: check |
| 93 | 97 | ||
| 94 | %.elc: %.el | ||
| 95 | $(AM_V_ELC)$(emacs) -f batch-byte-compile $< | ||
| 96 | |||
| 97 | ## Ignore any test errors so we can continue to test other files. | ||
| 98 | ## But compilation errors are always fatal. | ||
| 99 | WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@ | ||
| 100 | |||
| 101 | ## I'd prefer to use -emacs -f ert-run-tests-batch-and-exit rather | ||
| 102 | ## than || true, since the former makes problems more obvious. | ||
| 103 | ## I'd also prefer to @-hide the grep part and not the | ||
| 104 | ## ert-run-tests-batch-and-exit part. | ||
| 105 | ## | ||
| 106 | ## We need to use $loadfile because: | ||
| 107 | ## i) -L :$srcdir -l basename does not work, because we have files whose | ||
| 108 | ## basename duplicates a file in lisp/ (eg eshell.el). | ||
| 109 | ## ii) Although -l basename will automatically load .el or .elc, | ||
| 110 | ## -l ./basename treats basename as a literal file (it would be nice | ||
| 111 | ## to change this; bug#17848 - if that gets done, this can be simplified). | ||
| 112 | ## | ||
| 113 | ## Beware: it approximates 'no-byte-compile', so watch out for false-positives! | ||
| 114 | SELECTOR_DEFAULT = (quote (not (tag :expensive-test))) | 98 | SELECTOR_DEFAULT = (quote (not (tag :expensive-test))) |
| 115 | SELECTOR_EXPENSIVE = nil | 99 | SELECTOR_EXPENSIVE = nil |
| 116 | ifdef SELECTOR | 100 | ifdef SELECTOR |
| @@ -127,16 +111,23 @@ else | |||
| 127 | SELECTOR_ACTUAL=$(SELECTOR_EXPENSIVE) | 111 | SELECTOR_ACTUAL=$(SELECTOR_EXPENSIVE) |
| 128 | endif | 112 | endif |
| 129 | 113 | ||
| 130 | ## Byte-compile all test files to test for errors (unless explicitly | 114 | ## Byte-compile all test files to test for errors. |
| 131 | ## told not to), but then evaluate the un-byte-compiled files, because | 115 | %.elc: %.el |
| 132 | ## they give cleaner stacktraces. | 116 | $(AM_V_ELC)$(emacs) -f batch-byte-compile $< |
| 117 | |||
| 118 | ## Save logs, and show logs for failed tests. | ||
| 119 | WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; } | ||
| 120 | |||
| 121 | ifeq ($(TEST_LOAD_EL), yes) | ||
| 122 | testloadfile = $*.el | ||
| 123 | else | ||
| 124 | testloadfile = $* | ||
| 125 | endif | ||
| 133 | 126 | ||
| 134 | ## Beware: it approximates 'no-byte-compile', so watch out for false-positives! | 127 | ## Ignore any test errors so we can continue to test other files. |
| 135 | %.log: %.el | 128 | %.log: %.elc |
| 136 | $(AM_V_at)grep '^;.*no-byte-compile: t' $< > /dev/null || ${MAKE} $<c | ||
| 137 | $(AM_V_at)${MKDIR_P} $(dir $@) | 129 | $(AM_V_at)${MKDIR_P} $(dir $@) |
| 138 | $(AM_V_GEN)stat=OK ; \ | 130 | -$(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \ |
| 139 | HOME=/nonexistent $(emacs) -l ert -l $< \ | ||
| 140 | --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} | 131 | --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} |
| 141 | 132 | ||
| 142 | ifeq (@HAVE_MODULES@, yes) | 133 | ifeq (@HAVE_MODULES@, yes) |