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 <kubuxu@protonmail.ch>
Jakub Sztandera committed
Dec 19, 2016 at 18:07 UTC
5b4ecae9463a7dbc0e2cf04c1c02f1130bd46229
1 file changed
+3
-1
coverage/Rules.mk
+3
-1
@@ -14,7 +14,9 @@ UCOVER_$(d) := $(addsuffix .coverprofile,$(addprefix $(d)/unitcover/, $(subst /,
14
15
$(UCOVER_$(d)): $(d)/coverage_deps ALWAYS
16
$(eval TMP_PKG := $(subst _,/,$(basename $(@F))))
17
- @go test $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverprofile=$@ $(TMP_PKG)
17
+ $(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))
18
+ $(eval TMP_DEPS_LIST := $(call join-with,$(comma),$(TMP_DEPS)))
19
+ go test $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverpkg=$(TMP_DEPS_LIST) -coverprofile=$@ $(TMP_PKG)
20
21
22
$(d)/unit_tests.coverprofile: $(UCOVER_$(d))