erlang.mk
erlang.mk copied to clipboard
cover-report fails if you have a module named 'coverage'
tbf, this is an issue with cover.erl
, where cover:analyse
is a bag of ambiguity. But I was wondering whether we could filter it out in erlang.mk
?
Somewhere around line 7093:
Report = [begin {ok, R} = cover:analyse(M, module), R end || M <- Ms],
could be:
Report = [begin {ok, R} = cover:analyse(M, module), R end || M <- Ms, M =/= coverage, M =/= calls],
...unless you've got a better suggestion?
lol
Fixing cover would be great, if possible. I don't mind adding this as a workaround otherwise but it needs a test case.
I've worked around it for now; I'll look at a test case later this week if I get a chance. Otherwise, file it under "lol", I guess. I've posted something to the mailing list about the ambiguity.
I feel your pain. Let's hope we'll get a good response from OTP team.
OTP didn't reply.
Removing the bad module names is OK but it should be done at Ms = cover:imported_modules(),
so that Ms
does not contain them at all. We probably should issue a warning when some modules have been removed.
A test case is needed.
Today's not the day though.
Low priority. For anyone else experiencing the problem, I exclude the entire app:
# top level Makefile
EXCLUDE_COVER_APPS_DIRS ?= $(APPS_DIR)/coverage
# in coverage-report.mk, included from top.mk
coverage-report:: $(if $(IS_APP),,apps-coverage-report)
ifneq ($(ALL_APPS_DIRS),)
COVER_REPORT_APPS_DIRS := $(filter-out $(EXCLUDE_COVER_APPS_DIRS),$(ALL_APPS_DIRS))
apps-coverage-report:
$(verbose) set -e; for app in $(COVER_REPORT_APPS_DIRS); do $(MAKE) -C $$app cover-report IS_APP=1; done
endif