Commit d221e780 authored by Christian Ohler's avatar Christian Ohler

Add ERT, a tool for automated testing in Emacs Lisp.

*,, doc/misc/, doc/misc/makefile.w32-in:
Add ERT.  Make "make check" run tests in test/automated.

* doc/misc/ert.texi, lisp/emacs-lisp/ert.el, lisp/emacs-lisp/ert-x.el:
New files.

* test/automated: New directory.
parent 03d32f1b
2011-01-13 Christian Ohler <>
* (check): Run tests in test/automated.
* Add test/automated/Makefile.
2011-01-07 Paul Eggert <>
* install-sh, mkinstalldirs, move-if-change: Update from master
......@@ -134,7 +134,7 @@ MAN_PAGES=ctags.1 ebrowse.1 emacs.1 emacsclient.1 etags.1 \
INFO_FILES=ada-mode auth autotype calc ccmode cl dbus dired-x ebrowse \
ede ediff edt eieio efaq eintr elisp emacs emacs-mime epa erc \
eshell eudc flymake forms gnus idlwave info mairix-el \
ert eshell eudc flymake forms gnus idlwave info mairix-el \
message mh-e newsticker nxml-mode org pcl-cvs pgg rcirc \
reftex remember sasl sc semantic ses sieve smtpmail speedbar \
tramp url vip viper widget woman
......@@ -267,7 +267,7 @@ EMACSFULL = `echo emacs-${version}${EXEEXT} | sed '$(TRANSFORM)'`
SUBDIR = lib-src src lisp
# The subdir makefiles created by config.status.
SUBDIR_MAKEFILES = lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile
SUBDIR_MAKEFILES = lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile test/automated/Makefile
# Subdirectories to install, and where they'll go.
# lib-src's makefile knows how to install it, so we don't do that here.
......@@ -368,7 +368,8 @@ Makefile: config.status $(srcdir)/src/ \
$(srcdir)/oldXMenu/ \
$(srcdir)/lwlib/ \
$(srcdir)/leim/ \
$(srcdir)/lisp/ \
config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
......@@ -810,7 +811,7 @@ TAGS tags: lib-src src
cd src; $(MAKE) tags
@echo "We don't have any tests for GNU Emacs yet."
cd test/automated; $(MAKE) check
cd ${srcdir}; ./make-dist
......@@ -3750,7 +3750,7 @@ dnl the use of force in the `epaths-force' rule in
AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
doc/lispref/Makefile src/Makefile \
lwlib/Makefile lisp/Makefile leim/Makefile, [
lwlib/Makefile lisp/Makefile leim/Makefile test/automated/Makefile, [
### Make the necessary directories, if they don't exist.
for dir in etc lisp ; do
2011-01-13 Christian Ohler <>
* ert.texi: New file.
* makefile.w32-in: Add ert.texi.
2011-01-10 Jan Moringen <>
* dbus.texi (Receiving Method Calls): New function
......@@ -62,6 +62,7 @@ INFO_TARGETS = \
$(infodir)/emacs-mime \
$(infodir)/epa \
$(infodir)/erc \
$(infodir)/ert \
$(infodir)/eshell \
$(infodir)/eudc \
$(infodir)/efaq \
......@@ -112,6 +113,7 @@ DVI_TARGETS = \
emacs-mime.dvi \
epa.dvi \
erc.dvi \
ert.dvi \
eshell.dvi \
eudc.dvi \
faq.dvi \
......@@ -162,6 +164,7 @@ PDF_TARGETS = \
emacs-mime.pdf \
epa.pdf \
erc.pdf \
ert.pdf \
eshell.pdf \
eudc.pdf \
faq.pdf \
......@@ -360,6 +363,14 @@ erc.dvi: ${srcdir}/erc.texi
erc.pdf: ${srcdir}/erc.texi
ert : $(infodir)/ert
$(infodir)/ert: ert.texi $(infodir)
cd $(srcdir); $(MAKEINFO) ert.texi
ert.dvi: ert.texi
$(ENVADD) $(TEXI2DVI) ${srcdir}/ert.texi
ert.pdf: ert.texi
$(ENVADD) $(TEXI2PDF) ${srcdir}/ert.texi
eshell : $(infodir)/eshell
$(infodir)/eshell: eshell.texi
This diff is collapsed.
......@@ -47,7 +47,8 @@ INFO_TARGETS = $(infodir)/ccmode \
$(infodir)/org $(infodir)/url $(infodir)/speedbar \
$(infodir)/tramp $(infodir)/ses $(infodir)/smtpmail \
$(infodir)/flymake $(infodir)/newsticker $(infodir)/rcirc \
$(infodir)/erc $(infodir)/remember $(infodir)/nxml-mode \
$(infodir)/erc $(infodir)/ert \
$(infodir)/remember $(infodir)/nxml-mode \
$(infodir)/epa $(infodir)/mairix-el $(infodir)/sasl \
$(infodir)/auth $(infodir)/eieio $(infodir)/ede \
$(infodir)/semantic $(infodir)/edt
......@@ -58,7 +59,8 @@ DVI_TARGETS = calc.dvi cc-mode.dvi cl.dvi dbus.dvi dired-x.dvi \
ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
newsticker.dvi rcirc.dvi erc.dvi remember.dvi nxml-mode.dvi \
newsticker.dvi rcirc.dvi erc.dvi ert.dvi \
remember.dvi nxml-mode.dvi \
epa.dvi mairix-el.dvi sasl.dvi auth.dvi eieio.dvi ede.dvi \
semantic.dvi edt.dvi
INFOSOURCES = info.texi
......@@ -305,6 +307,11 @@ $(infodir)/erc: erc.texi
erc.dvi: erc.texi
$(ENVADD) $(TEXI2DVI) $(srcdir)/erc.texi
$(infodir)/ert: ert.texi
$(MAKEINFO) ert.texi
ert.dvi: ert.texi
$(ENVADD) $(TEXI2DVI) $(srcdir)/ert.texi
$(infodir)/epa: epa.texi
$(MAKEINFO) epa.texi
epa.dvi: epa.texi
......@@ -362,7 +369,7 @@ clean: mostlyclean
$(infodir)/url* $(infodir)/org* \
$(infodir)/flymake* $(infodir)/newsticker* \
$(infodir)/sieve* $(infodir)/pgg* \
$(infodir)/erc* $(infodir)/rcirc* \
$(infodir)/erc* $(infodir)/ert* $(infodir)/rcirc* \
$(infodir)/remember* $(infodir)/nxml-mode* \
$(infodir)/epa* $(infodir)/sasl* \
$(infodir)/mairix-el* $(infodir)/auth* \
2011-01-13 Christian Ohler <>
* NEWS: Mention ERT.
2011-01-10 Jan Moringen <>
* NEWS: Add new function dbus-register-service.
......@@ -210,6 +210,10 @@ automatically when Emacs starts up. To disable this, set
`package-enable-at-startup' to nil. To change which packages are
loaded, customize `package-load-list'.
** An Emacs Lisp testing tool is now included.
Emacs Lisp developers can use this tool to write automated tests for
their code. See the ERT info manual for details.
** Custom Themes
*** `M-x customize-themes' lists Custom themes which can be enabled.
2011-01-13 Christian Ohler <>
* emacs-lisp/ert.el, emacs-lisp/ert-x.el: New files.
2011-01-11 Johan Bockgård <>
* emacs-lisp/unsafep.el (unsafep): Handle backquoted forms.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
2011-01-13 Christian Ohler <>
* automated: New directory for automated tests.
* automated/ert-tests.el, automated/ert-x-tests.el: New files.
* automated/ New file.
2010-11-11 Stefan Monnier <>
* indent/modula2.mod: New file.
# Maintenance productions for the automated test directory
# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
# This file is part of GNU Emacs.
# 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
# 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 <>.
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
abs_top_builddir = @abs_top_builddir@
test = $(srcdir)
VPATH = $(srcdir)
lispsrc = $(top_srcdir)/lisp
lisp = ${abs_top_builddir}/lisp
# You can specify a different executable on the make command line,
# e.g. "make EMACS=../src/emacs ...".
# We sometimes change directory before running Emacs (typically when
# building out-of-tree, we chdir to the source directory), so we need
# to use an absolute file name.
EMACS = ${abs_top_builddir}/src/emacs
# Command line flags for Emacs.
EMACSOPT = -batch --no-site-file --no-site-lisp
# Extra flags to pass to the byte compiler
# For example to not display the undefined function warnings you can use this:
# BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
# The example above is just for developers, it should not be used by default.
# The actual Emacs command run in the targets below.
emacs = EMACSLOADPATH=$(lispsrc):$(test) LC_ALL=C $(EMACS) $(EMACSOPT)
# Common command to find subdirectories
setwins=subdirs=`(find . -type d -print)`; \
for file in $$subdirs; do \
case $$file in */.* | */.*/* | */=* ) ;; \
*) wins="$$wins $$file" ;; \
esac; \
all: test
# Files MUST be compiled one by one. If we compile several files in a
# row (i.e., in the same instance of Emacs) we can't make sure that
# the compilation environment is clean. We also set the load-path of
# the Emacs used for compilation to the current directory and its
# subdirectories, to make sure require's and load's in the files being
# compiled find the right files.
.SUFFIXES: .elc .el
# An old-fashioned suffix rule, which, according to the GNU Make manual,
# cannot have prerequisites.
@echo Compiling $<
@$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
.PHONY: lisp-compile compile-main compile compile-always
cd $(lisp); $(MAKE) $(MFLAGS) compile EMACS=$(EMACS)
# In `compile-main' we could directly do
# ... | xargs $(MAKE) $(MFLAGS) EMACS="$(EMACS)"
# and it works, but it generates a lot of messages like
# make[2]: « gnus/gnus-mlspl.elc » is up to date.
# so instead, we use "xargs echo" to split the list of file into manageable
# chunks and then use an intermediate `compile-targets' target so the
# actual targets (the .elc files) are not mentioned as targets on the
# make command line.
.PHONY: compile-targets
# TARGETS is set dynamically in the recursive call from `compile-main'.
compile-targets: $(TARGETS)
# Compile all the Elisp files that need it. Beware: it approximates
# `no-byte-compile', so watch out for false-positives!
compile-main: compile-clean lisp-compile
@(cd $(test); $(setwins); \
els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
for el in $$els; do \
test -f $$el || continue; \
test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
echo "$${el}c"; \
done | xargs echo) | \
while read chunk; do \
$(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
.PHONY: compile-clean
# Erase left-over .elc files that do not have a corresponding .el file.
@cd $(test); $(setwins); \
elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
if test -f "$$el" -o \! -f "$${el}c"; then :; else \
echo rm "$${el}c"; \
rm "$${el}c"; \
fi \
# Compile all Lisp files, but don't recompile those that are up to
# date. Some .el files don't get compiled because they set the
# local variable no-byte-compile.
# Calling make recursively because suffix rule cannot have prerequisites.
# Explicitly pass EMACS (sometimes ../src/bootstrap-emacs) to those
# sub-makes that run rules that use it, for the sake of some non-GNU makes.
compile: $(LOADDEFS) autoloads compile-first
$(MAKE) $(MFLAGS) compile-main EMACS=$(EMACS)
# Compile all Lisp files. This is like `compile' but compiles files
# unconditionally. Some files don't actually get compiled because they
# set the local variable no-byte-compile.
compile-always: doit
cd $(test); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
$(MAKE) $(MFLAGS) compile EMACS=$(EMACS)
cd $(test); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
-rm -f ./Makefile
maintainer-clean: distclean bootstrap-clean
check: compile-main
@(cd $(test); $(setwins); \
pattern=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
for el in $$pattern; do \
test -f $$el || continue; \
args="$$args -l $$el"; \
els="$$els $$el"; \
done; \
echo Testing $$els; \
$(emacs) $$args -f ert-run-tests-batch-and-exit)
# Makefile ends here.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment