From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.devel
Subject: [PATCH] Integrate module test with normal test suite
Date: Sat, 22 Apr 2017 16:23:27 +0200
Message-ID: <20170422142327.12213-1-phst@google.com>
NNTP-Posting-Host: blaine.gmane.org
X-Trace: blaine.gmane.org 1492871040 1779 195.159.176.226 (22 Apr 2017 14:24:00 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 22 Apr 2017 14:24:00 +0000 (UTC)
Cc: Philipp Stephani
To: emacs-devel@gnu.org
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 22 16:23:52 2017
Return-path:
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
by blaine.gmane.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1d1vx2-0000EY-Fm
for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2017 16:23:52 +0200
Original-Received: from localhost ([::1]:35819 helo=lists.gnu.org)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from )
id 1d1vx5-00075H-2V
for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2017 10:23:55 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53733)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1d1vwy-000757-Bm
for emacs-devel@gnu.org; Sat, 22 Apr 2017 10:23:49 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1d1vwv-0004ks-4N
for emacs-devel@gnu.org; Sat, 22 Apr 2017 10:23:48 -0400
Original-Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:38854)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
(Exim 4.71) (envelope-from )
id 1d1vwu-0004kc-QC
for emacs-devel@gnu.org; Sat, 22 Apr 2017 10:23:45 -0400
Original-Received: by mail-wm0-x236.google.com with SMTP id r190so36425566wme.1
for ; Sat, 22 Apr 2017 07:23:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=from:to:cc:subject:date:message-id;
bh=7F2f5t+ZM4r8rzHaYYzEn/FPeJw1jaYX0SbxNoxcJ0s=;
b=kXCaVs9JD+qhAffFwC4d7z+Sbjan6O+DBNpZViyLD7e05lnLPCpe9qIvhAknC5bciG
DNxT22+WfyVqDW18fGZWOSviNnnXoJnooOP8uzlOL0X8ZKy2JqvRhKKEFl4T5sDOYhR4
UaXhZIg5PZz6PNyrbIdN4aJ7P50maB2CHxZ6KjB49dIVPTcCNBfylraM5h8nrHc5JQ6x
VwQsH+DvH6AtWIlC36UhBfSMTiJJiW2EsIxAN/yvdF9mU2xKP0j9Enxd6Vj9aDuKn4UP
dQwQvi634YBtObUrzdry9jWGEMOoOqBuI0zPWI7EfArOtYquy9OtmxYPPtYiNQ3/1FqU
80Sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:to:cc:subject:date:message-id;
bh=7F2f5t+ZM4r8rzHaYYzEn/FPeJw1jaYX0SbxNoxcJ0s=;
b=BMQkFD7O2mtION0cxO1jRKJJO9JPlVQEzzltcK1rQSrgtm6vvCWBOEcP17mDRQbaJT
A97gxfY9xwfY+u9ZqOq+w8WuSzLH0po3g1rjVvhnbC8cEmNNYL6hjxMQwkw4yxKnm3D8
lzjaWhBVPONtYI7kONLUsde/Oq8EQKhqtGnZ5huX4qKD9Cx73Hlx8FGImPq4pUsSTCWC
aMlBxJPkYkxNDYYAc3Fk0cnQ8Mef8Ns4JgdP5ALUjHHteAFy0qt8tRKdoMRTcdT9N7GY
QI02wOqBHGakGbdA/Fdv4hdTUxzEW1f4JGiO2/kYd5vQpe4KVvzkElBpAPsP05k32fOe
HftA==
X-Gm-Message-State: AN3rC/76673Tl7Vxd6ERw8aMjllh4Z+uPPC1novM4H+ohui96RW83hu4
o2Z2FGOdj74esV70aK4=
X-Received: by 10.28.74.218 with SMTP id n87mr1956136wmi.71.1492871023500;
Sat, 22 Apr 2017 07:23:43 -0700 (PDT)
Original-Received: from p.cm.cablesurf.de (46.128.198.151.dynamic.cablesurf.de.
[46.128.198.151])
by smtp.gmail.com with ESMTPSA id 19sm5806387wmr.30.2017.04.22.07.23.42
(version=TLS1 cipher=AES128-SHA bits=128/128);
Sat, 22 Apr 2017 07:23:42 -0700 (PDT)
X-Google-Original-From: Philipp Stephani
X-Mailer: git-send-email 2.12.2
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-Received-From: 2a00:1450:400c:c09::236
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Emacs development discussions."
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: "Emacs-devel"
Xref: news.gmane.org gmane.emacs.devel:214211
Archived-At:
* 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.
* 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.
---
configure.ac | 2 ++
test/Makefile.in | 23 ++++++++++++++++++++--
.../mod-test => test/data/emacs-module}/Makefile | 6 +-----
.../mod-test => test/data/emacs-module}/mod-test.c | 0
.../test.el => test/src/emacs-module-tests.el | 6 +++---
5 files changed, 27 insertions(+), 10 deletions(-)
rename {modules/mod-test => test/data/emacs-module}/Makefile (90%)
rename {modules/mod-test => test/data/emacs-module}/mod-test.c (100%)
rename modules/mod-test/test.el => test/src/emacs-module-tests.el (97%)
diff --git a/configure.ac b/configure.ac
index bd8f7650cc..f3c53d7a19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3476,6 +3476,8 @@ AC_DEFUN
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
diff --git a/test/Makefile.in b/test/Makefile.in
index a1b772de21..708b60640f 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -63,7 +63,8 @@ TEST_LOCALE =
# 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 @@ SELECTOR_ACTUAL=
$(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,16 @@ define test_template
$(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=$(patsubst .%,%,@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.
diff --git a/modules/mod-test/Makefile b/test/data/emacs-module/Makefile
similarity index 90%
rename from modules/mod-test/Makefile
rename to test/data/emacs-module/Makefile
index 27ae2ae3c2..d415622e58 100644
--- a/modules/mod-test/Makefile
+++ b/test/data/emacs-module/Makefile
@@ -17,8 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see .
-ROOT = ../..
-EMACS = $(ROOT)/src/emacs
+ROOT = ../../..
CC = gcc
LD = gcc
@@ -40,6 +39,3 @@ all:
%.o: %.c
$(CC) $(CFLAGS) -I$(ROOT)/src -c $<
-
-check:
- $(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
similarity index 100%
rename from modules/mod-test/mod-test.c
rename to test/data/emacs-module/mod-test.c
diff --git a/modules/mod-test/test.el b/test/src/emacs-module-tests.el
similarity index 97%
rename from modules/mod-test/test.el
rename to test/src/emacs-module-tests.el
index caa807d300..93e85ae22d 100644
--- a/modules/mod-test/test.el
+++ b/test/src/emacs-module-tests.el
@@ -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.
--
2.12.2