emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0baf45d 1/4: Tests now depend on source files


From: Phillip Lord
Subject: [Emacs-diffs] master 0baf45d 1/4: Tests now depend on source files
Date: Mon, 30 Nov 2015 21:36:18 +0000

branch: master
commit 0baf45dbe3dfeb9f5fc03a3213ceeccb170643cf
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>

    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
---
 .gitignore                     |    2 +
 test/Makefile.in               |    5 ++
 test/make-test-deps.emacs-lisp |   89 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index e83760b..6821791 100644
--- a/.gitignore
+++ b/.gitignore
@@ -153,6 +153,8 @@ test/manual/etags/srclist
 test/manual/etags/regexfile
 test/manual/etags/ETAGS
 test/manual/etags/CTAGS
+# Generated by test/make-test-deps.emacs-lisp
+test/make-test-deps.mk
 
 # ctags, etags.
 TAGS
diff --git a/test/Makefile.in b/test/Makefile.in
index d3a8eb9..4d8a802 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -125,6 +125,7 @@ endef
 
 $(foreach test,${TESTS},$(eval $(call test_template,${test})))
 
+-include make-test-deps.mk
 
 ## Re-run all the tests every time.
 check:
@@ -149,4 +150,8 @@ distclean: clean
 
 maintainer-clean: distclean bootstrap-clean
 
+make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
+       ../src/emacs --batch -l make-test-deps.emacs-lisp \
+       --eval "(make-test-deps \"`pwd`\")" \
+       2> $@
 # Makefile ends here.
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp
new file mode 100644
index 0000000..563b3bf
--- /dev/null
+++ b/test/make-test-deps.emacs-lisp
@@ -0,0 +1,89 @@
+;; -*- emacs-lisp -*-
+
+;; The contents of this file are subject to the GPL License, Version 3.0.
+;;
+;; Copyright (C) 2015, Free Software Foundation
+;;
+;; This program 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.
+;;
+;; This program 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 this program.  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 (directory)
+  (message
+   "%s"
+   (concat
+    (make-test-deps-lisp directory)
+    (make-test-deps-src directory))))
+
+(defun make-test-deps-lisp (directory)
+  (mapconcat
+   (lambda (stem)
+     (format "%s-tests.log: ../%s.elc\n" stem stem))
+   (make-test-test-files directory "lisp") ""))
+
+(defun make-test-deps-src (directory)
+  (mapconcat
+   (lambda (stem)
+     (format "%s-tests.log: ../%s.o\n" stem stem))
+   (make-test-test-files directory "src") ""))
+
+(defun make-test-test-files (stem dir)
+  (make-test-munge-files
+   stem
+   (directory-files-recursively dir ".*-tests.el$")))
+
+(defun make-test-munge-files (stem files)
+  (make-test-sans-suffix
+   (make-test-de-stem
+    stem
+    (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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]