Add -no-go-get option to test.

This commit is contained in:
Tom Wilkie
2015-10-26 16:57:27 +00:00
parent 58c9a390c5
commit 3e16fe8d0a

29
test
View File

@@ -4,8 +4,31 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
GO_TEST_ARGS="-tags netgo -cpu 4 -timeout 8m" GO_TEST_ARGS="-tags netgo -cpu 4 -timeout 8m"
SLOW=
NO_GO_GET=
if [ -n "$SLOW" -o "$1" = "-slow" -o -n "$CIRCLECI" ]; then 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 -n "$CIRCLECI" ]; then
SLOW=true SLOW=true
fi fi
@@ -34,7 +57,9 @@ fi
PACKAGE_BASE=$(go list -e ./) PACKAGE_BASE=$(go list -e ./)
for dir in $TESTDIRS; do for dir in $TESTDIRS; do
if [ -z "$NO_GO_GET" ]; then
go get -t -tags netgo $dir go get -t -tags netgo $dir
fi
GO_TEST_ARGS_RUN="$GO_TEST_ARGS" GO_TEST_ARGS_RUN="$GO_TEST_ARGS"
if [ -n "$SLOW" ]; then if [ -n "$SLOW" ]; then
@@ -44,7 +69,7 @@ for dir in $TESTDIRS; do
fi fi
START=$(date +%s) START=$(date +%s)
if ! go test $GO_TEST_ARGS_RUN $dir ; then if ! go test $GO_TEST_ARGS_RUN $dir; then
fail=1 fail=1
fi fi
RUNTIME=$(( $(date +%s) - $START )) RUNTIME=$(( $(date +%s) - $START ))