Permalink
Browse files

changed makefile test rules

* test/run-test.sh: add. invoke unit test for each emacsen

* Makefile (check): add check rule.
  • Loading branch information...
1 parent e490cc3 commit 0690871943cbaa283ee9048149fa7d0f7296c727 @hayamiz committed Dec 27, 2009
Showing with 21 additions and 13 deletions.
  1. +7 −0 ChangeLog
  2. +3 −13 Makefile
  3. +3 −0 test.el
  4. +8 −0 test/run-test.sh
View
@@ -1,5 +1,12 @@
2009-12-27 Yuto Hayamizu <y.hayamizu@gmail.com>
+ * test/run-test.sh: add. invoke unit test for each emacsen
+
+ * Makefile (check): add check rule.
+
+ * test/el-test-runner.el (twittering-run-test): exit with
+ appropriate status code.
+
* test.el (test-transform-body): add. transforms the body of
`defcase' recursively
(defcase): use `test-transform-body'
View
@@ -1,25 +1,15 @@
EMACS ?= emacs
-.PHONY: all unit-test clean update-po
+.PHONY: all clean update-po check
all:
update-po:
$(MAKE) -C doc update-po
-# batchtest : twittering-mode.el
-# $(EMACS21) --no-init-file --batch -f batch-byte-compile twittering-mode.el
-# rm twittering-mode.elc
-# $(EMACS22) --no-init-file --batch -f batch-byte-compile twittering-mode.el
-# rm twittering-mode.elc
-#
-# test : twittering-mode.el
-# $(EMACS21) -q -l local.test-emacs21.el &
-# $(EMACS22) -q -l local.test-emacs22.el &
-
-unit-test: test/run-test.el
- $(EMACS) --batch -Q -l $<
+check:
+ ./test/run-test.sh
clean :
rm twittering-mode.elc
View
@@ -307,6 +307,7 @@ expressions"
(dolist (case-name (test-args-to-list cases))
(funcall (gethash case-name test-cases))))
+(defvar test-last-summary nil)
(defun test-run-and-summarize (cases)
"Run test cases in CASES and print summary."
(let ((total-succ 0)
@@ -315,6 +316,8 @@ expressions"
(let ((summary (funcall (gethash case-name test-cases))))
(incf total-succ (car summary))
(incf total-fail (cadr summary))))
+ (setq test-last-summary
+ `((succ . ,total-succ) (fail . ,total-fail)))
(princ "# ")
(princ (format "Total: %d pass, %d fail." total-succ total-fail))))
View
@@ -3,5 +3,13 @@
emacsen="emacs23 emacs22 emacs21"
for emacs in $(echo ${emacsen}); do
+ if ! which $emacs 1> /dev/null 2> /dev/null; then
+ echo "No such executable found: ${emacs}: skipped."
+ continue
+ fi
$emacs -q --no-site-file --batch --load $(dirname $0)/el-test-runner.el
+ if [ $? != 0 ]; then
+ echo "Test failed on $(${emacs} --version | head -n 1)"
+ exit 1
+ fi
done

0 comments on commit 0690871

Please sign in to comment.