concuerror.mk 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright (c) 2020, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. ifdef CONCUERROR_TESTS
  4. .PHONY: concuerror distclean-concuerror
  5. # Configuration
  6. CONCUERROR_LOGS_DIR ?= $(CURDIR)/logs
  7. CONCUERROR_OPTS ?=
  8. # Core targets.
  9. check:: concuerror
  10. ifndef KEEP_LOGS
  11. distclean:: distclean-concuerror
  12. endif
  13. # Plugin-specific targets.
  14. $(ERLANG_MK_TMP)/Concuerror/bin/concuerror: | $(ERLANG_MK_TMP)
  15. $(verbose) git clone https://github.com/parapluu/Concuerror $(ERLANG_MK_TMP)/Concuerror
  16. $(verbose) $(MAKE) -C $(ERLANG_MK_TMP)/Concuerror
  17. $(CONCUERROR_LOGS_DIR):
  18. $(verbose) mkdir -p $(CONCUERROR_LOGS_DIR)
  19. define concuerror_html_report
  20. <!DOCTYPE html>
  21. <html lang="en">
  22. <head>
  23. <meta charset="utf-8">
  24. <title>Concuerror HTML report</title>
  25. </head>
  26. <body>
  27. <h1>Concuerror HTML report</h1>
  28. <p>Generated on $(concuerror_date)</p>
  29. <ul>
  30. $(foreach t,$(concuerror_targets),<li><a href="$(t).txt">$(t)</a></li>)
  31. </ul>
  32. </body>
  33. </html>
  34. endef
  35. concuerror: $(addprefix concuerror-,$(subst :,-,$(CONCUERROR_TESTS)))
  36. $(eval concuerror_date := $(shell date))
  37. $(eval concuerror_targets := $^)
  38. $(verbose) $(call core_render,concuerror_html_report,$(CONCUERROR_LOGS_DIR)/concuerror.html)
  39. define concuerror_target
  40. .PHONY: concuerror-$1-$2
  41. concuerror-$1-$2: test-build | $(ERLANG_MK_TMP)/Concuerror/bin/concuerror $(CONCUERROR_LOGS_DIR)
  42. $(ERLANG_MK_TMP)/Concuerror/bin/concuerror \
  43. --pa $(CURDIR)/ebin --pa $(TEST_DIR) \
  44. -o $(CONCUERROR_LOGS_DIR)/concuerror-$1-$2.txt \
  45. $$(CONCUERROR_OPTS) -m $1 -t $2
  46. endef
  47. $(foreach test,$(CONCUERROR_TESTS),$(eval $(call concuerror_target,$(firstword $(subst :, ,$(test))),$(lastword $(subst :, ,$(test))))))
  48. distclean-concuerror:
  49. $(gen_verbose) rm -rf $(CONCUERROR_LOGS_DIR)
  50. endif