blob: 9edeef3d2a80f6b4b906c1bc4bf6d8de40c000d2 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
;; -*- emacs-lisp -*-
;; Copyright (C) 2015-2016 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This file generates dependencies between test files and the files
;; that they test.
;; It has an .emacs-lisp extension because it makes the Makefile easier!
(require 'seq)
(defun make-test-deps (src-dir)
(let ((src-dir (file-truename src-dir)))
(message
"%s"
(concat
(make-test-deps-lisp src-dir)
(make-test-deps-src src-dir)))))
(defun make-test-deps-lisp (src-dir)
(mapconcat
(lambda (file-without-suffix)
(format "./%s-tests.log: %s/../%s.el\n"
file-without-suffix
src-dir
file-without-suffix))
(make-test-test-files src-dir "lisp") ""))
(defun make-test-deps-src (src-dir)
(mapconcat
(lambda (file-without-suffix)
(format "./%s-tests.log: %s/../%s.c\n"
file-without-suffix
src-dir
file-without-suffix))
(make-test-test-files src-dir "src") ""))
(defun make-test-test-files (src-dir sub-src-dir)
(make-test-munge-files
src-dir
(directory-files-recursively
(concat src-dir "/" sub-src-dir)
".*-tests.el$")))
(defun make-test-munge-files (src-dir files)
(make-test-sans-suffix
(make-test-de-stem
src-dir
(make-test-no-legacy
(make-test-no-test-dir
(make-test-no-resources
files))))))
(defun make-test-sans-suffix (files)
(mapcar
(lambda (file)
(substring file 0 -9))
files))
(defun make-test-de-stem (stem files)
(mapcar
(lambda (file)
(substring
file
(+ 1 (length stem))))
files))
(defun make-test-no-legacy (list)
(make-test-remove list "legacy/"))
(defun make-test-no-resources (list)
(make-test-remove list "-resources/"))
(defun make-test-no-test-dir (list)
(make-test-remove list "-tests/"))
(defun make-test-remove (list match)
(seq-remove
(lambda (file)
(string-match-p match file))
list))
|