github.com/armen/terraform@v0.5.2-0.20150529052519-caa8117a08f1/Makefile (about) 1 TEST?=./... 2 VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr 3 4 default: test 5 6 # bin generates the releaseable binaries for Terraform 7 bin: generate 8 @sh -c "'$(CURDIR)/scripts/build.sh'" 9 10 # dev creates binaries for testing Terraform locally. These are put 11 # into ./bin/ as well as $GOPATH/bin 12 dev: generate 13 @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" 14 15 quickdev: generate 16 @TF_QUICKDEV=1 TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" 17 18 # test runs the unit tests and vets the code 19 test: generate 20 TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4 21 @$(MAKE) vet 22 23 # testacc runs acceptance tests 24 testacc: generate 25 @if [ "$(TEST)" = "./..." ]; then \ 26 echo "ERROR: Set TEST to a specific package"; \ 27 exit 1; \ 28 fi 29 TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m 30 31 # testrace runs the race checker 32 testrace: generate 33 TF_ACC= go test -race $(TEST) $(TESTARGS) 34 35 # updatedeps installs all the dependencies that Terraform needs to run 36 # and build. 37 updatedeps: 38 go get -u github.com/mitchellh/gox 39 go get -u golang.org/x/tools/cmd/stringer 40 go list ./... \ 41 | xargs go list -f '{{join .Deps "\n"}}' \ 42 | grep -v github.com/hashicorp/terraform \ 43 | sort -u \ 44 | xargs go get -f -u -v 45 46 cover: 47 @go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \ 48 go get -u golang.org/x/tools/cmd/cover; \ 49 fi 50 go test $(TEST) -coverprofile=coverage.out 51 go tool cover -html=coverage.out 52 rm coverage.out 53 54 # vet runs the Go source code static analysis tool `vet` to find 55 # any common errors. 56 vet: 57 @go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \ 58 go get golang.org/x/tools/cmd/vet; \ 59 fi 60 @echo "go tool vet $(VETARGS) ." 61 @go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \ 62 echo ""; \ 63 echo "Vet found suspicious constructs. Please check the reported constructs"; \ 64 echo "and fix them if necessary before submitting the code for reviewal."; \ 65 fi 66 67 # generate runs `go generate` to build the dynamically generated 68 # source files. 69 generate: 70 go generate ./... 71 72 .PHONY: bin default generate test updatedeps vet