aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--test/Makefile.in31
-rw-r--r--test/make-test-deps.emacs-lisp98
3 files changed, 11 insertions, 119 deletions
diff --git a/.gitignore b/.gitignore
index ce1866d616b..aa9e1ff709e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,7 +141,6 @@ src/*.map
141 141
142# Tests. 142# Tests.
143test/indent/*.new 143test/indent/*.new
144test/make-test-deps.mk
145test/manual/biditest.txt 144test/manual/biditest.txt
146test/manual/etags/srclist 145test/manual/etags/srclist
147test/manual/etags/regexfile 146test/manual/etags/regexfile
diff --git a/test/Makefile.in b/test/Makefile.in
index c0056b6f44d..d218b640057 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -124,12 +124,12 @@ endif
124 $(emacs) -l ert -l $$loadfile \ 124 $(emacs) -l ert -l $$loadfile \
125 --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} 125 --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
126 126
127ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \ 127ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
128 -path "*resources" -prune -o -name "*el" -print) 128 -name "*resources" -prune -o -name "*.el" -print)
129## .log files may be in a different directory for out of source builds 129## .log files may be in a different directory for out of source builds
130LOGFILES = $(patsubst %.el,%.log, \ 130LOGFILES := $(patsubst %.el,%.log, \
131 $(patsubst $(srcdir)%,.%,$(ELFILES))) 131 $(patsubst $(srcdir)%,.%,$(ELFILES)))
132TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=)) 132TESTS := $(subst ${srcdir}/,,$(LOGFILES:.log=))
133 133
134## If we have to interrupt a hanging test, preserve the log so we can 134## If we have to interrupt a hanging test, preserve the log so we can
135## see what the problem was. 135## see what the problem was.
@@ -141,6 +141,11 @@ TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
141## Define an alias both with and without the directory name for ease 141## Define an alias both with and without the directory name for ease
142## of use. 142## of use.
143define test_template 143define test_template
144 ifeq (,$(patsubst $(srcdir)/src/%,,$(1)))
145 $(1): $(srcdir)/../src/$(1:.log=.c)
146 else
147 $(1): $(srcdir)/../lisp/$(1:.log=.el)
148 endif
144$(1): 149$(1):
145 @test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~ 150 @test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~
146 @${MAKE} ./$(1).log WRITE_LOG= 151 @${MAKE} ./$(1).log WRITE_LOG=
@@ -157,11 +162,6 @@ $(foreach test,${TESTS},$(eval $(call test_template,${test})))
157check-no-automated-subdir: 162check-no-automated-subdir:
158 test ! -d $(srcdir)/automated 163 test ! -d $(srcdir)/automated
159 164
160## Include dependencies between test files and the files they test.
161## We could do this without the file and eval directly, but then we
162## would have to run Emacs for every make invocation, and it might not
163## be available during clean.
164-include make-test-deps.mk
165## Rerun all default tests. 165## Rerun all default tests.
166check: mostlyclean check-no-automated-subdir 166check: mostlyclean check-no-automated-subdir
167 @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" 167 @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
@@ -175,7 +175,7 @@ check-expensive: mostlyclean check-no-automated-subdir
175## logfile is out-of-date with either the test file, or the source 175## logfile is out-of-date with either the test file, or the source
176## files that the tests depend on. The source file dependencies are 176## files that the tests depend on. The source file dependencies are
177## determined by a heuristic and does not identify the full dependency 177## determined by a heuristic and does not identify the full dependency
178## graph. See make-test-deps.emacs-lisp for details. 178## graph. See test_template for details.
179.PHONY: check-maybe 179.PHONY: check-maybe
180check-maybe: check-no-automated-subdir 180check-maybe: check-no-automated-subdir
181 @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" 181 @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
@@ -183,7 +183,7 @@ check-maybe: check-no-automated-subdir
183## Run the tests. 183## Run the tests.
184.PHONY: check-doit 184.PHONY: check-doit
185check-doit: ${LOGFILES} 185check-doit: ${LOGFILES}
186 $(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^ 186 @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^
187 187
188.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean 188.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
189 189
@@ -193,7 +193,6 @@ mostlyclean:
193 193
194clean: 194clean:
195 find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE) 195 find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE)
196 rm -f make-test-deps.mk
197 196
198bootstrap-clean: clean 197bootstrap-clean: clean
199 find $(srcdir) -name '*.elc' $(FIND_DELETE) 198 find $(srcdir) -name '*.elc' $(FIND_DELETE)
@@ -202,11 +201,3 @@ distclean: clean
202 rm -f Makefile 201 rm -f Makefile
203 202
204maintainer-clean: distclean bootstrap-clean 203maintainer-clean: distclean bootstrap-clean
205
206make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
207 $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
208 --eval "(make-test-deps \"$(srcdir)\")" \
209 2> $@.tmp
210 # Hack to elide any CANNOT_DUMP=yes chatter.
211 sed '/\.log: /!d' $@.tmp >$@
212 rm -f $@.tmp
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp
deleted file mode 100644
index 609e9276186..00000000000
--- a/test/make-test-deps.emacs-lisp
+++ /dev/null
@@ -1,98 +0,0 @@
1;; -*- emacs-lisp -*-
2
3;; Copyright (C) 2015-2017 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;; This file generates dependencies between test files and the files
23;; that they test.
24
25;; It has an .emacs-lisp extension because it makes the Makefile easier!
26
27(require 'seq)
28
29(defun make-test-deps (src-dir)
30 (let ((src-dir (file-truename src-dir)))
31 (message
32 "%s"
33 (concat
34 (make-test-deps-lisp src-dir)
35 (make-test-deps-src src-dir)))))
36
37(defun make-test-deps-lisp (src-dir)
38 (mapconcat
39 (lambda (file-without-suffix)
40 (format "./%s-tests.log: %s/../%s.el\n"
41 file-without-suffix
42 src-dir
43 file-without-suffix))
44 (make-test-test-files src-dir "lisp") ""))
45
46(defun make-test-deps-src (src-dir)
47 (mapconcat
48 (lambda (file-without-suffix)
49 (format "./%s-tests.log: %s/../%s.c\n"
50 file-without-suffix
51 src-dir
52 file-without-suffix))
53 (make-test-test-files src-dir "src") ""))
54
55(defun make-test-test-files (src-dir sub-src-dir)
56 (make-test-munge-files
57 src-dir
58 (directory-files-recursively
59 (concat src-dir "/" sub-src-dir)
60 ".*-tests.el$")))
61
62(defun make-test-munge-files (src-dir files)
63 (make-test-sans-suffix
64 (make-test-de-stem
65 src-dir
66 (make-test-no-legacy
67 (make-test-no-test-dir
68 (make-test-no-resources
69 files))))))
70
71(defun make-test-sans-suffix (files)
72 (mapcar
73 (lambda (file)
74 (substring file 0 -9))
75 files))
76
77(defun make-test-de-stem (stem files)
78 (mapcar
79 (lambda (file)
80 (substring
81 file
82 (+ 1 (length stem))))
83 files))
84
85(defun make-test-no-legacy (list)
86 (make-test-remove list "legacy/"))
87
88(defun make-test-no-resources (list)
89 (make-test-remove list "-resources/"))
90
91(defun make-test-no-test-dir (list)
92 (make-test-remove list "-tests/"))
93
94(defun make-test-remove (list match)
95 (seq-remove
96 (lambda (file)
97 (string-match-p match file))
98 list))