@@ -25,6 +25,7 @@ GIT_REVISION = $(strip $(shell git rev-parse HEAD 2> /dev/null ))
2525GIT_TAG = $(strip $(shell head="$(call GIT_REVISION) "; git tag --points-at $$head 2> /dev/null | grep -v latest | tail -1) )
2626SOURCE_DATE_EPOCH_PATH = lib/elixir/tmp/ebin_reproducible
2727SOURCE_DATE_EPOCH_FILE = $(SOURCE_DATE_EPOCH_PATH ) /SOURCE_DATE_EPOCH
28+ ROOT_DIR: =$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
2829
2930.PHONY : install install_man build_plt clean_plt dialyze test check_reproducible clean clean_elixir clean_man format docs Docs.zip Precompiled.zip zips
3031.NOTPARALLEL :
@@ -53,6 +54,11 @@ lib/$(1)/ebin/Elixir.$(2).beam: $(wildcard lib/$(1)/lib/*.ex) $(wildcard lib/$(1
5354test_$(1 ) : test_formatted $(1 )
5455 @ echo "==> $(1 ) (ex_unit)"
5556 $(Q ) cd lib/$(1 ) && ../../bin/elixir -r "test/test_helper.exs" -pr "test/**/$(TEST_FILES ) ";
57+
58+ cover/ex_unit_$(1 ) .coverdata:
59+ $(Q ) mkdir -p "$(ROOT_DIR ) /cover"
60+ $(Q ) COVER_FILE="$(ROOT_DIR ) /cover/ex_unit_$(1 ) .coverdata" $(MAKE ) test_$(1 )
61+ cover/combined.coverdata: cover/ex_unit_$(1 ) .coverdata
5662endef
5763
5864define WRITE_SOURCE_DATE_EPOCH
@@ -175,6 +181,7 @@ clean: clean_man
175181 rm -rf lib/mix/test/fixtures/git_sparse_repo/
176182 rm -rf lib/mix/test/fixtures/archive/ebin/
177183 rm -f erl_crash.dump
184+ rm -rf cover/*
178185
179186clean_elixir :
180187 $(Q ) rm -f lib/* /ebin/Elixir.* .beam
@@ -287,6 +294,17 @@ test_stdlib: compile
287294 cd lib/elixir && ../../bin/elixir --sname primary -r " test/elixir/test_helper.exs" -pr " test/elixir/**/$( TEST_FILES) " ; \
288295 fi
289296
297+ cover/ex_unit_stdlib.coverdata :
298+ $(Q ) mkdir -p " $( ROOT_DIR) /cover"
299+ $(Q ) COVER_FILE=" $( ROOT_DIR) /cover/ex_unit_stdlib.coverdata" $(MAKE ) test_stdlib
300+ cover/combined.coverdata : cover/ex_unit_stdlib.coverdata
301+
302+ cover/combined.coverdata :
303+ $(Q ) bin/elixir ./lib/elixir/scripts/cover.exs
304+
305+ .PHONY : cover
306+ cover : cover/combined.coverdata
307+
290308# ==> Dialyzer tasks
291309
292310DIALYZER_OPTS = --no_check_plt --fullpath -Werror_handling -Wunmatched_returns -Wunderspecs
0 commit comments