plugin_triq.mk 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Triq plugin.
  2. TRIQ_CASES = test-dir
  3. TRIQ_TARGETS = $(addprefix triq-,$(TRIQ_CASES))
  4. .PHONY: triq $(TRIQ_TARGETS)
  5. triq: $(TRIQ_TARGETS)
  6. triq-test-dir: build clean
  7. $i "Bootstrap a new OTP application named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  11. $i "Add Triq to the list of dependencies"
  12. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = triq\n"}' $(APP)/Makefile
  13. $i "Generate a module containing Triq properties"
  14. $t printf "%s\n" \
  15. "-module($(APP))." \
  16. "-ifdef(TEST)." \
  17. "-include_lib(\"triq/include/triq.hrl\")." \
  18. "prop_foo() -> ?FORALL(_, any(), true)." \
  19. "-endif." > $(APP)/src/$(APP).erl
  20. $i "Generate a module containing Triq properties in TEST_DIR"
  21. $t mkdir $(APP)/test
  22. $t printf "%s\n" \
  23. "-module($(APP)_tests)." \
  24. "-include_lib(\"triq/include/triq.hrl\")." \
  25. "prop_bar() -> ?FORALL(_, any(), true)." > $(APP)/test/$(APP)_tests.erl
  26. $i "Run the Triq plugin"
  27. $t $(MAKE) -C $(APP) triq > $(APP)/triq.log
  28. $i "Check that both properties were checked"
  29. $t grep -q prop_foo $(APP)/triq.log
  30. $t grep -q prop_bar $(APP)/triq.log