]> code.delx.au - gnu-emacs/blobdiff - test/Makefile.in
Merge from origin/emacs-25
[gnu-emacs] / test / Makefile.in
similarity index 75%
rename from test/automated/Makefile.in
rename to test/Makefile.in
index 48920efe12e5a064b106df5757e9cc0ca08931bc..62443a195efdeb5f1750c26ab320bbc0838b5d89 100644 (file)
@@ -37,7 +37,7 @@ SEPCHAR = @SEPCHAR@
 # We never change directory before running Emacs, so a relative file
 # name is fine, and makes life easier.  If we need to change
 # directory, we can use emacs --chdir.
-EMACS = ../../src/emacs
+EMACS = ../src/emacs
 
 EMACS_EXTRAOPT=
 
@@ -87,10 +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!
-SELECTOR_DEFAULT=(quote (not (tag :expensive-test)))
-SELECTOR_EXPENSIVE=nil
-SELECTOR=
-%.log: ${srcdir}/%.el
+%.log: %.el
        @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
          loadfile=$<; \
        else \
@@ -99,12 +96,18 @@ SELECTOR=
        fi; \
        echo Testing $$loadfile; \
        stat=OK ; \
+       mkdir --parents $(dir $@) ; \
        $(emacs) -l ert -l $$loadfile \
-         --eval "(ert-run-tests-batch-and-exit ${SELECTOR})" ${WRITE_LOG}
+         -f ert-run-tests-batch-and-exit ${WRITE_LOG}
 
-ELFILES = $(sort $(wildcard ${srcdir}/*.el))
-LOGFILES = $(patsubst %.el,%.log,$(notdir ${ELFILES}))
-TESTS = ${LOGFILES:.log=}
+ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
+               -path "*resources" -prune -o -name "*el" -print)
+## .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
 ## see what the problem was.
@@ -113,27 +116,26 @@ TESTS = ${LOGFILES:.log=}
 .PHONY: ${TESTS}
 
 ## The short aliases that always re-run the tests, with no logging.
+## Define an alias both with and without the directory name for ease
+## of use.
 define test_template
 $(1):
-       @test ! -f $(1).log || mv $(1).log $(1).log~
-       @${MAKE} $(1).log WRITE_LOG=
+       @test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~
+       @${MAKE} ./$(1).log WRITE_LOG=
+
+$(notdir $(1)): $(1)
 endef
 
 $(foreach test,${TESTS},$(eval $(call test_template,${test})))
 
+## Include dependencies between test files and the files they test.
+## We do this without the file and eval directly, but then we would
+## have to run Emacs for every make invocation, and it might not be
+## available during clean.
+-include make-test-deps.mk
 ## Rerun default tests.
 check:
-       @${MAKE} check-doit SELECTOR="${SELECTOR_DEFAULT}"
-
-## Rerun also expensive tests.
-.PHONY: check-expensive
-check-expensive:
-       @${MAKE} check-doit SELECTOR="${SELECTOR_EXPENSIVE}"
-
-## Re-run all the tests every time.
-.PHONY: check-doit
-check-doit:
-       -@for f in *.log; do test ! -f $$f || mv $$f $$f~; done
+       -@for f in $(LOGFILES); do test ! -f $$f || mv $$f $$f~; done
        @${MAKE} check-maybe
 
 ## Only re-run tests whose .log is older than the test.
@@ -144,14 +146,19 @@ check-maybe: ${LOGFILES}
 .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
 
 clean mostlyclean:
-       -rm -f *.log *.log~
+       -rm -f ${LOGFILES} ${LOGSAVEFILES}
+       -rm make-test-deps.mk
 
 bootstrap-clean: clean
-       -rm -f ${srcdir}/*.elc
+       -rm -f ${ELCFILES}
 
 distclean: clean
        rm -f Makefile
 
 maintainer-clean: distclean bootstrap-clean
 
+make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
+       $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
+       --eval "(make-test-deps \"$(srcdir)\")" \
+       2> $@
 # Makefile ends here.