aboutsummaryrefslogtreecommitdiffstats
path: root/erlang.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-01-10 21:22:50 +0100
committerLoïc Hoguin <[email protected]>2015-01-10 21:22:50 +0100
commit72a61573442c5a74818c9cdefb94f568250b534a (patch)
tree3321efa396494e4c90cab4eed88ea6ec7e18e419 /erlang.mk
parentb1ceed66810a962198585e3e8c49decec82d5cde (diff)
downloaderlang.mk-72a61573442c5a74818c9cdefb94f568250b534a.tar.gz
erlang.mk-72a61573442c5a74818c9cdefb94f568250b534a.tar.bz2
erlang.mk-72a61573442c5a74818c9cdefb94f568250b534a.zip
Add triq plugin
Diffstat (limited to 'erlang.mk')
-rw-r--r--erlang.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/erlang.mk b/erlang.mk
index 61f8ad5..b943618 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -1185,3 +1185,33 @@ build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
shell: build-shell-deps
$(gen_verbose) erl $(SHELL_PATH) $(SHELL_OPTS)
+
+# Copyright (c) 2015, Loïc Hoguin <[email protected]>
+# This file is part of erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: triq
+
+# Targets.
+
+tests:: triq
+
+define triq_run
+$(ERL) -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin \
+ -eval "try $(1) of true -> halt(0); _ -> halt(1) catch error:undef -> io:format(\"Undefined property or module~n\"), halt() end."
+endef
+
+ifdef t
+ifeq (,$(findstring :,$(t)))
+triq: test-build
+ @$(call triq_run,triq:check($(t)))
+else
+triq: test-build
+ @echo Testing $(t)/0
+ @$(call triq_run,triq:check($(t)()))
+endif
+else
+triq: test-build
+ $(eval MODULES := $(shell find ebin -type f -name \*.beam \
+ | sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//'))
+ $(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
+endif