emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex 8b44b4f 4/8: Add Makefile to run ERT tests.


From: Stefan Monnier
Subject: [elpa] externals/auctex 8b44b4f 4/8: Add Makefile to run ERT tests.
Date: Fri, 05 Dec 2014 20:00:51 +0000

branch: externals/auctex
commit 8b44b4f74f75e2f49e690d634675bc14105a39ff
Author: Mosè Giordano <address@hidden>
Date:   Sat Nov 29 15:35:31 2014 +0100

    Add Makefile to run ERT tests.
    
    * tests/latex/latex-test.el (latex): Require latex.el.
    (LaTeX-indent-tabular-test/in): Expand file name in load
    directory, for automated tests.
    (LaTeX-indent-tabular-test/out): Ditto.
    
    * tests/Makefile: New Makefile.
    
    * Makefile.in (.PHONY): Add new check target.
    (check): New rule.  Suggest in comments to run it before a new
    release.
---
 ChangeLog                 |   13 +++++++
 Makefile.in               |   11 +++++-
 tests/Makefile            |   89 +++++++++++++++++++++++++++++++++++++++++++++
 tests/latex/latex-test.el |   16 ++++++---
 4 files changed, 122 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 339d936..3ecfba4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2014-11-29  Mos� Giordano  <address@hidden>
+
+       * tests/latex/latex-test.el (latex): Require latex.el.
+       (LaTeX-indent-tabular-test/in): Expand file name in load
+       directory, for automated tests.
+       (LaTeX-indent-tabular-test/out): Ditto.
+
+       * tests/Makefile: New Makefile.
+
+       * Makefile.in (.PHONY): Add new check target.
+       (check): New rule.  Suggest in comments to run it before a new
+       release.
+
 2014-11-28  Stefan Monnier  <address@hidden>
 
        * tex.el (TeX-view-program-list-builtin): Fix up paren typo.
diff --git a/Makefile.in b/Makefile.in
index 950a27a..60e21dc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -178,8 +178,8 @@ all: texmf lisp docs
 .PHONY: all lisp info dvi some install install-el install-lisp docs    \
        install-docs install-auto install-metadata install-startup      \
        install-man clean distclean maintainer-clean extraclean         \
-       tar-ball-clean check-tag release-commit dist snapshot patch     \
-       tar-ball rpm-packages wc xemacs-package windows-package         \
+       tar-ball-clean check-tag check release-commit dist snapshot     \
+       patch tar-ball rpm-packages wc xemacs-package windows-package   \
        release-sign release-upload preview-ball
 
 texmf: latex/Makefile
@@ -381,6 +381,10 @@ wc:
 
 # Steps for making a release:
 #
+# 0) check
+#    Run tests using ERT tool.  Not necessary but strongly suggested before a
+#    release.
+#
 # 1) release-commit TAG=<tag> COMMITTER=<committer>
 #    Tag the release.
 #    Pass `COMMITTER=<committer>' argument only if it is different from
@@ -418,6 +422,9 @@ snapshot: dist
 check-tag:
        @if [ "X$(TAG)" = "X" ]; then echo "*** Error: No TAG ***"; exit 1; fi
 
+check:
+       cd tests && $(MAKE) check
+
 release-commit: check-tag
        @echo "Tagging release $(TAG) in Git ..."
        sleep 5
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..6f281bc
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,89 @@
+# Copyright (C) 2010-2014 Free Software Foundation, Inc.
+
+# This file is part of AUCTeX.
+
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+## Some targets:
+## check: re-run all tests, writing to .log files.
+## check-maybe: run all tests whose .log file needs updating
+## filename.log: run tests from filename.el if .log file needs updating
+## filename: re-run tests from filename.el, with no logging
+
+## Adapted from test/automated/Makefile.in of GNU Emacs.
+
+### Code:
+
+SHELL = /bin/sh
+
+EMACS = emacs
+# AUCTeX source directory.
+SRCDIR = ".."
+
+# Command line flags for Emacs.
+EMACSOPT = -batch -L $(SRCDIR)
+
+# Prevent any settings in the user environment causing problems.
+unexport EMACSDATA EMACSDOC EMACSPATH
+
+## To run tests under a debugger, set this to eg: "gdb --args".
+GDB =
+
+# The actual Emacs command run in the targets below.
+# Prevent any setting of EMACSLOADPATH in user environment causing problems.
+emacs = EMACSLOADPATH= LC_ALL=C $(GDB) "$(EMACS)" $(EMACSOPT)
+
+.PHONY: all check
+
+all: check
+
+# In GNU Emacs there is a bashism here to direct output to file and to standard
+# output at the same time.
+WRITE_LOG = 2>&1 | tee $@
+
+%.log: %.el
+       $(emacs) -l ert -l $< -f ert-run-tests-batch-and-exit ${WRITE_LOG}
+
+ELFILES = $(wildcard */*.el)
+LOGFILES = $(patsubst %.el,%.log, ${ELFILES})
+TESTS = ${LOGFILES:.log=}
+
+## If we have to interrupt a hanging test, preserve the log so we can
+## see what the problem was.
+.PRECIOUS: %.log
+
+.PHONY: ${TESTS}
+
+## The short aliases that always re-run the tests, with no logging.
+define test_template
+$(1):
+       @test ! -f $(1).log || mv $(1).log $(1).log~
+       @${MAKE} $(1).log WRITE_LOG=
+endef
+
+$(foreach test,${TESTS},$(eval $(call test_template,${test})))
+
+## Re-run all the tests every time.
+check:
+       address@hidden f in */*.log; do test ! -f $$f || mv $$f $$f~; done
+       @${MAKE} ${LOGFILES}
+
+.PHONY: clean
+
+clean:
+       -rm -f */*.log */*.log~
+
+# Makefile ends here.
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index 6e04230..ac662db 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,4 +1,4 @@
-;;; latex-test.el --- tests for LaTeX mode?
+;;; latex-test.el --- tests for LaTeX mode
 
 ;; Copyright (C) 2014 Free Software Foundation, Inc.
 
@@ -22,10 +22,16 @@
 ;;; Code:
 
 (require 'ert)
-
-
-(defvar LaTeX-indent-tabular-test/in  (expand-file-name "tabular-in.tex"))
-(defvar LaTeX-indent-tabular-test/out (expand-file-name "tabular-out.tex"))
+(require 'latex)
+
+(defvar LaTeX-indent-tabular-test/in
+  (expand-file-name "tabular-in.tex"
+                   (when load-file-name
+                     (file-name-directory load-file-name))))
+(defvar LaTeX-indent-tabular-test/out
+  (expand-file-name "tabular-out.tex"
+                   (when load-file-name
+                     (file-name-directory load-file-name))))
 
 (ert-deftest LaTeX-indent-tabular ()
   (should (string=



reply via email to

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