In `hack/test-go.sh` treat arguments that start with a dash as go flags.

This fixes `hack/test-go.sh pkg/apiserver -test.run=<a_specific_test_name>`
which was broken by PR #1116.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
pull/6/head
Filipe Brandenburger 2014-09-03 14:19:36 -07:00
parent 2df3ff51f4
commit 8effbdc63f
1 changed files with 11 additions and 0 deletions

View File

@ -94,6 +94,17 @@ shift $((OPTIND - 1))
# Use eval to preserve embedded quoted strings. # Use eval to preserve embedded quoted strings.
eval "goflags=(${GOFLAGS:-})" eval "goflags=(${GOFLAGS:-})"
# Filter out arguments that start with "-" and move them to goflags.
testcases=()
for arg; do
if [[ "${arg}" == -* ]]; then
goflags+=("${arg}")
else
testcases+=("${arg}")
fi
done
set -- ${testcases[@]+"${testcases[@]}"}
if [[ "${iterations}" -gt 1 ]]; then if [[ "${iterations}" -gt 1 ]]; then
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
set -- $(find_test_dirs) set -- $(find_test_dirs)