emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Re: running each test file independently in test/automated


From: Barry OReilly
Subject: [PATCH] Re: running each test file independently in test/automated
Date: Sun, 15 Sep 2013 16:04:45 -0400

>>> Hi, I've found I want to run only one or a few of the tests at a
>>> time rather than the whole suite.

>> http://lists.gnu.org/archive/html/emacs-devel/2013-08/msg00339.html
>>
>> is supposed to allow this. I don't know if it is waiting on
>> something.

> Yes indeed, it provides a way to run individual tests:
>
>   $ rm cl-lib.log ; make cl-lib.log
>   Running tests in cl-lib.el... passed all 8 tests
>
> Some comments on the patch follow.

I haven't heard from Kenichi, so I prepared a patch to implement the
subset of what he submitted pertaining to the .log make targets.

I also factored out some duplication in the compile-main,
compile-clean, and check targets.

I'll plan to rename the Makefile to GNUmakefile as Stefan requested in
the same commit, once the patch below is approved for install.

diff --git a/.bzrignore b/.bzrignore
index cd64f3f..be86add 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -174,6 +174,7 @@ src/stamp-oldxmenu
 src/stamp-h.in
 src/temacs
 test/indent/*.new
+test/automated/**/*.log
 +*
 src/globals.h
 src/gl-stamp
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in
index bf8e62f..3005d5e 100644
--- a/test/automated/Makefile.in
+++ b/test/automated/Makefile.in
@@ -49,12 +49,16 @@ BYTE_COMPILE_EXTRA_FLAGS =
 emacs = EMACSLOADPATH=$(lispsrc):$(test) LC_ALL=C $(EMACS) $(EMACSOPT)
 
 # Common command to find subdirectories
-setwins=subdirs=`find . -type d -print`; \
+getwins=subdirs=`find . -type d -print`; \
     for file in $$subdirs; do \
        case $$file in */.* | */.*/* | */=* | ./data* ) ;; \
         *) wins="$$wins$${wins:+ }$$file" ;; \
        esac; \
-        done
+        done; \
+    echo "$$wins" | sed -e 's|/\./|/|g' -e 's|/\. | |g'
+
+TEST_EL_FILES=$(wildcard $(patsubst %,%/*.el,$(shell $(getwins))))
+TEST_ELC_FILES=$(wildcard $(patsubst %,%/*.elc,$(shell $(getwins))))
 
 all: check
 
@@ -68,7 +72,7 @@ doit:
 # subdirectories, to make sure require's and load's in the files being
 # compiled find the right files.
 
-.SUFFIXES: .elc .el
+.SUFFIXES: .elc .el .log
 
 # An old-fashioned suffix rule, which, according to the GNU Make manual,
 # cannot have prerequisites.
@@ -98,9 +102,8 @@ compile-targets: $(TARGETS)
 # Compile all the Elisp files that need it.  Beware: it approximates
 # `no-byte-compile', so watch out for false-positives!
 compile-main: compile-clean lisp-compile
-    @(cd $(test); $(setwins); \
-    els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
-    for el in $$els; do \
+    @(cd $(test); \
+    for el in $(TEST_EL_FILES); do \
       test -f $$el || continue; \
       test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
       echo "$${el}c"; \
@@ -112,9 +115,8 @@ compile-main: compile-clean lisp-compile
 .PHONY: compile-clean
 # Erase left-over .elc files that do not have a corresponding .el file.
 compile-clean:
-   address@hidden $(test); $(setwins); \
-    elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
-    for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
+   address@hidden $(test); \
+    for el in $(patsubst %.elc,%.el,$(TEST_ELC_FILES)); do \
       if test -f "$$el" -o \! -f "$${el}c"; then :; else \
         echo rm "$${el}c"; \
         rm "$${el}c"; \
@@ -145,10 +147,18 @@ distclean:
 
 maintainer-clean: distclean bootstrap-clean
 
+TEST_LOGS=$(patsubst %.el,%.log,$(TEST_EL_FILES))
+$(TEST_LOGS): lisp-compile
+$(TEST_LOGS): %.log : %.elc
+    @(cd $(test); \
+    el=$(patsubst %.log,%.el,$@) ;\
+    test -f $$el || continue; \
+    echo Testing $$el; \
+    $(emacs) -l $$el -f ert-run-tests-batch-and-exit 2>&1 | tee $@)
+
 check: compile-main
-    @(cd $(test); $(setwins); \
-    pattern=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
-    for el in $$pattern; do \
+    @(cd $(test); \
+    for el in $(TEST_EL_FILES); do \
       test -f $$el || continue; \
       args="$$args -l $$el"; \
       els="$$els $$el"; \


reply via email to

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