aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorVegard Øye <vegard_oye@hotmail.com>2011-08-17 14:18:33 +0200
committerVegard Øye <vegard_oye@hotmail.com>2011-08-17 14:18:33 +0200
commitbf3c9ebf9e0e1144d81586c838bc47a5756fff64 (patch)
tree481cc3a2e05300058065a0445fa08c36bfe6afb8 /Makefile
parent3154834c8188c6b20b04d70a05247b8fb2174108 (diff)
Add PROFILER variable and "make profiler" rule
Let evil-tests.el instrument Evil for profiling. This is enabled with "make profiler", which runs all tests in the terminal and then displays profiling results, or with the PROFILER variable, which can be used with any rule and specifies how the results are sorted (by call count, average time or total time): make test PROFILER=call make test PROFILER=average make test PROFILER=total Using the PROFILER variable with the "make emacs" rule creates a results buffer with links to each function's source.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 12 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 35a52b4..661d04f 100644
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,12 @@ SHELL = /bin/bash
EMACS = emacs
FILES = $(filter-out evil-tests.el,$(filter-out evil-pkg.el,$(wildcard evil*.el)))
ELPAPKG = evil-`sed -n '3s/.*"\(.*\)".*/\1/p' evil-pkg.el`
+PROFILER =
TAG =
ELCFILES = $(FILES:.el=.elc)
-.PHONY: all compile compile-batch clean tests test emacs term terminal indent elpa version
+.PHONY: all compile compile-batch clean tests test emacs term terminal profiler indent elpa version
# Byte-compile Evil.
all: compile
@@ -41,30 +42,31 @@ clean:
# The TAG variable may specify a test tag or a test name:
# make test TAG=repeat
# This will only run tests pertaining to the repeat system.
-test: clean
+test:
$(EMACS) --batch -Q -L . -L lib -l evil-tests.el \
---eval "(evil-tests-run '(${TAG}))"
+--eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}))"
# Byte-compile Evil and run all tests.
tests: compile-batch
$(EMACS) --batch -Q -L . -L lib -l evil-tests.el \
---eval "(evil-tests-run '(${TAG}))"
+--eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}))"
rm -f *.elc
# Load Evil in a fresh instance of Emacs and run all tests.
emacs:
$(EMACS) -Q -L . -L lib -l evil-tests.el --eval "(evil-mode 1)" \
---eval "(if (y-or-n-p-with-timeout \"Run tests? \" 2 t) \
-(evil-tests-run '(${TAG}) t) \
-(message \"You can run the tests at any time with \`M-x evil-tests-run\'\"))" &
+--eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}) t)" &
# Load Evil in a terminal Emacs and run all tests.
term: terminal
terminal:
$(EMACS) -nw -Q -L . -L lib -l evil-tests.el --eval "(evil-mode 1)" \
---eval "(if (y-or-n-p-with-timeout \"Run tests? \" 2 t) \
-(evil-tests-run '(${TAG}) t) \
-(message \"You can run the tests at any time with \`M-x evil-tests-run\'\"))"
+--eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}) t)"
+
+# Run all tests with profiler.
+profiler:
+ $(EMACS) --batch -Q -L . -L lib -l evil-tests.el \
+--eval "(evil-tests-initialize '(${TAG}) (or '(${PROFILER}) t))"
# Re-indent all Evil code.
# Loads Evil into memory in order to indent macros properly.