From 5b4ecae9463a7dbc0e2cf04c1c02f1130bd46229 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Mon, 19 Dec 2016 18:07:47 +0100 Subject: [PATCH] cover: do a cross package coverage Figured out the way to do it much more cheaply, only few % overhead over normal coverage. License: MIT Signed-off-by: Jakub Sztandera --- coverage/Rules.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coverage/Rules.mk b/coverage/Rules.mk index ab2ebfd3a..64bd0db6f 100644 --- a/coverage/Rules.mk +++ b/coverage/Rules.mk @@ -14,7 +14,9 @@ UCOVER_$(d) := $(addsuffix .coverprofile,$(addprefix $(d)/unitcover/, $(subst /, $(UCOVER_$(d)): $(d)/coverage_deps ALWAYS $(eval TMP_PKG := $(subst _,/,$(basename $(@F)))) - @go test $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverprofile=$@ $(TMP_PKG) + $(eval TMP_DEPS := $(shell go list -f '{{range .Deps}}{{.}} {{end}}' $(go-flags-with-tags) $(TMP_PKG) | sed 's/ /\n/g' | grep ipfs/go-ipfs | grep -v ipfs/go-ipfs/Godeps) $(TMP_PKG)) + $(eval TMP_DEPS_LIST := $(call join-with,$(comma),$(TMP_DEPS))) + go test $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverpkg=$(TMP_DEPS_LIST) -coverprofile=$@ $(TMP_PKG) $(d)/unit_tests.coverprofile: $(UCOVER_$(d))