unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31744: 26.1; Improvements to make tags and make -C test
@ 2018-06-07  1:49 Noam Postavsky
  2018-06-08 15:38 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Noam Postavsky @ 2018-06-07  1:49 UTC (permalink / raw)
  To: 31744

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1605 bytes --]

From 511a31788d63bdc7ee6dc877e1690dd79ad89c6d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch --]
[-- Type: text/x-diff, Size: 3542 bytes --]

From 83bc64364d21712865913ca5b4627c3ea8ec0071 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: patch --]
[-- Type: text/x-diff, Size: 2970 bytes --]

From 02d9d15d5ead3a4f6e1451e3f2cc2d6e49cafa24 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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
 	-@${MAKE} -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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: patch --]
[-- Type: text/x-diff, Size: 1873 bytes --]

From 9f84e96771d755f06c5e1c6dc0eb5dc85272991d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-07  1:49 bug#31744: 26.1; Improvements to make tags and make -C test Noam Postavsky
@ 2018-06-08 15:38 ` Eli Zaretskii
  2018-06-08 16:04   ` Robert Pluim
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-06-08 15:38 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 31744

> From: Noam Postavsky <npostavs@gmail.com>
> Date: Wed, 06 Jun 2018 21:49:47 -0400
> 
> 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.

Thanks for your work on this.  A few comments below:

> * src/Makefile.in: Create TAGS files in ${srcdir}, not build dir.

I'm not sure I agree with this.  Other projects I looked at produce
TAGS in the build directory (but reference source files in srcdir, of
course).  Why do you think TAGS should go to the source directory?

> +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
>  	-@${MAKE} -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

Not sure I understand the HOME trick: why not use -Q?

> 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).

This should be explained in some README in the test suite, I think.

I have no objections to making these changes on the emacs-26 branch.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-08 15:38 ` Eli Zaretskii
@ 2018-06-08 16:04   ` Robert Pluim
  2018-06-09  1:12     ` Noam Postavsky
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Pluim @ 2018-06-08 16:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 31744, Noam Postavsky

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Noam Postavsky <npostavs@gmail.com>
>> Date: Wed, 06 Jun 2018 21:49:47 -0400
>> 
>> 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.
>
> Thanks for your work on this.  A few comments below:
>
>> * src/Makefile.in: Create TAGS files in ${srcdir}, not build dir.
>
> I'm not sure I agree with this.  Other projects I looked at produce
> TAGS in the build directory (but reference source files in srcdir, of
> course).  Why do you think TAGS should go to the source directory?

They should not. Source should be able to be mounted read-only, and
all build products should be stored elsewhere.

Robert





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-08 16:04   ` Robert Pluim
@ 2018-06-09  1:12     ` Noam Postavsky
  2018-06-09  6:20       ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Noam Postavsky @ 2018-06-09  1:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 31744

>>> * src/Makefile.in: Create TAGS files in ${srcdir}, not build dir.
>>
>> I'm not sure I agree with this.  Other projects I looked at produce
>> TAGS in the build directory (but reference source files in srcdir, of
>> course).  Why do you think TAGS should go to the source directory?

Oh, hmm.  The original reason, is that when looking at a source file in
Emacs, and then hitting M-. I get a prompt to visit the TAGS table,
which starts from the source directory.  Then I have to go looking for
the TAGS file in the corresponding build directory.  This seems kind of
silly, especially since every build directory will have identical TAGS
files anyway (meaning I either have to make TAGS redundantly per-build
directory, or remember exactly which build directory has the TAGS file).

I saw the FIXME in Makefile.in, so I assumed (oops!) this was some
well-known problem, and that nobody had bothered to make the obvious fix
yet.

> They should not. Source should be able to be mounted read-only, and
> all build products should be stored elsewhere.

Emacs puts .elc files in the source directory.  I was under the
impression that the general principal is that arch & config dependent
files go in the build directory, and arch & config independent ones go
in the source directory.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-09  1:12     ` Noam Postavsky
@ 2018-06-09  6:20       ` Eli Zaretskii
  2018-06-09 19:16         ` Noam Postavsky
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-06-09  6:20 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 31744

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: 31744@debbugs.gnu.org
> Date: Fri, 08 Jun 2018 21:12:04 -0400
> 
> >>> * src/Makefile.in: Create TAGS files in ${srcdir}, not build dir.
> >>
> >> I'm not sure I agree with this.  Other projects I looked at produce
> >> TAGS in the build directory (but reference source files in srcdir, of
> >> course).  Why do you think TAGS should go to the source directory?
> 
> Oh, hmm.  The original reason, is that when looking at a source file in
> Emacs, and then hitting M-. I get a prompt to visit the TAGS table,
> which starts from the source directory.  Then I have to go looking for
> the TAGS file in the corresponding build directory.

