فهرست منبع

chore(test): enable cover only when necessary

So that ad-hoc ./rebar3 eunit and ct can run faster
Zaiming Shi 5 سال پیش
والد
کامیت
5f064a8e42
3فایلهای تغییر یافته به همراه14 افزوده شده و 7 حذف شده
  1. 5 5
      Makefile
  2. 0 1
      rebar.config
  3. 9 1
      rebar.config.erl

+ 5 - 5
Makefile

@@ -33,23 +33,23 @@ get-dashboard:
 
 
 .PHONY: eunit
 .PHONY: eunit
 eunit: $(REBAR)
 eunit: $(REBAR)
-	@$(REBAR) eunit -v -c
+	@ENABLE_COVER_COMPILE=1 $(REBAR) eunit -v -c
 
 
 .PHONY: proper
 .PHONY: proper
 proper: $(REBAR)
 proper: $(REBAR)
-	@$(REBAR) as test proper -d test/props -c
+	@ENABLE_COVER_COMPILE=1 $(REBAR) as test proper -d test/props -c
 
 
 .PHONY: ct
 .PHONY: ct
 ct: $(REBAR)
 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
 .PHONY: cover
 cover: $(REBAR)
 cover: $(REBAR)
-	@$(REBAR) cover
+	@ENABLE_COVER_COMPILE=1 $(REBAR) cover
 
 
 .PHONY: coveralls
 .PHONY: coveralls
 coveralls: $(REBAR)
 coveralls: $(REBAR)
-	@$(REBAR) as test coveralls send
+	@ENABLE_COVER_COMPILE=1 $(REBAR) as test coveralls send
 
 
 .PHONY: $(REL_PROFILES)
 .PHONY: $(REL_PROFILES)
 $(REL_PROFILES:%=%): $(REBAR) get-dashboard
 $(REL_PROFILES:%=%): $(REBAR) get-dashboard

+ 0 - 1
rebar.config

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

+ 9 - 1
rebar.config.erl

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