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