I have grown a habit a long time ago to "M-x visit-tags-table" before
I issue the first "M-." command.

The default prompt is fine, because what else would you expect Emacs
to do in that case?  But no one said that default is correct in every
single use case.  E.g., a project could have one TAGS file in a
top-level directory, and you may be visiting a file in a subdirectory.

> especially since every build directory will have identical TAGS
> files anyway

That's what happens currently, but it isn't carved in stone.  We
could, for example, have TAGS reflect only the files that are compiled
in on the current platform; other projects (like GDB, for example) do
just that.  Then each build will have a different TAGS file.

> > They should not. Source should be able to be mounted read-only, and
> > all build products should be stored elsewhere.
> 
> Emacs puts .elc files in the source directory.

*.elc files are generated at bootstrap time; when you build a tarball,
they are already there.  By contrast, TAGS is built at build time and
doesn't come with the release tarball.

> I was under the impression that the general principal is that arch &
> config dependent files go in the build directory, and arch & config
> independent ones go in the source directory.

No, I think the principle is that the source tree holds everything
that comes with a release tarball.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-09  6:20       ` Eli Zaretskii
@ 2018-06-09 19:16         ` Noam Postavsky
  2018-06-10 16:59           ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Noam Postavsky @ 2018-06-09 19:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 31744

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> Oh, hmm.  The original reason, is that when looking at a source file in
>> Emacs, and then hitting M-. I get a prompt to visit the TAGS table,
>> which starts from the source directory.  Then I have to go looking for
>> the TAGS file in the corresponding build directory.
>
> I have grown a habit a long time ago to "M-x visit-tags-table" before
> I issue the first "M-." command.
>
> The default prompt is fine, because what else would you expect Emacs
> to do in that case?

Yeah, there's no way for Emacs to know where the build directory is.
Maybe I'll add symlinks locally to work around this.

>> especially since every build directory will have identical TAGS
>> files anyway
>
> That's what happens currently, but it isn't carved in stone.  We
> could, for example, have TAGS reflect only the files that are compiled
> in on the current platform; other projects (like GDB, for example) do
> just that.  Then each build will have a different TAGS file.

I hope not, that sounds inconvenient to me.

> No, I think the principle is that the source tree holds everything
> that comes with a release tarball.

Okay, I dropped this change, and updated the FIXME comment to mention
this instead.


Going back to a question from earlier in the thread:

>> +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
>>  	-@${MAKE} -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

> Not sure I understand the HOME trick: why not use -Q?

$(emacs) already includes -Q (or rather, the equivalent long options
--no-init-file --no-site-file --no-site-lisp).  The HOME trick was added
in [d17aa3e535] and [412c38aa28].  I can't find a specific discussion,
but http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00641.html
seems related.  I've added a comment to explain this better.

[412c38aa28]: 2017-05-30 08:39:39 -0700
  Stop make check interacting with HOME
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=412c38aa28dd7e8363b481a09d1df62c40f9a5b7
[d17aa3e535]: 2017-05-30 12:50:54 -0400
  Reduce scope of recent test/Makefile HOME change
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d17aa3e535bba5e93ff188d5460c91001074255e


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2398 bytes --]

