Browse code

Fixing test coverage reporting

Dan McPherson authored on 2015/02/13 01:20:32
Showing 4 changed files
... ...
@@ -59,7 +59,7 @@ $(info build is being skipped)
59 59
 test: check
60 60
 else
61 61
 test: build check
62
-endif 
62
+endif
63 63
 test:
64 64
 	hack/test-cmd.sh
65 65
 	hack/test-integration.sh $(GOFLAGS)
... ...
@@ -31,22 +31,32 @@ find_test_dirs() {
31 31
 
32 32
 # -covermode=atomic becomes default with -race in Go >=1.3
33 33
 if [ -z ${KUBE_COVER+x} ]; then
34
-  KUBE_COVER="" #"-cover -covermode=atomic"
34
+  KUBE_COVER=""
35
+fi
36
+
37
+OUTPUT_COVERAGE=${OUTPUT_COVERAGE:-""}
38
+
39
+if [ -n "${OUTPUT_COVERAGE}" ]; then
40
+  if [ -z "${KUBE_RACE}" ]; then
41
+    KUBE_RACE="-race"
42
+  fi
43
+  if [ -z "${KUBE_COVER}" ]; then
44
+    KUBE_COVER="-cover -covermode=atomic"
45
+  fi
35 46
 fi
36
-KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 45s}
37 47
 
38 48
 if [ -z ${KUBE_RACE+x} ]; then
39
-  KUBE_RACE="" #"-race"
49
+  KUBE_RACE=""
40 50
 fi
41 51
 
52
+KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 45s}
53
+
42 54
 if [ "${1-}" != "" ]; then
43 55
   test_packages="$OS_GO_PACKAGE/$1"
44 56
 else
45 57
   test_packages=`find_test_dirs`
46 58
 fi
47 59
 
48
-OUTPUT_COVERAGE=${OUTPUT_COVERAGE:-""}
49
-
50 60
 export OPENSHIFT_ON_PANIC=crash
51 61
 
52 62
 if [[ -n "${KUBE_COVER}" && -n "${OUTPUT_COVERAGE}" ]]; then
... ...
@@ -22,4 +22,4 @@ trap cleanup EXIT SIGINT
22 22
 echo
23 23
 echo Docker integration test cases ...
24 24
 echo
25
-KUBE_RACE="${KUBE_RACE:--race}" KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration docker' "${@:1}"
25
+KUBE_RACE=" " KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration docker' "${@:1}"
... ...
@@ -23,4 +23,4 @@ echo
23 23
 echo Integration test cases ...
24 24
 echo
25 25
 # TODO: race is disabled because of origin #731
26
-KUBE_RACE="${KUBE_RACE:-}" KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration no-docker' "${@:1}"
26
+KUBE_RACE=" " KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration no-docker' "${@:1}"