aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Stephani2017-04-22 15:41:39 +0200
committerPhilipp Stephani2017-04-29 14:38:53 +0200
commitbfc0f610bac3f97930941e9a66cbcd11cd382167 (patch)
tree79859d074900b59a51020efc54df3385cc33a80d
parent6a3f331565322b43c41fdf67c6d2dc3feac8cc1c (diff)
downloademacs-bfc0f610bac3f97930941e9a66cbcd11cd382167.tar.gz
emacs-bfc0f610bac3f97930941e9a66cbcd11cd382167.zip
Integrate module test with normal test suite
* test/Makefile.in (ELFILES): Exclude module test if modules aren't configured. (EMACS_TEST_DIRECTORY): Expand test directory so that it's set correctly even if Emacs changes the current directory. ($(srcdir)/src/emacs-module-tests.log) ($(test_module)): Proper dependency tracking for test module. * test/data/emacs-module/Makefile (ROOT): Adapt to new location. Remove 'check' target and EMACS variable, which are no longer necessary. (SO): Change to include period. * test/src/emacs-module-tests.el (mod-test): Use EMACS_TEST_DIRECTORY environment variable to reliably find test data. * configure.ac (HAVE_MODULES, MODULES_SUFFIX): Add necessary substitutions.
-rw-r--r--configure.ac2
-rw-r--r--test/Makefile.in22
-rw-r--r--test/data/emacs-module/Makefile (renamed from modules/mod-test/Makefile)16
-rw-r--r--test/data/emacs-module/mod-test.c (renamed from modules/mod-test/mod-test.c)0
-rw-r--r--test/src/emacs-module-tests.el (renamed from modules/mod-test/test.el)6
5 files changed, 31 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index bd8f7650cc4..f3c53d7a19d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3476,6 +3476,8 @@ if test "${HAVE_MODULES}" = yes; then
3476fi 3476fi
3477AC_SUBST(MODULES_OBJ) 3477AC_SUBST(MODULES_OBJ)
3478AC_SUBST(LIBMODULES) 3478AC_SUBST(LIBMODULES)
3479AC_SUBST(HAVE_MODULES)
3480AC_SUBST(MODULES_SUFFIX)
3479 3481
3480### Use -lpng if available, unless '--with-png=no'. 3482### Use -lpng if available, unless '--with-png=no'.
3481HAVE_PNG=no 3483HAVE_PNG=no
diff --git a/test/Makefile.in b/test/Makefile.in
index a1b772de216..03ae32e3a62 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -63,7 +63,8 @@ TEST_LOCALE = C
63 63
64# The actual Emacs command run in the targets below. 64# The actual Emacs command run in the targets below.
65# Prevent any setting of EMACSLOADPATH in user environment causing problems. 65# Prevent any setting of EMACSLOADPATH in user environment causing problems.
66emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) EMACS_TEST_DIRECTORY=$(srcdir) \ 66emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \
67 EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \
67 $(GDB) "$(EMACS)" $(EMACSOPT) 68 $(GDB) "$(EMACS)" $(EMACSOPT)
68 69
69.PHONY: all check 70.PHONY: all check
@@ -124,8 +125,16 @@ endif
124 $(emacs) -l ert -l $$loadfile \ 125 $(emacs) -l ert -l $$loadfile \
125 --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} 126 --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
126 127
128ifeq (@HAVE_MODULES@, yes)
129maybe_exclude_module_tests :=
130else
131maybe_exclude_module_tests := -name emacs-module-tests.el -prune -o
132endif
133
127ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \ 134ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
128 -name "*resources" -prune -o -name "*.el" -print) 135 -name "*resources" -prune -o \
136 ${maybe_exclude_module_tests} \
137 -name "*.el" -print)
129## .log files may be in a different directory for out of source builds 138## .log files may be in a different directory for out of source builds
130LOGFILES := $(patsubst %.el,%.log, \ 139LOGFILES := $(patsubst %.el,%.log, \
131 $(patsubst $(srcdir)/%,%,$(ELFILES))) 140 $(patsubst $(srcdir)/%,%,$(ELFILES)))
@@ -159,6 +168,15 @@ endef
159 168
160$(foreach test,${TESTS},$(eval $(call test_template,${test}))) 169$(foreach test,${TESTS},$(eval $(call test_template,${test})))
161 170
171ifeq (@HAVE_MODULES@, yes)
172test_module_dir := $(srcdir)/data/emacs-module
173test_module_name := mod-test@MODULES_SUFFIX@
174test_module := $(test_module_dir)/$(test_module_name)
175$(srcdir)/src/emacs-module-tests.log: $(test_module)
176$(test_module): $(srcdir)/../src/emacs-module.[ch]
177 $(MAKE) -C $(test_module_dir) $(test_module_name) SO=@MODULES_SUFFIX@
178endif
179
162## Check that there is no 'automated' subdirectory, which would 180## Check that there is no 'automated' subdirectory, which would
163## indicate an incomplete merge from an older version of Emacs where 181## indicate an incomplete merge from an older version of Emacs where
164## the tests were arranged differently. 182## the tests were arranged differently.
diff --git a/modules/mod-test/Makefile b/test/data/emacs-module/Makefile
index 27ae2ae3c2c..db5e1b68088 100644
--- a/modules/mod-test/Makefile
+++ b/test/data/emacs-module/Makefile
@@ -17,29 +17,25 @@
17# You should have received a copy of the GNU General Public License 17# You should have received a copy of the GNU General Public License
18# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 18# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 19
20ROOT = ../.. 20ROOT = ../../..
21EMACS = $(ROOT)/src/emacs
22 21
23CC = gcc 22CC = gcc
24LD = gcc 23LD = gcc
25LDFLAGS = 24LDFLAGS =
26 25
27# On MS-Windows, say "make SO=dll" to build the module 26# On MS-Windows, say "make SO=.dll" to build the module
28SO = so 27SO = .so
29# -fPIC is a no-op on Windows, but causes a compiler warning 28# -fPIC is a no-op on Windows, but causes a compiler warning
30ifeq ($(SO),dll) 29ifeq ($(SO),.dll)
31CFLAGS = -std=gnu99 -ggdb3 -Wall 30CFLAGS = -std=gnu99 -ggdb3 -Wall
32else 31else
33CFLAGS = -std=gnu99 -ggdb3 -Wall -fPIC 32CFLAGS = -std=gnu99 -ggdb3 -Wall -fPIC
34endif 33endif
35 34
36all: mod-test.$(SO) 35all: mod-test$(SO)
37 36
38%.$(SO): %.o 37%$(SO): %.o
39 $(LD) -shared $(LDFLAGS) -o $@ $< 38 $(LD) -shared $(LDFLAGS) -o $@ $<
40 39
41%.o: %.c 40%.o: %.c
42 $(CC) $(CFLAGS) -I$(ROOT)/src -c $< 41 $(CC) $(CFLAGS) -I$(ROOT)/src -c $<
43
44check:
45 $(EMACS) -batch -l ert -l test.el -f ert-run-tests-batch-and-exit
diff --git a/modules/mod-test/mod-test.c b/test/data/emacs-module/mod-test.c
index 50be8620bd6..50be8620bd6 100644
--- a/modules/mod-test/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
diff --git a/modules/mod-test/test.el b/test/src/emacs-module-tests.el
index caa807d3005..93e85ae22db 100644
--- a/modules/mod-test/test.el
+++ b/test/src/emacs-module-tests.el
@@ -19,9 +19,9 @@
19 19
20(require 'ert) 20(require 'ert)
21 21
22(add-to-list 'load-path 22(require 'mod-test
23 (file-name-directory (or #$ (expand-file-name (buffer-file-name))))) 23 (expand-file-name "data/emacs-module/mod-test"
24(require 'mod-test) 24 (getenv "EMACS_TEST_DIRECTORY")))
25 25
26;; 26;;
27;; Basic tests. 27;; Basic tests.