From 6b06eee0e7a4e752de15972226b9a6f63d6378c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 24 Mar 2014 14:01:40 +0100 Subject: Add TEST_ERLC_OPTS option --- README.md | 5 +++++ erlang.mk | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bec67d9..88f6223 100644 --- a/README.md +++ b/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. diff --git a/erlang.mk b/erlang.mk index 093a269..7da0151 100644 --- a/erlang.mk +++ b/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 \ -- cgit v1.2.3