-
Notifications
You must be signed in to change notification settings - Fork 75
/
Makefile
94 lines (72 loc) · 2.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
TEST?=./...
GOFMT_FILES?=$$(find . -name '*.go')
maindir=$(PWD)
timeout=0
ifdef VCD_TIMEOUT
timeout="$(VCD_TIMEOUT)"
endif
default: fmtcheck vet static security build
# test runs the test suite and vets the code
test: testunit tagverify
@echo "==> Running Functional Tests"
cd govcd && go test -tags "functional" -timeout=$(timeout) -check.vv
# tagverify checks that each tag can run independently
tagverify: fmtcheck
@echo "==> Running Tags Tests"
@./scripts/test-tags.sh
# testunit runs the unit tests
testunit: fmtcheck
@echo "==> Running Unit Tests"
cd $(maindir)/govcd && go test -tags unit -v
cd $(maindir)/util && go test -v
# testrace runs the race checker
testrace:
@go list $(TEST) | xargs -n1 go test -race $(TESTARGS)
# This will include tests guarded by build tag concurrent with race detector
testconcurrent:
cd govcd && go test -race -tags "api concurrent" -timeout $(timeout) -check.vv -check.f "Test.*Concurrent"
# tests only catalog related features
testcatalog:
cd govcd && go test -tags "catalog" -timeout $(timeout) -check.vv
# tests only vapp and vm features
testvapp:
cd govcd && go test -tags "vapp vm" -timeout $(timeout) -check.vv
# tests only edge gateway features
testgateway:
cd govcd && go test -tags "gateway" -timeout $(timeout) -check.vv
# tests only networking features
testnetwork:
cd govcd && go test -tags "network" -timeout $(timeout) -check.vv
# tests only load balancer features
testlb:
cd govcd && go test -tags "lb" -timeout $(timeout) -check.vv
# tests only NSXV related features
testnsxv:
cd govcd && go test -tags "nsxv" -timeout $(timeout) -check.vv
testtm:
cd govcd && go test -tags "tm" -timeout 0 -check.vv
# vet runs the Go source code static analysis tool `vet` to find
# any common errors.
vet:
@echo "==> Running Go Vet"
@go vet -tags ALL ./... ; if [ $$? -ne 0 ] ; then echo "vet error!" ; exit 1 ; fi
# static runs the source code static analysis tool `staticcheck`
static: fmtcheck
@./scripts/staticcheck.sh
# security runs the source code security analysis tool `gosec`
security: fmtcheck
@./scripts/gosec.sh
get-deps:
@echo "==> Fetching dependencies"
@go get -v $(TEST)
@go get -u github.com/golang/lint/golint
fmt:
gofmt -w $(GOFMT_FILES)
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
copyright:
@echo "==> Checking copyright headers in source files"
@sh -c "'$(CURDIR)/scripts/copyright_check.sh'"
build:
@echo "==> Building govcd library"
cd govcd && go build . && go test -tags ALL -c