## 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 \
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
## 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
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.
(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)
+(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 (stem)
- (format "%s-tests.log: ../%s.elc\n" stem stem))
- (make-test-test-files directory "lisp") ""))
-
-(defun make-test-deps-src (directory)
+ (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 (stem)
- (format "%s-tests.log: ../%s.o\n" stem stem))
- (make-test-test-files directory "src") ""))
-
-(defun make-test-test-files (stem dir)
+ (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
- 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