summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2013-08-15 16:25:43 +0300
committerBozhidar Batsov <bozhidar@batsov.com>2013-08-15 16:25:43 +0300
commit7a1ca0434574a0b75494d9284b9f0d9d023b0143 (patch)
tree65c7d35fe5c461bc9da653e42a5fc6f7e5a618db /Makefile
parent73925f528db529513327fd6ccb1715663a739b69 (diff)
Simplify test infrastructure
* Manage dependencies with Cask * Add a Vagrantfile and a shell script for provisioning * Simplify Makefile * Add a script for running the tests in batch mode The one thing that remains to be done is to reintegrate the batch checkdoc check.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile104
1 files changed, 28 insertions, 76 deletions
diff --git a/Makefile b/Makefile
index 2cecebce..d49b39d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,83 +1,35 @@
-EMACS=emacs
-EMACS_BATCH=-batch
+EMACS = emacs
+EMACSFLAGS =
+CASK = cask
+VAGRANT = vagrant
-ERT_TARGET=-f ert-run-tests-batch-and-exit
-ERT_TARGET_NO_BACKTRACE=--eval \
- "(flet ((ert--print-backtrace (&rest args) \
- (insert \"no backtrace in batch mode\"))) \
- (ert-run-tests-batch-and-exit '(and \"$(TESTS)\" (not (tag :interactive)))))"
-NREPL_DEPS = stable
+OBJECTS = nrepl.elc
-CURL=curl --silent
-WGET=wget
-WORK_DIR=$(shell pwd)
-TRAVIS_FILE=.travis.yml
-TEST_DIR=test
-CLOJURE_MODE=clojure-mode.el
-CLOJURE_MODE_STABLE_URL=https://raw.github.com/clojure-emacs/clojure-mode/2.0.0/clojure-mode.el
-CLOJURE_MODE_LATEST_URL=https://raw.github.com/clojure-emacs/clojure-mode/master/clojure-mode.el
-CHECKDOC_BATCH=checkdoc_batch.el
-CHECKDOC_BATCH_URL=ftp://download.tuxfamily.org/user42/checkdoc-batch.el
+elpa:
+ $(CASK) install
+ $(CASK) update
+ touch $@
-.PHONY : build downloads-stable downloads-latest test-travis test default checkdoc latest no-backtrace dotest
+.PHONY: build
+build : elpa $(OBJECTS)
-default : test checkdoc
+.PHONY: test
+test : build
+ $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
+ $(EMACSFLAGS) \
+ -l test/run-tests
- : test checkdoc
-
-test : downloads-stable dotest
-
-test-no-backtrace : ERT_TARGET = $(ERT_TARGET_NO_BACKTRACE)
-test-no-backtrace : downloads-latest dotest
-
-test-latest : NREPL_DEPS = latest
-test-latest : downloads-latest dotest
-
-test-latest-no-backtrace : NREPL_DEPS = latest
-test-latest-no-backtrace : ERT_TARGET = $(ERT_TARGET_NO_BACKTRACE)
-test-latest-no-backtrace : downloads-latest dotest
-
-build :
- $(EMACS) $(EMACS_BATCH) --eval \
- "(progn \
- (setq byte-compile-error-on-warn t) \
- (batch-byte-compile))" *.el
-
-$(TEST_DIR)/lib/$(CHECKDOC_BATCH) :
- mkdir -p $(TEST_DIR)/lib
- $(WGET) -O $(TEST_DIR)/lib/$(CHECKDOC_BATCH) '$(CHECKDOC_BATCH_URL)'
-
-$(TEST_DIR)/stable/$(CLOJURE_MODE) :
- mkdir -p $(TEST_DIR)/stable
- $(CURL) '$(CLOJURE_MODE_STABLE_URL)' -o $(TEST_DIR)/stable/$(CLOJURE_MODE)
-
-$(TEST_DIR)/latest/$(CLOJURE_MODE) :
- mkdir -p $(TEST_DIR)/latest
- $(CURL) '$(CLOJURE_MODE_LATEST_URL)' -o $(TEST_DIR)/latest/$(CLOJURE_MODE)
-
-downloads : $(TEST_DIR)/lib/$(CHECKDOC_BATCH)
-
-downloads-stable : $(TEST_DIR)/stable/$(CLOJURE_MODE)
-
-downloads-latest : $(TEST_DIR)/latest/$(CLOJURE_MODE)
-
-test-travis :
- @if test -z "$$TRAVIS" && test -e $(TRAVIS_FILE); then travis-lint $(TRAVIS_FILE); fi
-
-checkdoc : downloads
- @cd $(TEST_DIR) && \
- ${EMACS} -batch -L .. -L lib -l $(CHECKDOC_BATCH) \
- -f checkdoc-batch-commandline ../nrepl.el \
- | grep -e 'nrepl.el:[1-9]' && exit 1 || exit 0
-
-dotest :
- cd $(TEST_DIR) && \
- (for test_lib in *-tests.el; do \
- $(EMACS) $(EMACS_BATCH) -L . -L .. -L $(NREPL_DEPS) -L lib \
- -l cl -l $(CLOJURE_MODE) -l $$test_lib $(ERT_TARGET) \
- || exit 1; \
- done)
+.PHONY: virtual-test
+virtual-test :
+ $(VAGRANT) up
+ $(VAGRANT) ssh -c "make -C /vagrant EMACS=$(EMACS) clean test"
+.PHONY: clean
clean :
- @rm -f *.elc */*.elc */*~ \
- $(TEST_DIR)/stable/* $(TEST_DIR)/latest/* $(TEST_DIR)/lib/*
+ rm -f $(OBJECTS)
+ rm -rf .cask # Clean packages installed for development
+
+%.elc : %.el
+ $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
+ $(EMACSFLAGS) \
+ -f batch-byte-compile $<