Merge pull request #421 from AkihiroSuda/testflags
Makefile: new variable: TESTFLAGS
This commit is contained in:
commit
2c11108748
1 changed files with 10 additions and 7 deletions
17
Makefile
17
Makefile
|
@ -22,6 +22,9 @@ BINARIES=$(addprefix bin/,$(COMMANDS))
|
||||||
# time.
|
# time.
|
||||||
GO_LDFLAGS=-ldflags "-X `go list`.Version=$(VERSION)"
|
GO_LDFLAGS=-ldflags "-X `go list`.Version=$(VERSION)"
|
||||||
|
|
||||||
|
# Flags passed to `go test`
|
||||||
|
TESTFLAGS ?=-parallel 8 -race
|
||||||
|
|
||||||
.PHONY: clean all AUTHORS fmt vet lint build binaries test integration setup generate checkprotos coverage ci check help install uninstall vendor
|
.PHONY: clean all AUTHORS fmt vet lint build binaries test integration setup generate checkprotos coverage ci check help install uninstall vendor
|
||||||
.DEFAULT: default
|
.DEFAULT: default
|
||||||
|
|
||||||
|
@ -82,15 +85,15 @@ ineffassign: ## run ineffassign
|
||||||
|
|
||||||
build: ## build the go packages
|
build: ## build the go packages
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
@go build -i -tags "${DOCKER_BUILDTAGS}" -v ${GO_LDFLAGS} ${GO_GCFLAGS} ${PACKAGES}
|
@go build -i -v ${GO_LDFLAGS} ${GO_GCFLAGS} ${PACKAGES}
|
||||||
|
|
||||||
test: ## run tests, except integration tests
|
test: ## run tests, except integration tests
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
@go test -parallel 8 -race -tags "${DOCKER_BUILDTAGS}" $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
|
@go test ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
|
||||||
|
|
||||||
integration: ## run integration tests
|
integration: ## run integration tests
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
@go test -parallel 8 -race -tags "${DOCKER_BUILDTAGS}" ${INTEGRATION_PACKAGE}
|
@go test ${TESTFLAGS} ${INTEGRATION_PACKAGE}
|
||||||
|
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
|
@ -99,7 +102,7 @@ bin/%: cmd/% FORCE
|
||||||
@test $$(go list) = "${PROJECT_ROOT}" || \
|
@test $$(go list) = "${PROJECT_ROOT}" || \
|
||||||
(echo "👹 Please correctly set up your Go build environment. This project must be located at <GOPATH>/src/${PROJECT_ROOT}" && false)
|
(echo "👹 Please correctly set up your Go build environment. This project must be located at <GOPATH>/src/${PROJECT_ROOT}" && false)
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
@go build -i -tags "${DOCKER_BUILDTAGS}" -o $@ ${GO_LDFLAGS} ${GO_GCFLAGS} ./$<
|
@go build -i -o $@ ${GO_LDFLAGS} ${GO_GCFLAGS} ./$<
|
||||||
|
|
||||||
binaries: $(BINARIES) ## build binaries
|
binaries: $(BINARIES) ## build binaries
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
|
@ -120,13 +123,13 @@ uninstall:
|
||||||
coverage: ## generate coverprofiles from the unit tests
|
coverage: ## generate coverprofiles from the unit tests
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
@( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}); do \
|
@( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}); do \
|
||||||
go test -i -race -tags "${DOCKER_BUILDTAGS}" -test.short -coverprofile="../../../$$pkg/coverage.txt" -covermode=atomic $$pkg || exit; \
|
go test -i ${TESTFLAGS} -test.short -coverprofile="../../../$$pkg/coverage.txt" -covermode=atomic $$pkg || exit; \
|
||||||
go test -race -tags "${DOCKER_BUILDTAGS}" -test.short -coverprofile="../../../$$pkg/coverage.txt" -covermode=atomic $$pkg || exit; \
|
go test ${TESTFLAGS} -test.short -coverprofile="../../../$$pkg/coverage.txt" -covermode=atomic $$pkg || exit; \
|
||||||
done )
|
done )
|
||||||
|
|
||||||
coverage-integration: ## generate coverprofiles from the integration tests
|
coverage-integration: ## generate coverprofiles from the integration tests
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
go test -race -tags "${DOCKER_BUILDTAGS}" -test.short -coverprofile="../../../${INTEGRATION_PACKAGE}/coverage.txt" -covermode=atomic ${INTEGRATION_PACKAGE}
|
go test ${TESTFLAGS} -test.short -coverprofile="../../../${INTEGRATION_PACKAGE}/coverage.txt" -covermode=atomic ${INTEGRATION_PACKAGE}
|
||||||
|
|
||||||
vendor:
|
vendor:
|
||||||
@echo "🐳 $@"
|
@echo "🐳 $@"
|
||||||
|
|
Loading…
Reference in a new issue