diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rwxr-xr-x | coverage.sh | 12 |
3 files changed, 18 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 8d0749b37..8ab6c9c9d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Corefile coredns kubectl go-test-tmpfile* +coverage.txt diff --git a/.travis.yml b/.travis.yml index 91f269b1d..3aed7d125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,3 +46,8 @@ script: - go test -tags etcd -race -bench=. ./... # Run kubernetes integration tests only if kubectl is available. i.e. If kubernetes was launched - ./contrib/kubernetes/testscripts/kubectl version && go test -v -tags k8s -race -bench=. -run 'TestK8sIntegration' ./test + # go cannot use test profile flag with multiple packages so we have to iterate, the following might be consolidated with the above steps. + - ./coverage.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/coverage.sh b/coverage.sh new file mode 100755 index 000000000..f038955fe --- /dev/null +++ b/coverage.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e -x +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -race -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done |