Built tag-ify sealtesting

This commit is contained in:
Jeff Mitchell 2016-04-28 00:47:44 +00:00
parent a50e29f086
commit 1027b51d17
3 changed files with 10 additions and 3 deletions

View file

@ -2,6 +2,7 @@ TEST?=$$(go list ./... | grep -v /vendor/)
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
EXTERNAL_TOOLS=\ EXTERNAL_TOOLS=\
github.com/mitchellh/gox github.com/mitchellh/gox
BUILD_TAGS?=vault
default: test default: test
@ -16,7 +17,7 @@ dev: generate
# test runs the unit tests and vets the code # test runs the unit tests and vets the code
test: generate test: generate
VAULT_TOKEN= VAULT_ACC= go test $(TEST) $(TESTARGS) -timeout=120s -parallel=4 VAULT_TOKEN= VAULT_ACC= go test -tags='$(BUILD_TAGS)' $(TEST) $(TESTARGS) -timeout=120s -parallel=4
# testacc runs acceptance tests # testacc runs acceptance tests
testacc: generate testacc: generate
@ -24,11 +25,11 @@ testacc: generate
echo "ERROR: Set TEST to a specific package"; \ echo "ERROR: Set TEST to a specific package"; \
exit 1; \ exit 1; \
fi fi
VAULT_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m VAULT_ACC=1 go test -tags='$(BUILD_TAGS)' $(TEST) -v $(TESTARGS) -timeout 45m
# testrace runs the race checker # testrace runs the race checker
testrace: generate testrace: generate
CGO_ENABLED=1 VAULT_TOKEN= VAULT_ACC= go test -race $(TEST) $(TESTARGS) CGO_ENABLED=1 VAULT_TOKEN= VAULT_ACC= go test -tags='$(BUILD_TAGS)' -race $(TEST) $(TESTARGS)
cover: cover:
./scripts/coverage.sh --html ./scripts/coverage.sh --html

View file

@ -11,6 +11,9 @@ DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that directory # Change into that directory
cd "$DIR" cd "$DIR"
# Set build tags
BUILD_TAGS="${VAULT_BUILD_TAGS:-"vault"}"
# Get the git commit # Get the git commit
GIT_COMMIT="$(git rev-parse HEAD)" GIT_COMMIT="$(git rev-parse HEAD)"
GIT_DIRTY="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)" GIT_DIRTY="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)"
@ -45,6 +48,7 @@ gox \
-arch="${XC_ARCH}" \ -arch="${XC_ARCH}" \
-ldflags "-X github.com/hashicorp/vault/version.GitCommit='${GIT_COMMIT}${GIT_DIRTY}'" \ -ldflags "-X github.com/hashicorp/vault/version.GitCommit='${GIT_COMMIT}${GIT_DIRTY}'" \
-output "pkg/{{.OS}}_{{.Arch}}/vault" \ -output "pkg/{{.OS}}_{{.Arch}}/vault" \
-tags="${BUILD_TAGS}" \
. .
# Move all the compiled things to the $GOPATH/bin # Move all the compiled things to the $GOPATH/bin

View file

@ -1,3 +1,5 @@
// +build vault
package vault package vault
import ( import (