aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eunit.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-09 16:32:32 +0300
committerLoïc Hoguin <[email protected]>2015-05-09 16:32:49 +0300
commit7d28bd8d9eb449c360eb9582e282bd4756f76be9 (patch)
tree97791a7cc0319328bf33db2c46abeaa9e831354a /plugins/eunit.mk
parentafff9a6d94964f7733badd7e1a9fb404ab8b09a8 (diff)
parent8f39bed18723b0b60b17ea1aeecde4c6c371e3f0 (diff)
downloaderlang.mk-7d28bd8d9eb449c360eb9582e282bd4756f76be9.tar.gz
erlang.mk-7d28bd8d9eb449c360eb9582e282bd4756f76be9.tar.bz2
erlang.mk-7d28bd8d9eb449c360eb9582e282bd4756f76be9.zip
Merge branch 'cover' of https://github.com/zuiderkwast/erlang.mk
Rebased and moved ct.cover.spec into the test/ directory.
Diffstat (limited to 'plugins/eunit.mk')
-rw-r--r--plugins/eunit.mk21
1 files changed, 12 insertions, 9 deletions
diff --git a/plugins/eunit.mk b/plugins/eunit.mk
index ec3228e..b9f2856 100644
--- a/plugins/eunit.mk
+++ b/plugins/eunit.mk
@@ -6,22 +6,19 @@
# Configuration
+# All modules in TEST_DIR
ifeq ($(strip $(TEST_DIR)),)
-TAGGED_EUNIT_TESTS = {dir,"ebin"}
-else
-ifeq ($(wildcard $(TEST_DIR)),)
-TAGGED_EUNIT_TESTS = {dir,"ebin"}
+TEST_DIR_MODS =
else
-# All modules in TEST_DIR
TEST_DIR_MODS = $(notdir $(basename $(shell find $(TEST_DIR) -type f -name *.beam)))
+endif
+
# All modules in 'ebin'
EUNIT_EBIN_MODS = $(notdir $(basename $(shell find ebin -type f -name *.beam)))
# Only those modules in TEST_DIR with no matching module in 'ebin'.
# This is done to avoid some tests being executed twice.
EUNIT_MODS = $(filter-out $(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(TEST_DIR_MODS))
-TAGGED_EUNIT_TESTS = {dir,"ebin"} $(foreach mod,$(EUNIT_MODS),$(shell echo $(mod) | sed -e 's/\(.*\)/{module,\1}/g'))
-endif
-endif
+TAGGED_EUNIT_TESTS = $(foreach mod,$(EUNIT_EBIN_MODS) $(EUNIT_MODS),{module,$(mod)})
EUNIT_OPTS ?=
@@ -42,10 +39,16 @@ help::
# Plugin-specific targets.
+EUNIT_RUN_BEFORE ?=
+EUNIT_RUN_AFTER ?=
EUNIT_RUN = $(ERL) \
-pa $(TEST_DIR) $(DEPS_DIR)/*/ebin \
-pz ebin \
- -eval 'case eunit:test([$(call str-join,$(TAGGED_EUNIT_TESTS))], [$(EUNIT_OPTS)]) of ok -> halt(0); error -> halt(1) end.'
+ $(EUNIT_RUN_BEFORE) \
+ -eval 'case eunit:test([$(call str-join,$(TAGGED_EUNIT_TESTS))],\
+ [$(EUNIT_OPTS)]) of ok -> ok; error -> halt(1) end.' \
+ $(EUNIT_RUN_AFTER) \
+ -eval 'halt(0).'
eunit: test-build
$(gen_verbose) $(EUNIT_RUN)