Some progress with coverage
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Dec 6, 2016 at 18:21 UTC
2fc9cc547a471994f4cad0c20db8bddfdd3759f6
1 file changed
+12
-16
Makefile
+12
-16
@@ -15,14 +15,6 @@ export GOTFLAGS
15
16
GOFLAGS += -tags $(call join-with,$(comma),$(GOTAGS))
17
18
-ifneq ($(COVERALLS_TOKEN), )
19
- covertools_rule = covertools
20
- GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test,core/commands,cmd -- $(GOFLAGS) $(GOTFLAGS)
21
-else
22
- covertools_rule =
23
- GOT = go test $(GOFLAGS) $(GOTFLAGS) ./...
24
-endif
25
-
18
ifeq ($(TEST_NO_FUSE),1)
19
GOTAGS += nofuse
20
endif
@@ -76,10 +68,9 @@ path_check:
68
deps: go_check gx_check path_check $(covertools_rule)
69
${gx_bin} --verbose install --global >/dev/null 2>&1
70
79
-covertools:
80
- go get -u github.com/mattn/goveralls
71
+deps_covertools:
72
+ go get -u github.com/wadey/gocovmerge
73
go get -u golang.org/x/tools/cmd/cover
82
- go get -u github.com/Kubuxu/overalls
74
75
# saves/vendors third-party dependencies to Godeps/_workspace
76
# -r flag rewrites import paths to use the vendored path
@@ -119,14 +110,19 @@ test_3node:
110
test_go_fmt:
111
bin/test-go-fmt
112
122
-
113
test_go_short: GOTFLAGS += -test.short
114
test_go_race: GOTFLAGS += -race
115
test_go_expensive test_go_short test_go_race:
126
- $(GOT)
127
-ifneq ($(COVERALLS_TOKEN), )
128
- goveralls -coverprofile=overalls.coverprofile -service $(SERVICE)
129
-endif
116
+ go test $(GOFLAGS) $(GOTFLAGS) ./...
117
+
118
+coverage: deps_covertools
119
+ @echo Running coverage
120
+ $(eval PKGS := $(shell go list -f '{{if (len .GoFiles)}}{{.ImportPath}}{{end}}' ./... | grep -v /vendor/ | grep -v /Godeps/))
121
+#$(eval PKGS_DELIM := $(call join-with,$(comma),$(PKGS)))
122
+ @go list -f '{{if or (len .TestGoFiles) (len .XTestGoFiles)}}go test $(GOFLAGS) $(GOTFLAGS) -covermode=atomic -coverprofile={{.Name}}_{{len .Imports}}_{{len .Deps}}.coverprofile {{.ImportPath}}{{end}}' $(GOFLAGS) $(PKGS) | xargs -I {} bash -c {} 2>&1 | grep -v 'warning: no packages being tested depend on'
123
+ gocovmerge `ls *.coverprofile` > coverage.txt
124
+ rm *.coverprofile
125
+ bash -c 'bash <(curl -s https://codecov.io/bash)'
126
127
test_sharness_short:
128
$(MAKE) -j1 -C test/sharness/