-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins.mk
More file actions
58 lines (46 loc) · 1.49 KB
/
Copy pathplugins.mk
File metadata and controls
58 lines (46 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
COVERL_DIR ?= $(CURDIR)
COVERL_EUNIT_DATA ?= $(COVERL_DIR)/ct.coverl.data
COVERL_CT_DATA ?= $(COVERL_DIR)/eunit.coverl.data
COVERL_REPORT ?= $(COVERL_DIR)/lcov.info
help::
$(verbose) printf "%s\n" "" \
"Coverl:" \
"If COVERL=1 is set, coverage data is collected by the targets eunit and ct."
ifdef COVERL
define eunit.erl
{ok, _} = application:ensure_all_started(coverl),
case [{Module, Error}
|| {Module, Error} <- coverl:compile_beam_directory("ebin"),
Error =/= ok]
of [] -> ok
; Error ->
io:format("coverl_compile:~n~p~n", [Error]),
halt(1)
end,
case eunit:test($1, [$(EUNIT_OPTS)])
of ok -> ok
; error -> halt(2)
end,
coverl:export("$(COVERL_DIR)/eunit.coverl.data"),
halt()
endef
CT_OPTS += -ct_hooks coverl_ct_hook \
'[{cover, {application, $(PROJECT)}}, {export,"$(abspath $(COVERL_DIR)/ct.coverl.data)"}]'
endif
COVERL_ERL_OPTS += -pa $(DEPS_DIR)/*/ebin $(APPS_DIR)/*/ebin $(CURDIR)/ebin
define coverl_report.erl
{ok, _} = application:ensure_all_started(coverl),
ok = coverl:import("$(COVERL_EUNIT_DATA)"),
ok = coverl:import("$(COVERL_CT_DATA)"),
ok = coverl:report(#{out => "$(COVERL_REPORT)"}),
halt()
endef
.PHONY: coverl_data-distclean coverl_report-clean coverl_dir-distclean
coverl-report:
$(gen_verbose) $(call erlang,$(coverl_report.erl),$(COVERL_ERL_OPTS))
clean:: coverl_report-clean
coverl_report-clean:
$(gen_verbose) rm -f $(COVERL_REPORT)
distclean:: coverl_data-distclean
coverl_data-distclean:
$(gen_verbose) rm -f $(COVERL_EUNIT_DATA) $(COVERL_CT_DATA)