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:58:43 +0200 Message-ID: <20170422145843.39512-1-phst@google.com> References: <8360hwqz1g.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1492873155 11101 195.159.176.226 (22 Apr 2017 14:59:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Apr 2017 14:59:15 +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:59:05 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 1d1wV6-0002fZ-Oi for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2017 16:59:04 +0200 Original-Received: from localhost ([::1]:35894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1wVA-0002k1-Sx for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2017 10:59:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1wV1-0002jt-AF for emacs-devel@gnu.org; Sat, 22 Apr 2017 10:59:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1wUy-00078R-5I for emacs-devel@gnu.org; Sat, 22 Apr 2017 10:58:59 -0400 Original-Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:32813) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d1wUx-00077w-QK for emacs-devel@gnu.org; Sat, 22 Apr 2017 10:58:56 -0400 Original-Received: by mail-wm0-x22d.google.com with SMTP id y18so2363364wmh.0 for ; Sat, 22 Apr 2017 07:58:55 -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:in-reply-to:references; bh=BEhMt+BqLz1jants8sZ5i6NuA2tZR9/eTT/ZWhwxKCI=; b=EJDjoNLH30Krdhs2ZucQX/6ebSdWwK17o9GcHUvEZ0sozVbdqNoLGRfh5jfvfVfRzo CuI9Sn3+Pz4iXdxNCzksYFt1GCpWsvl9AWhCmzn5ur/23PjJrMymM4QE+dT6crHMo9hK tU6Uvoj0G5HAAGjWOjmS4XIYMCQvZMrMcThKiKs1fdv3udEXvOln26S6RUB51hXFA/81 88WesDv/7Wz+cb8ZZIzb+6fRud3NG2kPO83pv+zLISUSGmey0ZIGd9g3o9rbsF8WdfxG 27FUwSuc+A878860xlNZXfk+l5LX5sCAwINjp9zNmRRt4F0Arxc1ecUtiynlgcntEPSZ IXvQ== 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:in-reply-to :references; bh=BEhMt+BqLz1jants8sZ5i6NuA2tZR9/eTT/ZWhwxKCI=; b=XnUUIklPwf7DDa+s2HXVGD3JECTP9UmaB6h0xLLErpiQinvxp/Dyz7tBJGtRcVJe+6 XHBAJ57vFObrsHluSfJsEd2vv0IUeeRmDhTEFLqNwtqXByBqBivGIPZSUQGRXOvYc7OI 7zuOi/tJfzzqepY8VYsmL8I/tKags1/kNt0gL5+qnfgqTdwIN/moG98Z82pWAf92rdGM 32oYBZpy2APi4qO8kQeoJjJegye4Bs0aBjUY2xdP3/hrXujPdDpAkPSm3xeMTuVpN7gF zhQkd0eH6zlQCcGSL4cB/P1JmEqou0dczDI1nOlD0qqk5a5kN87k5wYfPqhopjvTzlee CsvA== X-Gm-Message-State: AN3rC/7nC7SkDxLIy9niOJRTYT3pyBpudo6zfLXOCaQmMAi1BPFvzkZQ soB5eY3Mq8c6JA== X-Received: by 10.28.31.196 with SMTP id f187mr3105206wmf.117.1492873134252; Sat, 22 Apr 2017 07:58:54 -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 q140sm3239624wmb.14.2017.04.22.07.58.52 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 22 Apr 2017 07:58:52 -0700 (PDT) X-Google-Original-From: Philipp Stephani X-Mailer: git-send-email 2.12.2 In-Reply-To: <8360hwqz1g.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22d 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:214213 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. (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. --- configure.ac | 2 ++ test/Makefile.in | 22 ++++++++++++++++++++-- .../mod-test => test/data/emacs-module}/Makefile | 16 ++++++---------- .../mod-test => test/data/emacs-module}/mod-test.c | 0 .../test.el => test/src/emacs-module-tests.el | 6 +++--- 5 files changed, 31 insertions(+), 15 deletions(-) rename {modules/mod-test => test/data/emacs-module}/Makefile (81%) 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..03ae32e3a6 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,15 @@ 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=@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 81% rename from modules/mod-test/Makefile rename to test/data/emacs-module/Makefile index 27ae2ae3c2..db5e1b6808 100644 --- a/modules/mod-test/Makefile +++ b/test/data/emacs-module/Makefile @@ -17,29 +17,25 @@ # 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 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 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