Skip to content

Commit 7d89e9b

Browse files
committed
Only normalize user-provided test targets
1 parent 211d67a commit 7d89e9b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

hack/make-rules/test.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ goflags=()
147147

148148
# Filter out arguments that start with "-" and move them to goflags.
149149
testcases=()
150+
# if the user passed no target in, we can skip slow normalization.
151+
normalize="true"
152+
150153
for arg; do
151154
if [[ "${arg}" == -* ]]; then
152155
goflags+=("${arg}")
@@ -155,8 +158,15 @@ for arg; do
155158
fi
156159
done
157160
if [[ ${#testcases[@]} -eq 0 ]]; then
161+
normalize="false"
158162
kube::util::read-array testcases < <(kube::test::find_dirs)
159163
fi
164+
165+
if [[ "${normalize}" == "true" ]]; then
166+
# This can be slow!
167+
kube::log::status "Normalizing Go targets"
168+
kube::util::read-array testcases < <(kube::golang::normalize_go_targets "${testcases[@]}")
169+
fi
160170
set -- "${testcases[@]+${testcases[@]}}"
161171

162172
if [[ -n "${KUBE_RACE}" ]] ; then
@@ -190,11 +200,6 @@ runTests() {
190200

191201
installTools
192202

193-
# Try to normalize input names. This is slow!
194-
local -a targets
195-
kube::log::status "Normalizing Go targets"
196-
kube::util::read-array targets < <(kube::golang::normalize_go_targets "$@")
197-
198203
# Enable coverage data collection?
199204
local cover_msg
200205
local COMBINED_COVER_PROFILE
@@ -229,7 +234,7 @@ runTests() {
229234
go test -json \
230235
"${goflags[@]:+${goflags[@]}}" \
231236
"${KUBE_TIMEOUT}" \
232-
"${targets[@]}" \
237+
"$@" \
233238
"${testargs[@]:+${testargs[@]}}" \
234239
&& rc=$? || rc=$?
235240

0 commit comments

Comments
 (0)