aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhillip Lord2015-11-28 23:13:24 +0000
committerPhillip Lord2015-11-30 21:32:31 +0000
commit0baf45dbe3dfeb9f5fc03a3213ceeccb170643cf (patch)
treed6e6e0603d53e0428e0db75b82442a7b2c1ad220 /test
parentcbfb129555482c582fe875766680bf8179c0588c (diff)
downloademacs-0baf45dbe3dfeb9f5fc03a3213ceeccb170643cf.tar.gz
emacs-0baf45dbe3dfeb9f5fc03a3213ceeccb170643cf.zip
Tests now depend on source files
* test/Makefile.in: Include dependences from tests to source files. * test/make-test-deps.emacs-lisp: New file * .gitignore: Ignore generated make include file
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in5
-rw-r--r--test/make-test-deps.emacs-lisp89
2 files changed, 94 insertions, 0 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index d3a8eb90420..4d8a802ca36 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -125,6 +125,7 @@ endef
125 125
126$(foreach test,${TESTS},$(eval $(call test_template,${test}))) 126$(foreach test,${TESTS},$(eval $(call test_template,${test})))
127 127
128-include make-test-deps.mk
128 129
129## Re-run all the tests every time. 130## Re-run all the tests every time.
130check: 131check:
@@ -149,4 +150,8 @@ distclean: clean
149 150
150maintainer-clean: distclean bootstrap-clean 151maintainer-clean: distclean bootstrap-clean
151 152
153make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
154 ../src/emacs --batch -l make-test-deps.emacs-lisp \
155 --eval "(make-test-deps \"`pwd`\")" \
156 2> $@
152# Makefile ends here. 157# Makefile ends here.
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp
new file mode 100644
index 00000000000..563b3bf6722
--- /dev/null
+++ b/test/make-test-deps.emacs-lisp
@@ -0,0 +1,89 @@
1;; -*- emacs-lisp -*-
2
3;; The contents of this file are subject to the GPL License, Version 3.0.
4;;
5;; Copyright (C) 2015, Free Software Foundation
6;;
7;; This program 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;; This program 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 this program. 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 (directory)
30 (message
31 "%s"
32 (concat
33 (make-test-deps-lisp directory)
34 (make-test-deps-src directory))))
35
36(defun make-test-deps-lisp (directory)
37 (mapconcat
38 (lambda (stem)
39 (format "%s-tests.log: ../%s.elc\n" stem stem))
40 (make-test-test-files directory "lisp") ""))
41
42(defun make-test-deps-src (directory)
43 (mapconcat
44 (lambda (stem)
45 (format "%s-tests.log: ../%s.o\n" stem stem))
46 (make-test-test-files directory "src") ""))
47
48(defun make-test-test-files (stem dir)
49 (make-test-munge-files
50 stem
51 (directory-files-recursively dir ".*-tests.el$")))
52
53(defun make-test-munge-files (stem files)
54 (make-test-sans-suffix
55 (make-test-de-stem
56 stem
57 (make-test-no-legacy
58 (make-test-no-test-dir
59 (make-test-no-resources
60 files))))))
61
62(defun make-test-sans-suffix (files)
63 (mapcar
64 (lambda (file)
65 (substring file 0 -9))
66 files))
67
68(defun make-test-de-stem (stem files)
69 (mapcar
70 (lambda (file)
71 (substring
72 file
73 (+ 1 (length stem))))
74 files))
75
76(defun make-test-no-legacy (list)
77 (make-test-remove list "legacy/"))
78
79(defun make-test-no-resources (list)
80 (make-test-remove list "-resources/"))
81
82(defun make-test-no-test-dir (list)
83 (make-test-remove list "-tests/"))
84
85(defun make-test-remove (list match)
86 (seq-remove
87 (lambda (file)
88 (string-match-p match file))
89 list))