aboutsummaryrefslogtreecommitdiffstats
path: root/gocoverage.sh
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-02-02 21:22:20 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-02-02 21:22:20 +0800
commit1e60919d47ac2767706c135332a1a4f79bbf3960 (patch)
tree3db2f5d5446f451d700bf67ef756d85da0fdda25 /gocoverage.sh
parent313cfba7d43529db647789ae826bc426d9da7de3 (diff)
parent0d97c3ce1322083fb9683a5afec004b2626b620a (diff)
downloaddexon-1e60919d47ac2767706c135332a1a4f79bbf3960.tar
dexon-1e60919d47ac2767706c135332a1a4f79bbf3960.tar.gz
dexon-1e60919d47ac2767706c135332a1a4f79bbf3960.tar.bz2
dexon-1e60919d47ac2767706c135332a1a4f79bbf3960.tar.lz
dexon-1e60919d47ac2767706c135332a1a4f79bbf3960.tar.xz
dexon-1e60919d47ac2767706c135332a1a4f79bbf3960.tar.zst
dexon-1e60919d47ac2767706c135332a1a4f79bbf3960.zip
Merge pull request #3 from ethereum/develop
Update to develop
Diffstat (limited to 'gocoverage.sh')
-rwxr-xr-xgocoverage.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/gocoverage.sh b/gocoverage.sh
new file mode 100755
index 000000000..f908a2d66
--- /dev/null
+++ b/gocoverage.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# The script does automatic checking on a Go package and its sub-packages, including:
+# 6. test coverage (http://blog.golang.org/cover)
+
+set -e
+
+# Run test coverage on each subdirectories and merge the coverage profile.
+
+echo "mode: count" > profile.cov
+
+# Standard go tooling behavior is to ignore dirs with leading underscors
+for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
+do
+if ls $dir/*.go &> /dev/null; then
+ # echo $dir
+ if [[ $dir != "./tests/vm" ]]
+ then
+ $GOROOT/bin/go test -covermode=count -coverprofile=$dir/profile.tmp $dir
+ fi
+ if [ -f $dir/profile.tmp ]
+ then
+ cat $dir/profile.tmp | tail -n +2 >> profile.cov
+ rm $dir/profile.tmp
+ fi
+fi
+done
+
+$GOROOT/bin/go tool cover -func profile.cov
+
+# To submit the test coverage result to coveralls.io,
+# use goveralls (https://github.com/mattn/goveralls)
+goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN