From fcabd4de921ea84fea4e8dba069a402adda32a88 Mon Sep 17 00:00:00 2001 From: Dan McPherson Date: Thu, 12 Feb 2015 11:20:32 -0500 Subject: [PATCH] Fixing test coverage reporting --- Makefile | 2 +- hack/test-go.sh | 20 +++++++++++++++----- hack/test-integration-docker.sh | 2 +- hack/test-integration.sh | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index abbe810cab6c..49b79267a26a 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ $(info build is being skipped) test: check else test: build check -endif +endif test: hack/test-cmd.sh hack/test-integration.sh $(GOFLAGS) diff --git a/hack/test-go.sh b/hack/test-go.sh index 55f79c81145b..f66133b97f6b 100755 --- a/hack/test-go.sh +++ b/hack/test-go.sh @@ -31,22 +31,32 @@ find_test_dirs() { # -covermode=atomic becomes default with -race in Go >=1.3 if [ -z ${KUBE_COVER+x} ]; then - KUBE_COVER="" #"-cover -covermode=atomic" + KUBE_COVER="" +fi + +OUTPUT_COVERAGE=${OUTPUT_COVERAGE:-""} + +if [ -n "${OUTPUT_COVERAGE}" ]; then + if [ -z "${KUBE_RACE}" ]; then + KUBE_RACE="-race" + fi + if [ -z "${KUBE_COVER}" ]; then + KUBE_COVER="-cover -covermode=atomic" + fi fi -KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 45s} if [ -z ${KUBE_RACE+x} ]; then - KUBE_RACE="" #"-race" + KUBE_RACE="" fi +KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 45s} + if [ "${1-}" != "" ]; then test_packages="$OS_GO_PACKAGE/$1" else test_packages=`find_test_dirs` fi -OUTPUT_COVERAGE=${OUTPUT_COVERAGE:-""} - export OPENSHIFT_ON_PANIC=crash if [[ -n "${KUBE_COVER}" && -n "${OUTPUT_COVERAGE}" ]]; then diff --git a/hack/test-integration-docker.sh b/hack/test-integration-docker.sh index 2fce7a5162c6..d638bb2506c2 100755 --- a/hack/test-integration-docker.sh +++ b/hack/test-integration-docker.sh @@ -22,4 +22,4 @@ trap cleanup EXIT SIGINT echo echo Docker integration test cases ... echo -KUBE_RACE="${KUBE_RACE:--race}" KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration docker' "${@:1}" +KUBE_RACE=" " KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration docker' "${@:1}" diff --git a/hack/test-integration.sh b/hack/test-integration.sh index 9d5d12451b9e..5418728e65c6 100755 --- a/hack/test-integration.sh +++ b/hack/test-integration.sh @@ -23,4 +23,4 @@ echo echo Integration test cases ... echo # TODO: race is disabled because of origin #731 -KUBE_RACE="${KUBE_RACE:-}" KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration no-docker' "${@:1}" +KUBE_RACE=" " KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration no-docker' "${@:1}"