Patchwork [O] Add test-run capability to Makefile

login
register
Submitter Martyn Jago
Date 2012-01-04 14:35:20
Message ID <m2obuj7cyf.fsf@btinternet.com>
Download mbox | patch
Permalink /patch/1096/
State New
Headers show

Comments

Martyn Jago - 2012-01-04 14:35:20
Since the Makefile is currently getting a refresh I thought it would be
very useful to allow running of the regression test suite directly from
make using `make test'.

The following patch achieves this and allows a user to run the
regression test suite on the their system following installation. This
makes it super-easy for a user to validate their latest org-mode
installation.

HTH

Best, Martyn
Achim Gratz - 2012-01-04 20:15:36
Martyn Jago <martyn.jago@btinternet.com> writes:
> Since the Makefile is currently getting a refresh I thought it would be
> very useful to allow running of the regression test suite directly from
> make using `make test'.

Good idea, I just added it to my Makefile fork as well.

> The following patch achieves this and allows a user to run the
> regression test suite on the their system following installation. This
> makes it super-easy for a user to validate their latest org-mode
> installation.

Four tests require htmlize, which is a non-standard package (and can't
be found on my system in batch mode unless I direct Emacs to load my
.emacs anyway).  It would be nice if the tests would expectedly fail if
htmlize can't be found, maybe with an additional message in the summary
that full coverage hasn't been reached due to missing libraries.


Achim.
Eric Schulte - 2012-01-04 20:51:27
Achim Gratz <Stromeko@nexgo.de> writes:

> Martyn Jago <martyn.jago@btinternet.com> writes:
>> Since the Makefile is currently getting a refresh I thought it would be
>> very useful to allow running of the regression test suite directly from
>> make using `make test'.
>
> Good idea, I just added it to my Makefile fork as well.
>

Very cool, I anticipate using this feature with great frequency.

>
>> The following patch achieves this and allows a user to run the
>> regression test suite on the their system following installation. This
>> makes it super-easy for a user to validate their latest org-mode
>> installation.
>
> Four tests require htmlize, which is a non-standard package (and can't
> be found on my system in batch mode unless I direct Emacs to load my
> .emacs anyway).  It would be nice if the tests would expectedly fail if
> htmlize can't be found, maybe with an additional message in the summary
> that full coverage hasn't been reached due to missing libraries.
>

If the following simple macro is added to org-test.el,

#+begin_src emacs-lisp
  (defmacro depends-upon (feature deftest)
    (declare (indent 1))
    (if (featurep feature)
        `,deftest
      `(ert-deftest ,(cadr deftest) () :expected-result :failed (should nil))))
#+end_src

Then the offending tests can be wrapped in `depends-upon' forms, e.g.

(depends-upon htmlize
  (ert-deftest should-have-htmlize ()
    (should (featurep 'htmlize))))

If you have the names of the offending tests this should be a simple
fix.  I'm happy to apply this to the test suite, but I don't know which
four tests rely upon htmlize.

Cheers,

>
>
> Achim.
Achim Gratz - 2012-01-04 22:01:01
Eric Schulte <eric.schulte@gmx.com> writes:
> If you have the names of the offending tests this should be a simple
> fix.  I'm happy to apply this to the test suite, but I don't know which
> four tests rely upon htmlize.

Actually, it wasn't htmlize that made these four tests fail (only two of
them use it and while a warning is shown, the test itself passes).  What
was missing is that I need to define org-release since in batch mode I'm
not loading org-install.el.  This happens only in my fork since I
removed the version strings from org.el, I just corrected the default.mk
to take care of this.


Regards,
Achim.
Bastien Guerry - 2012-01-05 09:58:21
Martyn Jago <martyn.jago@btinternet.com> writes:

> Since the Makefile is currently getting a refresh I thought it would be
> very useful to allow running of the regression test suite directly from
> make using `make test'.

Nice -- I will test this through Achim's branch.

Thanks!

Patch

From f025591e918d8921eaea0188da0b0da806c8b6f6 Mon Sep 17 00:00:00 2001
From: Martyn Jago <martyn.jago@btinternet.com>
Date: Wed, 4 Jan 2012 14:24:27 +0000
Subject: [PATCH] Add test command to Makefile
 * Makefile:

This patch enables `make test' to run the regression tests on the
user's system following installation. This makes it super-easy for a
user to validate their system.
---
 Makefile |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 520b0fd..491d761 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,9 @@  infodir = $(prefix)/share/info
 BATCH=$(EMACS) -batch -q -no-site-file -eval                             			\
   "(setq load-path (cons (expand-file-name \"./lisp/\") (cons \"$(lispdir)\" load-path)))" $(BATCH_EXTRA)
 
+BATCHTEST=$(EMACS) -Q -batch -l testing/org-test.el \
+  -eval "(setq org-confirm-babel-evaluate nil)" -f org-test-run-batch-tests
+
 # Specify the byte-compiler for compiling org-mode files
 ELC= $(BATCH) -f batch-byte-compile
 
@@ -496,6 +499,9 @@  pushreleasetag:
 	git tag -m "Adding release tag" -a release_$(TAG)
 	git push orgmode@orgmode.org:org-mode.git release_$(TAG)
 
+test:
+	$(BATCHTEST)
+ 
 # Dependencies
 
 lisp/org.elc:		lisp/org-macs.el lisp/org-compat.el lisp/org-faces.el
-- 
1.7.3.4