summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2013-11-23 17:46:35 +0100
committerAchim Gratz <Stromeko@Stromeko.DE>2013-11-23 19:29:34 +0100
commit1b0fb1a4846cdc767ec47115b7c7f26cff40b436 (patch)
treeee816ddb2de27b233194bf3bf14840b52d0000d7
parent9b6cff94aa84eaa3fcf155ff0caf861408c57095 (diff)
downloadorg-mode-1b0fb1a4846cdc767ec47115b7c7f26cff40b436.tar.gz
testing: allow to select tests
* mk/default.mk: Add default for new variable BTEST_RE to select all tests. (BTEST_OB_LANGUAGES): Remove sh (always needed, as emacs-lisp) and add comment for ruby. (BTEST): Use BTEST_RE to select tests from the test suite. Reorganize pre-loading of Org, Babel, Ox and babel languages into a known clean environment. * mk/targets.mk (CONF_TEST): Add BTEST_RE to the output of config-test. * testing/org-batch-test-init.el: New file. Remove all traces of any Org built into Emacs or otherwise present in the environment so it can not be picked up spuriously during testing or conceal errors in the Org version under test. * testing/org-test.el (org-test-run-batch-tests): Showtest selection in messages. (org-test-run-all-tests): Update ID locations.
-rw-r--r--mk/default.mk23
-rw-r--r--mk/targets.mk2
-rw-r--r--testing/org-batch-test-init.el20
-rw-r--r--testing/org-test.el2
4 files changed, 39 insertions, 8 deletions
diff --git a/mk/default.mk b/mk/default.mk
index a39ecec..dda2610 100644
--- a/mk/default.mk
+++ b/mk/default.mk
@@ -39,8 +39,9 @@ BTEST_POST =
# -L <path-to>/ert # needed for Emacs23, Emacs24 has ert built in
# -L <path-to>/ess # needed for running R tests
# -L <path-to>/htmlize # need at least version 1.34 for source code formatting
-BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave python sh perl
+BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave perl python
# R # requires ESS to be installed and configured
+ # ruby # requires inf-ruby to be installed and configured
# extra packages to require for testing
BTEST_EXTRA =
# ess-site # load ESS for R tests
@@ -50,18 +51,26 @@ BTEST_EXTRA =
# How to run tests
req-ob-lang = --eval '(require '"'"'ob-$(ob-lang))'
+lst-ob-lang = ($(ob-lang) . t)
req-extra = --eval '(require '"'"'$(req))'
+BTEST_RE ?= \\(org\\|ob\\)
BTEST = $(BATCH) \
$(BTEST_PRE) \
- --eval '(add-to-list '"'"'load-path "./lisp")' \
- --eval '(add-to-list '"'"'load-path "./testing")' \
+ --eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' \
+ --eval '(add-to-list '"'"'load-path (concat default-directory "testing"))' \
$(BTEST_POST) \
+ -l org-batch-test-init \
+ --eval '(setq \
+ org-batch-test t \
+ org-babel-load-languages \
+ (quote ($(foreach ob-lang,$(BTEST_OB_LANGUAGES) emacs-lisp sh org,$(lst-ob-lang)))) \
+ org-test-select-re "$(BTEST_RE)" \
+ )' \
-l org-loaddefs.el \
- -l testing/org-test.el \
- $(foreach ob-lang,$(BTEST_OB_LANGUAGES),$(req-ob-lang)) \
+ -l cl -l testing/org-test.el \
+ -l ert -l org -l ox \
$(foreach req,$(BTEST_EXTRA),$(req-extra)) \
- --eval '(setq org-confirm-babel-evaluate nil)' \
- -f org-test-run-batch-tests
+ --eval '(org-test-run-batch-tests org-test-select-re)'
# Using emacs in batch mode.
# BATCH = $(EMACS) -batch -vanilla # XEmacs
diff --git a/mk/targets.mk b/mk/targets.mk
index aef11eb..b753957 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -35,7 +35,7 @@ endif
CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
CONF_DEST = lispdir infodir datadir testdir
-CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
+CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
config-eol:: EOL = \#
diff --git a/testing/org-batch-test-init.el b/testing/org-batch-test-init.el
new file mode 100644
index 0000000..8638756
--- /dev/null
+++ b/testing/org-batch-test-init.el
@@ -0,0 +1,20 @@
+;;
+;; Remove Org remnants built into Emacs
+;;
+
+;; clean load-path
+(setq load-path
+ (delq nil (mapcar
+ (function (lambda (p)
+ (unless (string-match "lisp\\(/packages\\)?/org$" p)
+ p)))
+ load-path)))
+;; remove property list to defeat cus-load and remove autoloads
+(mapatoms (function (lambda (s)
+ (let ((sn (symbol-name s)))
+ (when (string-match "^\\(org\\|ob\\|ox\\)\\(-.*\\)?$" sn)
+ (setplist s nil)
+ (when (eq 'autoload (car-safe s))
+ (unintern s)))))))
+
+;; we should now start from a clean slate
diff --git a/testing/org-test.el b/testing/org-test.el
index da55dd6..565a384 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -424,6 +424,7 @@ Load all test files first."
(org-test-touch-all-examples)
(org-test-update-id-locations)
(org-test-load)
+ (message "selected tests: %s" org-test-selector)
(ert-run-tests-batch-and-exit org-test-selector)))
(defun org-test-run-all-tests ()
@@ -431,6 +432,7 @@ Load all test files first."
Load all test files first."
(interactive)
(org-test-touch-all-examples)
+ (org-test-update-id-locations)
(org-test-load)
(ert "\\(org\\|ob\\)")
(org-test-kill-all-examples))