aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhillip Lord2015-12-01 23:23:12 +0000
committerPhillip Lord2015-12-01 23:23:12 +0000
commit3ab26227cf1ff7eda1847a6c1c581a0bb1031b4f (patch)
tree5e8528c5a10328021200dd30eb21774ce3fed426 /test
parentbd6695f3f5c070a3673d297cced6f2e3b1461f54 (diff)
downloademacs-3ab26227cf1ff7eda1847a6c1c581a0bb1031b4f.tar.gz
emacs-3ab26227cf1ff7eda1847a6c1c581a0bb1031b4f.zip
Tests now support out-of-source-build.
* tests/Makefile.in,test/make-test-deps.emacs-lisp: Remove assumptions about current working directory.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in21
-rw-r--r--test/make-test-deps.emacs-lisp53
2 files changed, 43 insertions, 31 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index b2360fb2847..06a2fb9ce31 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -87,7 +87,7 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
87## to change this; bug#17848 - if that gets done, this can be simplified). 87## to change this; bug#17848 - if that gets done, this can be simplified).
88## 88##
89## Beware: it approximates 'no-byte-compile', so watch out for false-positives! 89## Beware: it approximates 'no-byte-compile', so watch out for false-positives!
90%.log: ${srcdir}/%.el 90%.log: %.el
91 @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \ 91 @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
92 loadfile=$<; \ 92 loadfile=$<; \
93 else \ 93 else \
@@ -96,14 +96,17 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
96 fi; \ 96 fi; \
97 echo Testing $$loadfile; \ 97 echo Testing $$loadfile; \
98 stat=OK ; \ 98 stat=OK ; \
99 mkdir --parents $(dir $@) ; \
99 $(emacs) -l ert -l $$loadfile \ 100 $(emacs) -l ert -l $$loadfile \
100 -f ert-run-tests-batch-and-exit ${WRITE_LOG} 101 -f ert-run-tests-batch-and-exit ${WRITE_LOG}
101 102
102ELFILES = $(shell find ${srcdir} -path "./manual" -prune -o \ 103ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
103 -path "*resources" -prune -o -name "*el" -print) 104 -path "*resources" -prune -o -name "*el" -print)
104ELCFILES = $(patsubst %.el,%.elc,${ELFILES}) 105## .elc files may be in a different directory for out of source builds
105LOGFILES = $(patsubst %.el,%.log,${ELFILES}) 106ELCFILES = $(patsubst %.el,%.elc, \
106LOGSAVEFILES = $(patsubst %.el,%.log~,${ELFILES}) 107 $(patsubst $(srcdir)%,.%,$(ELFILES)))
108LOGFILES = $(patsubst %.elc,%.log,${ELCFILES})
109LOGSAVEFILES = $(patsubst %.elc,%.log~,${ELCFILES})
107TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=)) 110TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
108 111
109## If we have to interrupt a hanging test, preserve the log so we can 112## If we have to interrupt a hanging test, preserve the log so we can
@@ -117,8 +120,8 @@ TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
117## of use. 120## of use.
118define test_template 121define test_template
119$(1): 122$(1):
120 @test ! -f ${srcdir}/$(1).log || mv ${srcdir}/$(1).log ${srcdir}/$(1).log~ 123 @test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~
121 @${MAKE} ${srcdir}/$(1).log WRITE_LOG= 124 @${MAKE} ./$(1).log WRITE_LOG=
122 125
123$(notdir $(1)): $(1) 126$(notdir $(1)): $(1)
124endef 127endef
@@ -156,7 +159,7 @@ distclean: clean
156maintainer-clean: distclean bootstrap-clean 159maintainer-clean: distclean bootstrap-clean
157 160
158make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp 161make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
159 $(EMACS) --batch -l make-test-deps.emacs-lisp \ 162 $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
160 --eval "(make-test-deps \"`pwd`\")" \ 163 --eval "(make-test-deps \"$(srcdir)\")" \
161 2> $@ 164 2> $@
162# Makefile ends here. 165# Makefile ends here.
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp
index 563b3bf6722..7831da31061 100644
--- a/test/make-test-deps.emacs-lisp
+++ b/test/make-test-deps.emacs-lisp
@@ -26,34 +26,43 @@
26 26
27(require 'seq) 27(require 'seq)
28 28
29(defun make-test-deps (directory) 29(defun make-test-deps (src-dir)
30 (message 30 (let ((src-dir (file-truename src-dir)))
31 "%s" 31 (message
32 (concat 32 "%s"
33 (make-test-deps-lisp directory) 33 (concat
34 (make-test-deps-src directory)))) 34 (make-test-deps-lisp src-dir)
35 35 (make-test-deps-src src-dir)))))
36(defun make-test-deps-lisp (directory) 36
37(defun make-test-deps-lisp (src-dir)
37 (mapconcat 38 (mapconcat
38 (lambda (stem) 39 (lambda (file-without-suffix)
39 (format "%s-tests.log: ../%s.elc\n" stem stem)) 40 (format "./%s-tests.log: %s/../%s.el\n"
40 (make-test-test-files directory "lisp") "")) 41 file-without-suffix
41 42 src-dir
42(defun make-test-deps-src (directory) 43 file-without-suffix))
44 (make-test-test-files src-dir "lisp") ""))
45
46(defun make-test-deps-src (src-dir)
43 (mapconcat 47 (mapconcat
44 (lambda (stem) 48 (lambda (file-without-suffix)
45 (format "%s-tests.log: ../%s.o\n" stem stem)) 49 (format "./%s-tests.log: %s/../%s.c\n"
46 (make-test-test-files directory "src") "")) 50 file-without-suffix
47 51 src-dir
48(defun make-test-test-files (stem 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)
49 (make-test-munge-files 56 (make-test-munge-files
50 stem 57 src-dir
51 (directory-files-recursively dir ".*-tests.el$"))) 58 (directory-files-recursively
59 (concat src-dir "/" sub-src-dir)
60 ".*-tests.el$")))
52 61
53(defun make-test-munge-files (stem files) 62(defun make-test-munge-files (src-dir files)
54 (make-test-sans-suffix 63 (make-test-sans-suffix
55 (make-test-de-stem 64 (make-test-de-stem
56 stem 65 src-dir
57 (make-test-no-legacy 66 (make-test-no-legacy
58 (make-test-no-test-dir 67 (make-test-no-test-dir
59 (make-test-no-resources 68 (make-test-no-resources