bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31744: 26.1; Improvements to make tags and make -C test


From: Noam Postavsky
Subject: bug#31744: 26.1; Improvements to make tags and make -C test
Date: Wed, 06 Jun 2018 21:49:47 -0400

Severity: wishlist
Tags: patch

Some quality-of-life improvements in make targets.  I hope these can go
to emacs-26; although the test/Makefile.in changes aren't bug fixes,
that file isn't distributed in the tarball.

>From 511a31788d63bdc7ee6dc877e1690dd79ad89c6d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Thu, 7 Dec 2017 04:31:47 -0500
Subject: [PATCH 1/4] Make 'tags' targets quieter in --with-silent-rules modes

* lisp/Makefile.in (TAGS):
* src/Makefile.in (TAGS): Use AM_V_GEN and AM_V_at.
---
 lisp/Makefile.in | 6 +++---
 src/Makefile.in  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index d4709bd79d..05fca9579f 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -259,9 +259,9 @@ ${ETAGS}:
 ## compile-main.  But maybe this is not even necessary any more now
 ## that this uses relative filenames.
 TAGS: ${ETAGS} ${tagsfiles}
-       rm -f $@
-       touch $@
-       ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@
+       $(AM_V_at)rm -f $@
+       $(AM_V_at)touch $@
+       $(AM_V_GEN)ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@
 
 
 # The src/Makefile.in has its own set of dependencies and when they decide
diff --git a/src/Makefile.in b/src/Makefile.in
index 15ca1667d6..d914dfebbd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -680,7 +680,7 @@ ctagsfiles2 =
 ## because etags "--include" only includes a pointer to the file,
 ## rather than the file contents.
 TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2)
-       ${ETAGS} --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \
+       $(AM_V_GEN)${ETAGS} --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \
          --regex='{c}/[        ]*DEFVAR_[A-Z_  (]+"\([^"]+\)"/\1/' \
          --regex='{c}/[        ]*DEFVAR_[A-Z_  (]+"[^"]+",[    
]\([A-Za-z0-9_]+\)/\1/' \
          $(ctagsfiles1) \
-- 
2.11.0

>From 83bc64364d21712865913ca5b4627c3ea8ec0071 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Wed, 13 Dec 2017 21:12:21 -0500
Subject: [PATCH 2/4] Make TAGS file in the srcdir for out-of-tree builds

