Skip to content

Commit 33d58fd

Browse files
authored
Merge pull request #5 from pohly/test-enhancements
test enhancements
2 parents be8a440 + b0336b5 commit 33d58fd

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

build.make

+11-7
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if
5151
IMAGE_NAME=$(REGISTRY_NAME)/$*
5252

5353
ifdef V
54+
# Adding "-alsologtostderr" assumes that all test binaries contain glog. This is not guaranteed.
5455
TESTARGS = -v -args -alsologtostderr -v 5
5556
else
5657
TESTARGS =
5758
endif
5859

60+
# Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables
61+
# to something like "| grep -v 'github.com/kubernetes-csi/project/pkg/foobar'". See usage below.
62+
5963
build-%:
6064
mkdir -p bin
6165
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
@@ -93,20 +97,20 @@ test:
9397
.PHONY: test-go
9498
test: test-go
9599
test-go:
96-
@ echo; echo $@
97-
go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
100+
@ echo; echo "### $@:"
101+
go test `go list ./... | grep -v 'vendor' $(TEST_GO_FILTER_CMD)` $(TESTARGS)
98102

99103
.PHONY: test-vet
100104
test: test-vet
101105
test-vet:
102-
@ echo; echo $@
103-
go vet `go list ./... | grep -v vendor`
106+
@ echo; echo "### $@:"
107+
go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`
104108

105109
.PHONY: test-fmt
106110
test: test-fmt
107111
test-fmt:
108-
@ echo; echo $@
109-
files=$$(find . -name '*.go' | grep -v './vendor'); \
112+
@ echo; echo "### $@:"
113+
files=$$(find . -name '*.go' | grep -v './vendor' $(TEST_FMT_FILTER_CMD)); \
110114
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
111115
echo "formatting errors:"; \
112116
gofmt -d $$files; \
@@ -116,5 +120,5 @@ test-fmt:
116120
.PHONY: test-subtree
117121
test: test-subtree
118122
test-subtree:
119-
@ echo; echo $@
123+
@ echo; echo "### $@:"
120124
./release-tools/verify-subtree.sh release-tools

0 commit comments

Comments
 (0)