Coverage.

This commit is contained in:
Matthew Dillon 2015-01-28 10:52:12 -09:00
parent f58962c031
commit 139d5ff49f
3 changed files with 26 additions and 2 deletions

View file

@ -21,6 +21,6 @@ before_script:
- mkdir -p shippable/codecoverage - mkdir -p shippable/codecoverage
script: script:
- go test -coverprofile=coverage.txt -covermode count ./... - ./test.sh
- $GOPATH/bin/gocover-cobertura < coverage.txt > shippable/codecoverage/coverage.xml - $GOPATH/bin/gocover-cobertura < coverage.txt > shippable/codecoverage/coverage.xml

23
test.sh
View file

@ -1,4 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
go test -v ./... # FROM: https://github.com/getlantern/flashlight-build/blob/devel/testandcover.bash
function die() {
echo $*
exit 1
}
export GOPATH=`pwd`:$GOPATH
echo "mode: count" > coverage.txt
ERROR=""
for pkg in `cat testpackages.txt`
do
go test -v -covermode=count -coverprofile=profile_tmp.cov $pkg || ERROR="Error testing $pkg"
tail -n +2 profile_tmp.cov >> coverage.txt || die "Unable to append coverage for $pkg"
done
if [ ! -z "$ERROR" ]
then
die "Encountered error, last error was: $ERROR"
fi

3
testpackages.txt Normal file
View file

@ -0,0 +1,3 @@
github.com/thermokarst/bactdb/models
github.com/thermokarst/bactdb/datastore
github.com/thermokarst/bactdb/api