Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -tags option to test script #103

Merged
merged 1 commit into from
Jun 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ while [ $# -gt 0 ]; do
shift 1
;;
"-netgo")
TAGS="-tags netgo"
TAGS="netgo"
shift 1
;;
"-tags")
TAGS="$2"

This comment was marked as abuse.

This comment was marked as abuse.

shift 2
;;
"-p")
PARALLEL=true
shift 1
Expand All @@ -51,7 +55,7 @@ while [ $# -gt 0 ]; do
esac
done

GO_TEST_ARGS=($TAGS -cpu 4 -timeout $TIMEOUT)
GO_TEST_ARGS=(-tags "${TAGS[@]}" -cpu 4 -timeout $TIMEOUT)

if [ -n "$SLOW" ] || [ -n "$CIRCLECI" ]; then
SLOW=true
Expand All @@ -74,7 +78,7 @@ fail=0

if [ -z "$TESTDIRS" ]; then
# NB: Relies on paths being prefixed with './'.
TESTDIRS=($(git ls-files -- '*_test.go' | grep -vE '^(vendor|prog|experimental)/' | xargs -n1 dirname | sort -u | sed -e 's|^|./|'))
TESTDIRS=($(git ls-files -- '*_test.go' | grep -vE '^(vendor|experimental)/' | xargs -n1 dirname | sort -u | sed -e 's|^|./|'))
else
# TESTDIRS on the right side is not really an array variable, it
# is just a string with spaces, but it is written like that to
Expand All @@ -97,7 +101,7 @@ go test -i "${GO_TEST_ARGS[@]}" "${TESTDIRS[@]}"
run_test() {
local dir=$1
if [ -z "$NO_GO_GET" ]; then
go get -t "$TAGS" "$dir"
go get -t -tags "${TAGS[@]}" "$dir"
fi

local GO_TEST_ARGS_RUN=("${GO_TEST_ARGS[@]}")
Expand Down