mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
Tests now support out-of-source-build.
* tests/Makefile.in,test/make-test-deps.emacs-lisp: Remove assumptions about current working directory.
This commit is contained in:
parent
bd6695f3f5
commit
3ab26227cf
@ -87,7 +87,7 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
|
||||
## to change this; bug#17848 - if that gets done, this can be simplified).
|
||||
##
|
||||
## Beware: it approximates 'no-byte-compile', so watch out for false-positives!
|
||||
%.log: ${srcdir}/%.el
|
||||
%.log: %.el
|
||||
@if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
|
||||
loadfile=$<; \
|
||||
else \
|
||||
@ -96,14 +96,17 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
|
||||
fi; \
|
||||
echo Testing $$loadfile; \
|
||||
stat=OK ; \
|
||||
mkdir --parents $(dir $@) ; \
|
||||
$(emacs) -l ert -l $$loadfile \
|
||||
-f ert-run-tests-batch-and-exit ${WRITE_LOG}
|
||||
|
||||
ELFILES = $(shell find ${srcdir} -path "./manual" -prune -o \
|
||||
ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
|
||||
-path "*resources" -prune -o -name "*el" -print)
|
||||
ELCFILES = $(patsubst %.el,%.elc,${ELFILES})
|
||||
LOGFILES = $(patsubst %.el,%.log,${ELFILES})
|
||||
LOGSAVEFILES = $(patsubst %.el,%.log~,${ELFILES})
|
||||
## .elc files may be in a different directory for out of source builds
|
||||
ELCFILES = $(patsubst %.el,%.elc, \
|
||||
$(patsubst $(srcdir)%,.%,$(ELFILES)))
|
||||
LOGFILES = $(patsubst %.elc,%.log,${ELCFILES})
|
||||
LOGSAVEFILES = $(patsubst %.elc,%.log~,${ELCFILES})
|
||||
TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
|
||||
|
||||
## If we have to interrupt a hanging test, preserve the log so we can
|
||||
@ -117,8 +120,8 @@ TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
|
||||
## of use.
|
||||
define test_template
|
||||
$(1):
|
||||
@test ! -f ${srcdir}/$(1).log || mv ${srcdir}/$(1).log ${srcdir}/$(1).log~
|
||||
@${MAKE} ${srcdir}/$(1).log WRITE_LOG=
|
||||
@test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~
|
||||
@${MAKE} ./$(1).log WRITE_LOG=
|
||||
|
||||
$(notdir $(1)): $(1)
|
||||
endef
|
||||
@ -156,7 +159,7 @@ distclean: clean
|
||||
maintainer-clean: distclean bootstrap-clean
|
||||
|
||||
make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
|
||||
$(EMACS) --batch -l make-test-deps.emacs-lisp \
|
||||
--eval "(make-test-deps \"`pwd`\")" \
|
||||
$(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
|
||||
--eval "(make-test-deps \"$(srcdir)\")" \
|
||||
2> $@
|
||||
# Makefile ends here.
|
||||
|
@ -26,34 +26,43 @@
|
||||
|
||||
(require 'seq)
|
||||
|
||||
(defun make-test-deps (directory)
|
||||
(message
|
||||
"%s"
|
||||
(concat
|
||||
(make-test-deps-lisp directory)
|
||||
(make-test-deps-src directory))))
|
||||
(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 (directory)
|
||||
(defun make-test-deps-lisp (src-dir)
|
||||
(mapconcat
|
||||
(lambda (stem)
|
||||
(format "%s-tests.log: ../%s.elc\n" stem stem))
|
||||
(make-test-test-files directory "lisp") ""))
|
||||
(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 (directory)
|
||||
(defun make-test-deps-src (src-dir)
|
||||
(mapconcat
|
||||
(lambda (stem)
|
||||
(format "%s-tests.log: ../%s.o\n" stem stem))
|
||||
(make-test-test-files directory "src") ""))
|
||||
(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 (stem dir)
|
||||
(defun make-test-test-files (src-dir sub-src-dir)
|
||||
(make-test-munge-files
|
||||
stem
|
||||
(directory-files-recursively dir ".*-tests.el$")))
|
||||
src-dir
|
||||
(directory-files-recursively
|
||||
(concat src-dir "/" sub-src-dir)
|
||||
".*-tests.el$")))
|
||||
|
||||
(defun make-test-munge-files (stem files)
|
||||
(defun make-test-munge-files (src-dir files)
|
||||
(make-test-sans-suffix
|
||||
(make-test-de-stem
|
||||
stem
|
||||
src-dir
|
||||
(make-test-no-legacy
|
||||
(make-test-no-test-dir
|
||||
(make-test-no-resources
|
||||
|
Loading…
Reference in New Issue
Block a user