From 6a7ac2331b70fe46f4484d7dad2724d9cdb4c27f Mon Sep 17 00:00:00 2001 From: Connor Doyle Date: Fri, 9 Dec 2016 17:09:19 -0800 Subject: [PATCH] Fix code coverage in build script on OS X. --- hack/make-rules/test.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index 10d508ebda..b55e041786 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -245,25 +245,28 @@ runTests() { # `go test` does not install the things it builds. `go test -i` installs # the build artifacts but doesn't run the tests. The two together provide # a large speedup for tests that do not need to be rebuilt. - printf "%s\n" "${@}" | grep -Ev $cover_ignore_dirs | xargs -I{} -n1 -P${KUBE_COVERPROCS} \ - bash -c "set -o pipefail; _pkg=\"{}\"; _pkg_out=\${_pkg//\//_}; \ - go test -i ${goflags[@]:+${goflags[@]}} \ - ${KUBE_RACE} \ - ${KUBE_TIMEOUT} \ - -cover -covermode=\"${KUBE_COVERMODE}\" \ - -coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \ - \"${KUBE_GO_PACKAGE}/\${_pkg}\" \ - ${testargs[@]:+${testargs[@]}} - go test ${goflags[@]:+${goflags[@]}} \ - ${KUBE_RACE} \ - ${KUBE_TIMEOUT} \ - -cover -covermode=\"${KUBE_COVERMODE}\" \ - -coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \ - \"${KUBE_GO_PACKAGE}/\${_pkg}\" \ - ${testargs[@]:+${testargs[@]}} \ - | tee ${junit_filename_prefix:+\"${junit_filename_prefix}-\$_pkg_out.stdout\"} \ - | grep \"${go_test_grep_pattern}\"" \ - && test_result=$? || test_result=$? + printf "%s\n" "${@}" \ + | grep -Ev $cover_ignore_dirs \ + | xargs -I{} -n 1 -P ${KUBE_COVERPROCS} \ + bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \ + go test -i ${goflags[@]:+${goflags[@]}} \ + ${KUBE_RACE} \ + ${KUBE_TIMEOUT} \ + -cover -covermode=\"${KUBE_COVERMODE}\" \ + -coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \ + \"${KUBE_GO_PACKAGE}/\${_pkg}\" \ + ${testargs[@]:+${testargs[@]}} + go test ${goflags[@]:+${goflags[@]}} \ + ${KUBE_RACE} \ + ${KUBE_TIMEOUT} \ + -cover -covermode=\"${KUBE_COVERMODE}\" \ + -coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \ + \"${KUBE_GO_PACKAGE}/\${_pkg}\" \ + ${testargs[@]:+${testargs[@]}} \ + | tee ${junit_filename_prefix:+\"${junit_filename_prefix}-\$_pkg_out.stdout\"} \ + | grep \"${go_test_grep_pattern}\"" \ + {} \ + && test_result=$? || test_result=$? produceJUnitXMLReport "${junit_filename_prefix}"