* Makefile.in:
* lisp/Makefile.in:
* lwlib/Makefile.in:
* src/Makefile.in: Create TAGS files in ${srcdir}, not build dir.
---
 Makefile.in       |  2 +-
 lisp/Makefile.in  |  2 +-
 lwlib/Makefile.in |  6 +++---
 src/Makefile.in   | 18 ++++++++++--------
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 238df40ded..8a0a505320 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -929,7 +929,7 @@ extraclean: $(extraclean_dirs:
 # The src subdir knows how to do the right thing
 # even when the build directory and source dir are different.
 .PHONY: TAGS tags
-TAGS tags: lib lib-src src
+${srcdir}/TAGS tags: lib lib-src src
        $(MAKE) -C src tags
 
 .PHONY: have-tests
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 05fca9579f..373ce60d12 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -258,7 +258,7 @@ ${ETAGS}:
 ## etags.  It might be better to use find in a similar way to
 ## compile-main.  But maybe this is not even necessary any more now
 ## that this uses relative filenames.
-TAGS: ${ETAGS} ${tagsfiles}
+${srcdir}/TAGS: ${ETAGS} ${tagsfiles}
        $(AM_V_at)rm -f $@
        $(AM_V_at)touch $@
        $(AM_V_GEN)ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in
index 32d7a91f9b..1cb35337c9 100644
--- a/lwlib/Makefile.in
+++ b/lwlib/Makefile.in
@@ -129,8 +129,8 @@ ctagsfiles=
 
 FORCE:
 .PHONY: tags FORCE
-tags: TAGS
-TAGS: ${ETAGS} $(ctagsfiles)
-       ${ETAGS} $(ctagsfiles)
+tags: ${srcdir}/TAGS
+${srcdir}/TAGS: ${ETAGS} $(ctagsfiles)
+       $(AM_V_GEN)${ETAGS} -o $@ $(ctagsfiles)
 
 ### Makefile.in ends here
diff --git a/src/Makefile.in b/src/Makefile.in
index d914dfebbd..cb4f8ae6c6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -674,13 +674,15 @@ ${ETAGS}:
 ctagsfiles1 = $(wildcard ${srcdir}/*.[hc])
 ctagsfiles2 = $(wildcard ${srcdir}/*.m)
 
-## FIXME? In out-of-tree builds, should TAGS be generated in srcdir?
+## In out-of-tree builds, TAGS should be generated in srcdir.
 
 ## This does not need to depend on ../lisp and ../lwlib TAGS files,
 ## because etags "--include" only includes a pointer to the file,
-## rather than the file contents.
-TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2)
-       $(AM_V_GEN)${ETAGS} --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \
+## rather than the file contents.  The "--include" reference is
+## relative to the location of the generated TAGS file, so it doesn't
+## need to use ${srcdir}.
+${srcdir}/TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2)
+       $(AM_V_GEN)${ETAGS} -o $@ --include=../lisp/TAGS 
--include=$(lwlibdir)/TAGS \
          --regex='{c}/[        ]*DEFVAR_[A-Z_  (]+"\([^"]+\)"/\1/' \
          --regex='{c}/[        ]*DEFVAR_[A-Z_  (]+"[^"]+",[    
]\([A-Za-z0-9_]+\)/\1/' \
          $(ctagsfiles1) \
@@ -690,13 +692,13 @@ TAGS:
 
 ## Arrange to make tags tables for ../lisp and ../lwlib,
 ## which the above TAGS file for the C files includes by reference.
-../lisp/TAGS: FORCE
-       $(MAKE) -C ../lisp TAGS ETAGS="$(ETAGS)"
+${srcdir}/../lisp/TAGS: FORCE
+       $(MAKE) -C ../lisp ${top_srcdir}/lisp/TAGS ETAGS="$(ETAGS)"
 
-$(lwlibdir)/TAGS: FORCE
+${srcdir}/$(lwlibdir)/TAGS: FORCE
        $(MAKE) -C $(lwlibdir) TAGS ETAGS="$(ETAGS)"
 
-tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS
+tags: ${srcdir}/TAGS ${srcdir}/../lisp/TAGS ${srcdir}/$(lwlibdir)/TAGS
 .PHONY: tags
 
 
-- 
2.11.0

>From 02d9d15d5ead3a4f6e1451e3f2cc2d6e49cafa24 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Sat, 16 Dec 2017 20:06:11 -0500
Subject: [PATCH 3/4] ; test/Makefile.in: Add TEST_INTERACTIVE option.

---
 test/Makefile.in | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/test/Makefile.in b/test/Makefile.in
index e6b3f77523..8c5c3a38d0 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -81,7 +81,7 @@ EMACS_EXTRAOPT=
 # Command line flags for Emacs.
 # Apparently MSYS bash would convert "-L :" to "-L ;" anyway,
 # but we might as well be explicit.
-EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" 
$(EMACS_EXTRAOPT)
+EMACSOPT = --no-init-file --no-site-file --no-site-lisp -L 
"$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT)
 
 # Prevent any settings in the user environment causing problems.
 unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS
@@ -94,6 +94,15 @@ GDB =
 # supported everywhere.
 TEST_LOCALE = C
 
+# Set this to 'yes' to run the tests in an interactive instance.
+TEST_INTERACTIVE ?= no
+
+ifeq ($(TEST_INTERACTIVE),yes)
+TEST_RUN_ERT = --eval "(ert ${SELECTOR_ACTUAL})"
+else
+TEST_RUN_ERT = --batch --eval "(ert-run-tests-batch-and-exit 
${SELECTOR_ACTUAL})" ${WRITE_LOG}
+endif
+
 # Whether to run tests from .el files in preference to .elc, we do
 # this by default since it gives nicer stacktraces.
 TEST_LOAD_EL ?= yes
@@ -128,7 +137,7 @@ all:
 
 SELECTOR_DEFAULT = (quote (not (or (tag :expensive-test) (tag :unstable))))
 SELECTOR_EXPENSIVE = (quote (not (tag :unstable)))
-SELECTOR_ALL = nil
+SELECTOR_ALL = t
 ifdef SELECTOR
 SELECTOR_ACTUAL=$(SELECTOR)
 else ifndef MAKECMDGOALS
@@ -145,7 +154,7 @@ SELECTOR_ACTUAL=
 
 ## Byte-compile all test files to test for errors.
 %.elc: %.el
-       $(AM_V_ELC)$(emacs) -f batch-byte-compile $<
+       $(AM_V_ELC)$(emacs) --batch -f batch-byte-compile $<
 
 ## Save logs, and show logs for failed tests.
 WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; }
@@ -160,7 +169,7 @@ testloadfile =
        $(AM_V_at)${MKDIR_P} $(dir $@)
        $(AM_V_GEN)HOME=/nonexistent $(emacs) \
          -l ert ${ert_opts} -l $(testloadfile) \
-         --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" 
${WRITE_LOG}
+         $(TEST_RUN_ERT)
 
 ifeq (@HAVE_MODULES@, yes)
 maybe_exclude_module_tests :=
@@ -260,8 +269,15 @@ .PHONY:
 ## We can't put LOGFILES as prerequisites, because that would stop the
 ## summarizing step from running when there is an error.
 check-doit:
+ifeq ($(TEST_INTERACTIVE), yes)
+       HOME=/nonexistent $(emacs) \
+         -l ert ${ert_opts} \
+         $(patsubst %,-l %,$(if $(findstring 
$(TEST_LOAD_EL),yes),$ELFILES,$(ELFILES:.el=)))  \
+         $(TEST_RUN_ERT)
+else
        address@hidden -k  ${LOGFILES}
-       @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit ${LOGFILES}
+       @$(emacs) --batch -l ert -f ert-summarize-tests-batch-and-exit 
${LOGFILES}
+endif
 
 .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
 
-- 
2.11.0

>From 9f84e96771d755f06c5e1c6dc0eb5dc85272991d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Wed, 6 Jun 2018 21:25:52 -0400
Subject: [PATCH 4/4] ; Reduce amount of quoting for SELECTOR arg in 'make -C
 test'

Before:

    make -C test SELECTOR='\"foo\"'
    make -C test SELECTOR='(quote (tag :some-tag))'

After:

    make -C test SELECTOR='"foo"'
    make -C test SELECTOR='(tag :some-tag)'

* test/Makefile.in: Use single quotes around the command line call to
ert, this means the user doesn't have to backslash escape double
quotes when writing lisp strings for the selector.  Also wrap the
SELECTOR value in (quote ...) so the user won't have to type it
in (and not get tempted to use the '... form which would now fail to
work due to using single quotes around the whole shell arg).
---
 test/Makefile.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/Makefile.in b/test/Makefile.in
index 8c5c3a38d0..bc4140879d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -98,9 +98,9 @@ TEST_LOCALE =
 TEST_INTERACTIVE ?= no
 
 ifeq ($(TEST_INTERACTIVE),yes)
-TEST_RUN_ERT = --eval "(ert ${SELECTOR_ACTUAL})"
+TEST_RUN_ERT = --eval '(ert (quote ${SELECTOR_ACTUAL}))'
 else
-TEST_RUN_ERT = --batch --eval "(ert-run-tests-batch-and-exit 
${SELECTOR_ACTUAL})" ${WRITE_LOG}
+TEST_RUN_ERT = --batch --eval '(ert-run-tests-batch-and-exit (quote 
${SELECTOR_ACTUAL}))' ${WRITE_LOG}
 endif
 
 # Whether to run tests from .el files in preference to .elc, we do
@@ -135,8 +135,8 @@ .PHONY:
 
 all: check
 
-SELECTOR_DEFAULT = (quote (not (or (tag :expensive-test) (tag :unstable))))
-SELECTOR_EXPENSIVE = (quote (not (tag :unstable)))
+SELECTOR_DEFAULT = (not (or (tag :expensive-test) (tag :unstable)))
+SELECTOR_EXPENSIVE = (not (tag :unstable))
 SELECTOR_ALL = t
 ifdef SELECTOR
 SELECTOR_ACTUAL=$(SELECTOR)
-- 
2.11.0


reply via email to

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