Skip to content

Commit 147892c

Browse files
committed
build.make: support suppressing checks
Individual repos may have to filter out certain packages from testing. For example, in csi-test the cmd/csi-sanity directory contains a special test that depends on additional parameters that set the CSI driver to test against.
1 parent 154e33d commit 147892c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

build.make

+6-3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ else
5757
TESTARGS =
5858
endif
5959

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+
6063
build-%:
6164
mkdir -p bin
6265
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
@@ -95,19 +98,19 @@ test:
9598
test: test-go
9699
test-go:
97100
@ echo; echo $@
98-
go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
101+
go test `go list ./... | grep -v 'vendor' $(TEST_GO_FILTER_CMD)` $(TESTARGS)
99102

100103
.PHONY: test-vet
101104
test: test-vet
102105
test-vet:
103106
@ echo; echo $@
104-
go vet `go list ./... | grep -v vendor`
107+
go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`
105108

106109
.PHONY: test-fmt
107110
test: test-fmt
108111
test-fmt:
109112
@ echo; echo $@
110-
files=$$(find . -name '*.go' | grep -v './vendor'); \
113+
files=$$(find . -name '*.go' | grep -v './vendor' $(TEST_FMT_FILTER_CMD)); \
111114
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
112115
echo "formatting errors:"; \
113116
gofmt -d $$files; \

0 commit comments

Comments
 (0)