aboutsummaryrefslogtreecommitdiff
path: root/coverage.sh
diff options
context:
space:
mode:
authorGravatar Yong Tang <yongtang@users.noreply.github.com> 2016-09-18 11:01:57 -0700
committerGravatar GitHub <noreply@github.com> 2016-09-18 11:01:57 -0700
commit587a347a407207b062adf0b74ffc120c6bc157d9 (patch)
tree41b510a52c3f55aa07fb284cc985c4a49ae6d293 /coverage.sh
parent1decf52cb248a2574bf72b09b20ebbdfb6b726f6 (diff)
downloadcoredns-587a347a407207b062adf0b74ffc120c6bc157d9.tar.gz
coredns-587a347a407207b062adf0b74ffc120c6bc157d9.tar.zst
coredns-587a347a407207b062adf0b74ffc120c6bc157d9.zip
Add codecov.io processing with travis-ci integration. (#269)
This fix adds the codecov.io process with travis-ci integration, so that code coverage could be processed and displayed with codecov.io. Since go cannot use test profile flag with multiple packages, we have to iterate through packages with `coverage.sh`. Some consolidation could be done by combining them into one `make test`. Will do some consolidation in a follow up PR. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'coverage.sh')
-rwxr-xr-xcoverage.sh12
1 files changed, 12 insertions, 0 deletions
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