triq.mk 836 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. ifneq ($(wildcard $(DEPS_DIR)/triq),)
  4. .PHONY: triq
  5. # Targets.
  6. tests:: triq
  7. define triq_run
  8. $(ERL) -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin \
  9. -eval "try $(1) of true -> halt(0); _ -> halt(1) catch error:undef -> io:format(\"Undefined property or module~n\"), halt() end."
  10. endef
  11. ifdef t
  12. ifeq (,$(findstring :,$(t)))
  13. triq: test-build
  14. @$(call triq_run,triq:check($(t)))
  15. else
  16. triq: test-build
  17. @echo Testing $(t)/0
  18. @$(call triq_run,triq:check($(t)()))
  19. endif
  20. else
  21. triq: test-build
  22. $(eval MODULES := $(shell find ebin -type f -name \*.beam \
  23. | sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//'))
  24. $(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
  25. endif
  26. endif