From 9078572053aed5e7cd9aa26d9dcff9409b7148e4 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 7 Dec 2017 04:31:47 -0500
Subject: [PATCH v2 1/3] Make 'tags' targets respect --with-silent-rules
 (Bug#31744)

* lwlib/Makefile.in (TAGS):
* lisp/Makefile.in (TAGS):
* src/Makefile.in (TAGS): Use AM_V_GEN and AM_V_at.
* src/Makefile.in: Note that TAGS are generated in build dir.
---
 lisp/Makefile.in  | 6 +++---
 lwlib/Makefile.in | 2 +-
 src/Makefile.in   | 5 +++--
 3 files changed, 7 insertions(+), 6 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/lwlib/Makefile.in b/lwlib/Makefile.in
index 32d7a91f9b..6bd2608381 100644
--- a/lwlib/Makefile.in
+++ b/lwlib/Makefile.in
@@ -131,6 +131,6 @@ FORCE:
 .PHONY: tags FORCE
 tags: TAGS
 TAGS: ${ETAGS} $(ctagsfiles)
-	${ETAGS} $(ctagsfiles)
+	$(AM_V_GEN)${ETAGS} $(ctagsfiles)
 
 ### Makefile.in ends here
diff --git a/src/Makefile.in b/src/Makefile.in
index 15ca1667d6..6ed8f3cc91 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -674,13 +674,14 @@ ${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 are generated in the build dir, like
+## other non-bootstrap build products (see Bug#31744).
 
 ## 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)
-	${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


[-- Attachment #3: patch --]
[-- Type: text/plain, Size: 4057 bytes --]

From 2c2dfd66718d464288c91824ecff8564ee6f3d91 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 16 Dec 2017 20:06:11 -0500
Subject: [PATCH v2 2/3] ; test/Makefile.in: Add TEST_INTERACTIVE option
 (Bug#31744).

* test/README: Note the new option.
---
 test/Makefile.in | 33 +++++++++++++++++++++++++++------
 test/README      |  6 ++++++
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/test/Makefile.in b/test/Makefile.in
index e6b3f77523..451513a747 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
@@ -120,6 +129,11 @@ emacs =
  EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \
  $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT)
 
+# Set HOME to a nonexistent directory to prevent tests from accessing
+# it accidentally (e.g., popping up a gnupg dialog if ~/.authinfo.gpg
+# exists, or writing to ~/.bzr.log when running bzr commands).
+TEST_HOME = /nonexistent
+
 test_module_dir := $(srcdir)/data/emacs-module
 
 .PHONY: all check
@@ -128,7 +142,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 +159,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; }
@@ -158,9 +172,9 @@ testloadfile =
 
 %.log: %.elc
 	$(AM_V_at)${MKDIR_P} $(dir $@)
-	$(AM_V_GEN)HOME=/nonexistent $(emacs) \
+	$(AM_V_GEN)HOME=$(TEST_HOME) $(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 +274,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=$(TEST_HOME) $(emacs) \
+	  -l ert ${ert_opts} \
+	  $(patsubst %,-l %,$(if $(findstring $(TEST_LOAD_EL),yes),$ELFILES,$(ELFILES:.el=)))  \
+	  $(TEST_RUN_ERT)
+else
 	-@${MAKE} -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
 
diff --git a/test/README b/test/README
index 1cd9db3bb8..c1dde2e0d0 100644
--- a/test/README
+++ b/test/README
@@ -50,6 +50,12 @@ nicer backtraces.  To run the compiled version of a test use
 
     make TEST_LOAD_EL=no ...
 
+The tests are run in batch mode by default; sometimes it's useful to
+get precisely the same environment but run in interactive mode for
+debugging.  To do that, use
+
+    make TEST_INTERACTIVE=yes ...
+
 \f
 (Also, see etc/compilation.txt for compilation mode font lock tests.)
 
-- 
2.11.0


[-- Attachment #4: patch --]
[-- Type: text/plain, Size: 2642 bytes --]

From a86a31659937556059f34beb75df1cbff73c5464 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Wed, 6 Jun 2018 21:25:52 -0400
Subject: [PATCH v2 3/3] ; Reduce quoting for SELECTOR in 'make -C test'
 (Bug#31744)

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 '... reader syntax form which would
now fail to work due to using single quotes around the whole shell
arg).
* test/README: Update instructions accordingly.
---
 test/Makefile.in | 8 ++++----
 test/README      | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/test/Makefile.in b/test/Makefile.in
index 451513a747..597ef91311 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
@@ -140,8 +140,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)
diff --git a/test/README b/test/README
index c1dde2e0d0..e473248c9e 100644
--- a/test/README
+++ b/test/README
@@ -42,7 +42,10 @@ except the tests tagged as expensive.
 
 If your test file contains the tests "test-foo", "test2-foo" and
 "test-foo-remote", and you want to run only the former two tests, you
-could use a selector regexp: "make <filename> SELECTOR='\"foo$$\"'".
+could use a selector regexp (note that the "$" needs to be doubled to
+protect against "make" variable expansion):
+
+    make <filename> SELECTOR='"foo$$"'
 
 Note that although the test files are always compiled (unless they set
 no-byte-compile), the source files will be run by default, to give
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-09 19:16         ` Noam Postavsky
@ 2018-06-10 16:59           ` Eli Zaretskii
  2018-06-12 11:49             ` Noam Postavsky
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-06-10 16:59 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 31744

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: 31744@debbugs.gnu.org
> Date: Sat, 09 Jun 2018 15:16:00 -0400
> 
> >> especially since every build directory will have identical TAGS
> >> files anyway
> >
> > That's what happens currently, but it isn't carved in stone.  We
> > could, for example, have TAGS reflect only the files that are compiled
> > in on the current platform; other projects (like GDB, for example) do
> > just that.  Then each build will have a different TAGS file.
> 
> I hope not, that sounds inconvenient to me.

It depends.  When you work in the build tree, it is reasonable to
assume you are interested only in the files relevant to that build, so
you won't want to see, e.g., w32term.c when you are working on an X
build.

> Going back to a question from earlier in the thread:
> 
> >> +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
> >>  	-@${MAKE} -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
> 
> > Not sure I understand the HOME trick: why not use -Q?
> 
> $(emacs) already includes -Q (or rather, the equivalent long options
> --no-init-file --no-site-file --no-site-lisp).  The HOME trick was added
> in [d17aa3e535] and [412c38aa28].  I can't find a specific discussion,
> but http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00641.html
> seems related.  I've added a comment to explain this better.

Thanks, I have no more comments.  Please go ahead, and thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#31744: 26.1; Improvements to make tags and make -C test
  2018-06-10 16:59           ` Eli Zaretskii
@ 2018-06-12 11:49             ` Noam Postavsky
  0 siblings, 0 replies; 8+ messages in thread
From: Noam Postavsky @ 2018-06-12 11:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 31744

tags 31744 fixed
close 31744 26.2
quit

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, I have no more comments.  Please go ahead, and thanks.

Pushed.

[1: 1aa906f10d]: 2018-06-12 07:26:06 -0400
  Make 'tags' targets respect --with-silent-rules (Bug#31744)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1aa906f10d3a5dc3905c2f74cddbfd8c6cb8eb7a

[2: b6b793bd77]: 2018-06-12 07:26:06 -0400
  ; test/Makefile.in: Add TEST_INTERACTIVE option (Bug#31744).
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b6b793bd77cb8be0a2d2745262e53037dc6798a0

[3: 5bdc344780]: 2018-06-12 07:26:06 -0400
  ; Reduce quoting for SELECTOR in 'make -C test' (Bug#31744)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5bdc344780faabbc91b7e55306b2071dffb44fa2





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-12 11:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-07  1:49 bug#31744: 26.1; Improvements to make tags and make -C test Noam Postavsky
2018-06-08 15:38 ` Eli Zaretskii
2018-06-08 16:04   ` Robert Pluim
2018-06-09  1:12     ` Noam Postavsky
2018-06-09  6:20       ` Eli Zaretskii
2018-06-09 19:16         ` Noam Postavsky
2018-06-10 16:59           ` Eli Zaretskii
2018-06-12 11:49             ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).