Makefile: use go-acc for coverage
This commit is contained in:
parent
cebc4d8dba
commit
e0cf99c53d
33
Makefile
33
Makefile
@ -4,11 +4,13 @@ ESCPKG := github.com\/lightningnetwork\/lnd
|
|||||||
BTCD_PKG := github.com/btcsuite/btcd
|
BTCD_PKG := github.com/btcsuite/btcd
|
||||||
GOVERALLS_PKG := github.com/mattn/goveralls
|
GOVERALLS_PKG := github.com/mattn/goveralls
|
||||||
LINT_PKG := gopkg.in/alecthomas/gometalinter.v2
|
LINT_PKG := gopkg.in/alecthomas/gometalinter.v2
|
||||||
|
GOACC_PKG := github.com/ory/go-acc
|
||||||
|
|
||||||
GO_BIN := ${GOPATH}/bin
|
GO_BIN := ${GOPATH}/bin
|
||||||
BTCD_BIN := $(GO_BIN)/btcd
|
BTCD_BIN := $(GO_BIN)/btcd
|
||||||
GOVERALLS_BIN := $(GO_BIN)/goveralls
|
GOVERALLS_BIN := $(GO_BIN)/goveralls
|
||||||
LINT_BIN := $(GO_BIN)/gometalinter.v2
|
LINT_BIN := $(GO_BIN)/gometalinter.v2
|
||||||
|
GOACC_BIN := $(GO_BIN)/go-acc
|
||||||
|
|
||||||
BTCD_DIR :=${GOPATH}/src/$(BTCD_PKG)
|
BTCD_DIR :=${GOPATH}/src/$(BTCD_PKG)
|
||||||
|
|
||||||
@ -21,6 +23,8 @@ BTCD_COMMIT := $(shell cat go.mod | \
|
|||||||
awk -F " " '{ print $$2 }' | \
|
awk -F " " '{ print $$2 }' | \
|
||||||
awk -F "/" '{ print $$1 }')
|
awk -F "/" '{ print $$1 }')
|
||||||
|
|
||||||
|
GOACC_COMMIT := ddc355013f90fea78d83d3a6c71f1d37ac07ecd5
|
||||||
|
|
||||||
GOBUILD := GO111MODULE=on go build -v
|
GOBUILD := GO111MODULE=on go build -v
|
||||||
GOINSTALL := GO111MODULE=on go install -v
|
GOINSTALL := GO111MODULE=on go install -v
|
||||||
GOTEST := GO111MODULE=on go test -v
|
GOTEST := GO111MODULE=on go test -v
|
||||||
@ -39,23 +43,6 @@ include make/testing_flags.mk
|
|||||||
|
|
||||||
DEV_TAGS := $(if ${tags},$(DEV_TAGS) ${tags},$(DEV_TAGS))
|
DEV_TAGS := $(if ${tags},$(DEV_TAGS) ${tags},$(DEV_TAGS))
|
||||||
|
|
||||||
COVER = for dir in $(GOLISTCOVER); do \
|
|
||||||
$(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" \
|
|
||||||
-covermode=count \
|
|
||||||
-coverprofile=$$dir/profile.tmp $$dir; \
|
|
||||||
\
|
|
||||||
if [ $$? != 0 ] ; \
|
|
||||||
then \
|
|
||||||
exit 1; \
|
|
||||||
fi ; \
|
|
||||||
\
|
|
||||||
if [ -f $$dir/profile.tmp ]; then \
|
|
||||||
cat $$dir/profile.tmp | \
|
|
||||||
tail -n +2 >> profile.cov; \
|
|
||||||
$(RM) $$dir/profile.tmp; \
|
|
||||||
fi \
|
|
||||||
done
|
|
||||||
|
|
||||||
LINT = $(LINT_BIN) \
|
LINT = $(LINT_BIN) \
|
||||||
--disable-all \
|
--disable-all \
|
||||||
--enable=gofmt \
|
--enable=gofmt \
|
||||||
@ -88,6 +75,11 @@ $(LINT_BIN):
|
|||||||
@$(call print, "Fetching gometalinter.v2")
|
@$(call print, "Fetching gometalinter.v2")
|
||||||
GO111MODULE=off go get -u $(LINT_PKG)
|
GO111MODULE=off go get -u $(LINT_PKG)
|
||||||
|
|
||||||
|
$(GOACC_BIN):
|
||||||
|
@$(call print, "Fetching go-acc")
|
||||||
|
go get -u -v $(GOACC_PKG)@$(GOACC_COMMIT)
|
||||||
|
$(GOINSTALL) $(GOACC_PKG)
|
||||||
|
|
||||||
btcd:
|
btcd:
|
||||||
@$(call print, "Installing btcd.")
|
@$(call print, "Installing btcd.")
|
||||||
GO111MODULE=on go get -v github.com/btcsuite/btcd/@$(BTCD_COMMIT)
|
GO111MODULE=on go get -v github.com/btcsuite/btcd/@$(BTCD_COMMIT)
|
||||||
@ -130,10 +122,9 @@ unit: btcd
|
|||||||
@$(call print, "Running unit tests.")
|
@$(call print, "Running unit tests.")
|
||||||
$(UNIT)
|
$(UNIT)
|
||||||
|
|
||||||
unit-cover:
|
unit-cover: $(GOACC_BIN)
|
||||||
@$(call print, "Running unit coverage tests.")
|
@$(call print, "Running unit coverage tests.")
|
||||||
echo "mode: count" > profile.cov
|
$(GOACC_BIN) $$(go list ./... | grep -v lnrpc) -- -test.tags="$(DEV_TAGS) $(LOG_TAGS)"
|
||||||
$(COVER)
|
|
||||||
|
|
||||||
unit-race:
|
unit-race:
|
||||||
@$(call print, "Running unit race tests.")
|
@$(call print, "Running unit race tests.")
|
||||||
@ -141,7 +132,7 @@ unit-race:
|
|||||||
|
|
||||||
goveralls: $(GOVERALLS_BIN)
|
goveralls: $(GOVERALLS_BIN)
|
||||||
@$(call print, "Sending coverage report.")
|
@$(call print, "Sending coverage report.")
|
||||||
$(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci
|
$(GOVERALLS_BIN) -coverprofile=coverage.txt -service=travis-ci
|
||||||
|
|
||||||
travis-race: btcd unit-race
|
travis-race: btcd unit-race
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user