|
@@ -8,6 +8,7 @@ COVER_DATA_DIR ?= $(COVER_REPORT_DIR)
|
|
ifdef COVER
|
|
ifdef COVER
|
|
COVER_APPS ?= $(notdir $(ALL_APPS_DIRS))
|
|
COVER_APPS ?= $(notdir $(ALL_APPS_DIRS))
|
|
COVER_DEPS ?=
|
|
COVER_DEPS ?=
|
|
|
|
+COVER_EXCLUDE_MODS ?=
|
|
endif
|
|
endif
|
|
|
|
|
|
# Code coverage for Common Test.
|
|
# Code coverage for Common Test.
|
|
@@ -23,7 +24,8 @@ $(TEST_DIR)/ct.cover.spec: cover-data-dir
|
|
"{incl_dirs, '$(PROJECT)', [\"$(call core_native_path,$(CURDIR)/ebin)\" \
|
|
"{incl_dirs, '$(PROJECT)', [\"$(call core_native_path,$(CURDIR)/ebin)\" \
|
|
$(foreach a,$(COVER_APPS),$(comma) \"$(call core_native_path,$(APPS_DIR)/$a/ebin)\") \
|
|
$(foreach a,$(COVER_APPS),$(comma) \"$(call core_native_path,$(APPS_DIR)/$a/ebin)\") \
|
|
$(foreach d,$(COVER_DEPS),$(comma) \"$(call core_native_path,$(DEPS_DIR)/$d/ebin)\")]}." \
|
|
$(foreach d,$(COVER_DEPS),$(comma) \"$(call core_native_path,$(DEPS_DIR)/$d/ebin)\")]}." \
|
|
- '{export,"$(call core_native_path,$(abspath $(COVER_DATA_DIR))/ct.coverdata)"}.' > $@
|
|
|
|
|
|
+ '{export,"$(call core_native_path,$(abspath $(COVER_DATA_DIR))/ct.coverdata)"}.' \
|
|
|
|
+ "{excl_mods, '$(PROJECT)', [$(call comma_list,$(COVER_EXCLUDE_MODS))]}." > $@
|
|
|
|
|
|
CT_RUN += -cover $(TEST_DIR)/ct.cover.spec
|
|
CT_RUN += -cover $(TEST_DIR)/ct.cover.spec
|
|
endif
|
|
endif
|
|
@@ -38,14 +40,18 @@ define cover.erl
|
|
Dirs = ["$(call core_native_path,$(CURDIR)/ebin)"
|
|
Dirs = ["$(call core_native_path,$(CURDIR)/ebin)"
|
|
$(foreach a,$(COVER_APPS),$(comma) "$(call core_native_path,$(APPS_DIR)/$a/ebin)")
|
|
$(foreach a,$(COVER_APPS),$(comma) "$(call core_native_path,$(APPS_DIR)/$a/ebin)")
|
|
$(foreach d,$(COVER_DEPS),$(comma) "$(call core_native_path,$(DEPS_DIR)/$d/ebin)")],
|
|
$(foreach d,$(COVER_DEPS),$(comma) "$(call core_native_path,$(DEPS_DIR)/$d/ebin)")],
|
|
- [begin
|
|
|
|
- case filelib:is_dir(Dir) of
|
|
|
|
- false -> false;
|
|
|
|
- true ->
|
|
|
|
- case cover:compile_beam_directory(Dir) of
|
|
|
|
- {error, _} -> halt(1);
|
|
|
|
- _ -> true
|
|
|
|
- end
|
|
|
|
|
|
+ Excludes = [$(call comma_list,$(foreach e,$(COVER_EXCLUDE_MODS),"$e"))],
|
|
|
|
+ [case file:list_dir(Dir) of
|
|
|
|
+ {error, enotdir} -> false;
|
|
|
|
+ {error, _} -> halt(2);
|
|
|
|
+ {ok, Files} ->
|
|
|
|
+ BeamFiles = [filename:join(Dir, File) ||
|
|
|
|
+ File <- Files,
|
|
|
|
+ not lists:member(filename:basename(File, ".beam"), Excludes),
|
|
|
|
+ filename:extension(File) =:= ".beam"],
|
|
|
|
+ case cover:compile_beam(BeamFiles) of
|
|
|
|
+ {error, _} -> halt(1);
|
|
|
|
+ _ -> true
|
|
end
|
|
end
|
|
end || Dir <- Dirs]
|
|
end || Dir <- Dirs]
|
|
end,
|
|
end,
|