/ coverage / Rules.mk
Rules.mk
 1  include mk/header.mk
 2  
 3  GOCC ?= go
 4  
 5  $(d)/coverage_deps: $$(DEPS_GO) cmd/ipfs/ipfs
 6  	rm -rf $(@D)/sharnesscover && mkdir $(@D)/sharnesscover
 7  
 8  .PHONY: $(d)/coverage_deps
 9  
10  # unit tests coverage is now produced by test_unit target in mk/golang.mk
11  # (outputs coverage/unit_tests.coverprofile and test/unit/gotest.json)
12  
13  TGTS_$(d) :=
14  
15  # sharness tests coverage
16  $(d)/ipfs: GOTAGS += testrunmain
17  $(d)/ipfs: $(d)/main
18  	$(go-build-relative)
19  
20  CLEAN += $(d)/ipfs
21  
22  ifneq ($(filter coverage%,$(MAKECMDGOALS)),)
23  	# this is quite hacky but it is best way I could figure out
24  	DEPS_test/sharness += cmd/ipfs/ipfs-test-cover $(d)/coverage_deps $(d)/ipfs
25  endif
26  
27  export IPFS_COVER_DIR:= $(realpath $(d))/sharnesscover/
28  
29  $(d)/sharness_tests.coverprofile: export TEST_PLUGIN=0
30  $(d)/sharness_tests.coverprofile: $(d)/ipfs cmd/ipfs/ipfs-test-cover $(d)/coverage_deps test/bin/gocovmerge test_sharness
31  	(cd $(@D)/sharnesscover && find . -type f | gocovmerge -list -) > $@
32  
33  
34  PATH := $(realpath $(d)):$(PATH)
35  
36  TGTS_$(d) += $(d)/sharness_tests.coverprofile
37  
38  CLEAN += $(TGTS_$(d))
39  COVERAGE += $(TGTS_$(d))
40  
41  include mk/footer.mk