mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
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.
This commit is contained in:
parent
6a3f331565
commit
bfc0f610ba
5 changed files with 31 additions and 15 deletions
|
|
@ -3476,6 +3476,8 @@ if test "${HAVE_MODULES}" = yes; then
|
|||
fi
|
||||
AC_SUBST(MODULES_OBJ)
|
||||
AC_SUBST(LIBMODULES)
|
||||
AC_SUBST(HAVE_MODULES)
|
||||
AC_SUBST(MODULES_SUFFIX)
|
||||
|
||||
### Use -lpng if available, unless '--with-png=no'.
|
||||
HAVE_PNG=no
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ TEST_LOCALE = C
|
|||
|
||||
# The actual Emacs command run in the targets below.
|
||||
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
|
||||
emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) EMACS_TEST_DIRECTORY=$(srcdir) \
|
||||
emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \
|
||||
EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \
|
||||
$(GDB) "$(EMACS)" $(EMACSOPT)
|
||||
|
||||
.PHONY: all check
|
||||
|
|
@ -124,8 +125,16 @@ endif
|
|||
$(emacs) -l ert -l $$loadfile \
|
||||
--eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG}
|
||||
|
||||
ifeq (@HAVE_MODULES@, yes)
|
||||
maybe_exclude_module_tests :=
|
||||
else
|
||||
maybe_exclude_module_tests := -name emacs-module-tests.el -prune -o
|
||||
endif
|
||||
|
||||
ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
|
||||
-name "*resources" -prune -o -name "*.el" -print)
|
||||
-name "*resources" -prune -o \
|
||||
${maybe_exclude_module_tests} \
|
||||
-name "*.el" -print)
|
||||
## .log files may be in a different directory for out of source builds
|
||||
LOGFILES := $(patsubst %.el,%.log, \
|
||||
$(patsubst $(srcdir)/%,%,$(ELFILES)))
|
||||
|
|
@ -159,6 +168,15 @@ endef
|
|||
|
||||
$(foreach test,${TESTS},$(eval $(call test_template,${test})))
|
||||
|
||||
ifeq (@HAVE_MODULES@, yes)
|
||||
test_module_dir := $(srcdir)/data/emacs-module
|
||||
test_module_name := mod-test@MODULES_SUFFIX@
|
||||
test_module := $(test_module_dir)/$(test_module_name)
|
||||
$(srcdir)/src/emacs-module-tests.log: $(test_module)
|
||||
$(test_module): $(srcdir)/../src/emacs-module.[ch]
|
||||
$(MAKE) -C $(test_module_dir) $(test_module_name) SO=@MODULES_SUFFIX@
|
||||
endif
|
||||
|
||||
## Check that there is no 'automated' subdirectory, which would
|
||||
## indicate an incomplete merge from an older version of Emacs where
|
||||
## the tests were arranged differently.
|
||||
|
|
|
|||
|
|
@ -17,29 +17,25 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ROOT = ../..
|
||||
EMACS = $(ROOT)/src/emacs
|
||||
ROOT = ../../..
|
||||
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
LDFLAGS =
|
||||
|
||||
# On MS-Windows, say "make SO=dll" to build the module
|
||||
SO = so
|
||||
# On MS-Windows, say "make SO=.dll" to build the module
|
||||
SO = .so
|
||||
# -fPIC is a no-op on Windows, but causes a compiler warning
|
||||
ifeq ($(SO),dll)
|
||||
ifeq ($(SO),.dll)
|
||||
CFLAGS = -std=gnu99 -ggdb3 -Wall
|
||||
else
|
||||
CFLAGS = -std=gnu99 -ggdb3 -Wall -fPIC
|
||||
endif
|
||||
|
||||
all: mod-test.$(SO)
|
||||
all: mod-test$(SO)
|
||||
|
||||
%.$(SO): %.o
|
||||
%$(SO): %.o
|
||||
$(LD) -shared $(LDFLAGS) -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -I$(ROOT)/src -c $<
|
||||
|
||||
check:
|
||||
$(EMACS) -batch -l ert -l test.el -f ert-run-tests-batch-and-exit
|
||||
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
(require 'ert)
|
||||
|
||||
(add-to-list 'load-path
|
||||
(file-name-directory (or #$ (expand-file-name (buffer-file-name)))))
|
||||
(require 'mod-test)
|
||||
(require 'mod-test
|
||||
(expand-file-name "data/emacs-module/mod-test"
|
||||
(getenv "EMACS_TEST_DIRECTORY")))
|
||||
|
||||
;;
|
||||
;; Basic tests.
|
||||
Loading…
Reference in a new issue