From 3e16fe8d0afb2f9a255930ec05da56e793d42696 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Mon, 26 Oct 2015 16:57:27 +0000 Subject: [PATCH] Add -no-go-get option to test. --- test | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/test b/test index 017fdc80f8..6b0130fb18 100755 --- a/test +++ b/test @@ -4,8 +4,31 @@ set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" GO_TEST_ARGS="-tags netgo -cpu 4 -timeout 8m" +SLOW= +NO_GO_GET= + +usage() { + echo "$0 [-slow] [-in-container foo]" +} + +while [ $# -gt 0 ]; do + case "$1" in + "-slow") + SLOW=true + shift 1 + ;; + "-no-go-get") + NO_GO_GET=true + shift 1 + ;; + *) + usage + exit 2 + ;; + esac +done -if [ -n "$SLOW" -o "$1" = "-slow" -o -n "$CIRCLECI" ]; then +if [ -n "$SLOW" -o -n "$CIRCLECI" ]; then SLOW=true fi @@ -34,7 +57,9 @@ fi PACKAGE_BASE=$(go list -e ./) for dir in $TESTDIRS; do - go get -t -tags netgo $dir + if [ -z "$NO_GO_GET" ]; then + go get -t -tags netgo $dir + fi GO_TEST_ARGS_RUN="$GO_TEST_ARGS" if [ -n "$SLOW" ]; then @@ -44,7 +69,7 @@ for dir in $TESTDIRS; do fi START=$(date +%s) - if ! go test $GO_TEST_ARGS_RUN $dir ; then + if ! go test $GO_TEST_ARGS_RUN $dir; then fail=1 fi RUNTIME=$(( $(date +%s) - $START ))