summaryrefslogtreecommitdiffstats
path: root/build.sh
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2016-08-08 16:29:32 +0000
committerAudrius Butkevicius <audrius.butkevicius@gmail.com>2016-08-08 16:29:32 +0000
commita4ed50ca85e670a5f0ff064e220915f310ddb553 (patch)
tree2a80e590d1ab3a857e94a66bd8eecd5c79e8e6d9 /build.sh
parentb3788c8ea0ac30868fb277db9490d32488955990 (diff)
build, lib: Correct total test coverage calculation
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3483
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 4a2d3e82e..822c67096 100755
--- a/build.sh
+++ b/build.sh
@@ -104,7 +104,7 @@ case "${1:-default}" in
# For every package in the repo
for dir in $(go list ./lib/... ./cmd/...) ; do
# run the tests
- GOPATH="$(pwd)/Godeps/_workspace:$GOPATH" go test -race -coverprofile=profile.out $dir
+ GOPATH="$(pwd)/Godeps/_workspace:$GOPATH" go test -coverprofile=profile.out $dir
if [ -f profile.out ] ; then
# and if there was test output, append it to coverage.out
grep -v "mode: " profile.out >> coverage.out
@@ -112,6 +112,11 @@ case "${1:-default}" in
fi
done
+ notCovered=$(egrep -c '\s0$' coverage.out)
+ total=$(wc -l coverage.out | awk '{print $1}')
+ coverPct=$(awk "BEGIN{print (1 - $notCovered / $total) * 100}")
+ echo "Total coverage is $coverPct%"
+
gocov convert coverage.out | gocov-xml > coverage.xml
# This is usually run from within Jenkins. If it is, we need to