mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge pull request #635 from codysoyland/makefile-coverage
Add coverage tools to Makefile
This commit is contained in:
commit
7f17b3791d
1 changed files with 19 additions and 2 deletions
21
Makefile
21
Makefile
|
|
@ -1,4 +1,4 @@
|
|||
.PHONY: glide vendor-update docker pilosa crossbuild install generate statik release test
|
||||
.PHONY: glide vendor-update docker pilosa crossbuild install generate statik release test cover cover-pkg cover-viz
|
||||
|
||||
GLIDE := $(shell command -v glide 2>/dev/null)
|
||||
STATIK := $(shell command -v statik 2>/dev/null)
|
||||
|
|
@ -6,6 +6,7 @@ PROTOC := $(shell command -v protoc 2>/dev/null)
|
|||
VERSION := $(shell git describe --tags 2> /dev/null || echo unknown)
|
||||
IDENTIFIER := $(VERSION)-$(GOOS)-$(GOARCH)
|
||||
CLONE_URL=github.com/pilosa/pilosa
|
||||
PKGS := $(shell cd $(GOPATH)/src/$(CLONE_URL); go list ./... | grep -v vendor)
|
||||
BUILD_TIME=`date -u +%FT%T%z`
|
||||
LDFLAGS="-X github.com/pilosa/pilosa.Version=$(VERSION) -X github.com/pilosa/pilosa.BuildTime=$(BUILD_TIME)"
|
||||
|
||||
|
|
@ -34,7 +35,23 @@ glide.lock: glide glide.yaml
|
|||
vendor-update: glide.lock
|
||||
|
||||
test: vendor
|
||||
go test $(shell cd $(GOPATH)/src/$(CLONE_URL); go list ./... | grep -v vendor) $(TESTFLAGS)
|
||||
go test $(PKGS) $(TESTFLAGS)
|
||||
|
||||
cover: vendor
|
||||
mkdir -p build/coverage
|
||||
echo "mode: set" > build/coverage/all.out
|
||||
for pkg in $(PKGS) ; do \
|
||||
make cover-pkg PKG=$$pkg ; \
|
||||
done
|
||||
|
||||
cover-pkg:
|
||||
mkdir -p build/coverage
|
||||
touch build/coverage/$(subst /,-,$(PKG)).out
|
||||
go test -coverprofile=build/coverage/$(subst /,-,$(PKG)).out $(PKG)
|
||||
tail +2 build/coverage/$(subst /,-,$(PKG)).out >> build/coverage/all.out
|
||||
|
||||
cover-viz: cover
|
||||
go tool cover -html=build/coverage/all.out
|
||||
|
||||
pilosa: vendor
|
||||
go build -ldflags $(LDFLAGS) $(FLAGS) $(CLONE_URL)/cmd/pilosa
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue