Browse Source

Add TEST_ERLC_OPTS option

Loïc Hoguin 11 years ago
parent
commit
6b06eee0e7
2 changed files with 11 additions and 3 deletions
  1. 5 0
      README.md
  2. 6 3
      erlang.mk

+ 5 - 0
README.md

@@ -180,6 +180,11 @@ the same folder as expected.
 documented in one place; follow the links to get to the options for
 the various operations of the documentation generation.
 
+`TEST_ERLC_OPTS` allows you to change the `erlc` compilation
+options that are used for building the project for testing, but
+also the tests themselves. Unlike `ERLC_OPTS` it doesn't consider
+warnings to be errors and does not warn when `export_all` is used.
+
 `CT_SUITES` is the list of common_test suites to run when you use
 the `make tests` command. If your suite module is named `ponies_SUITE`
 then you only need to put `ponies` in the list.

+ 6 - 3
erlang.mk

@@ -209,11 +209,14 @@ clean-docs:
 
 $(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep))))
 
+TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard
+TEST_ERLC_OPTS += -DTEST=1 -DEXTRA=1 +'{parse_transform, eunit_autoexport}'
+
 build-test-deps: $(ALL_TEST_DEPS_DIRS)
 	@for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
 
 build-tests: build-test-deps
-	$(gen_verbose) erlc -v $(ERLC_OPTS) -o test/ \
+	$(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o test/ \
 		$(wildcard test/*.erl test/*/*.erl) -pa ebin/
 
 CT_OPTS ?=
@@ -228,7 +231,7 @@ CT_RUN = ct_run \
 CT_SUITES ?=
 
 define test_target
-test_$(1): ERLC_OPTS += -DTEST=1 +'{parse_transform, eunit_autoexport}'
+test_$(1): ERLC_OPTS = $(TEST_ERLC_OPTS)
 test_$(1): clean deps app build-tests
 	@if [ -d "test" ] ; \
 	then \
@@ -240,7 +243,7 @@ endef
 
 $(foreach test,$(CT_SUITES),$(eval $(call test_target,$(test))))
 
-tests: ERLC_OPTS += -DTEST=1 +'{parse_transform, eunit_autoexport}'
+tests: ERLC_OPTS = $(TEST_ERLC_OPTS)
 tests: clean deps app build-tests
 	@if [ -d "test" ] ; \
 	then \