chore(test): enable cover only when necessary

So that ad-hoc ./rebar3 eunit and ct can run faster
This commit is contained in:
Zaiming Shi 2021-03-11 17:28:52 +01:00
parent 173a4d8fea
commit 5f064a8e42
3 changed files with 14 additions and 7 deletions

View File

@ -33,23 +33,23 @@ get-dashboard:
.PHONY: eunit
eunit: $(REBAR)
@$(REBAR) eunit -v -c
@ENABLE_COVER_COMPILE=1 $(REBAR) eunit -v -c
.PHONY: proper
proper: $(REBAR)
@$(REBAR) as test proper -d test/props -c
@ENABLE_COVER_COMPILE=1 $(REBAR) as test proper -d test/props -c
.PHONY: ct
ct: $(REBAR)
@$(REBAR) ct --name 'test@127.0.0.1' -c -v
@ENABLE_COVER_COMPILE=1 $(REBAR) ct --name 'test@127.0.0.1' -c -v
.PHONY: cover
cover: $(REBAR)
@$(REBAR) cover
@ENABLE_COVER_COMPILE=1 $(REBAR) cover
.PHONY: coveralls
coveralls: $(REBAR)
@$(REBAR) as test coveralls send
@ENABLE_COVER_COMPILE=1 $(REBAR) as test coveralls send
.PHONY: $(REL_PROFILES)
$(REL_PROFILES:%=%): $(REBAR) get-dashboard

View File

@ -24,7 +24,6 @@
]
}.
{cover_enabled, true}.
{cover_opts, [verbose]}.
{cover_export_enabled, true}.
{cover_excl_mods, [emqx_exproto_pb, emqx_exhook_pb]}.

View File

@ -50,11 +50,19 @@ community_plugin_overrides() ->
[{add, App, [ {erl_opts, [{i, "include"}]}]} || App <- relx_plugin_apps_extra()].
config() ->
[ {plugins, plugins()}
[ {cover_enabled, is_cover_enabled()}
, {plugins, plugins()}
, {profiles, profiles()}
, {project_app_dirs, project_app_dirs()}
].
is_cover_enabled() ->
case os:getenv("ENABLE_COVER_COMPILE") of
"1"-> true;
"true" -> true;
_ -> false
end.
is_enterprise() ->
filelib:is_regular("EMQX_ENTERPRISE").