Better coverage support

This commit is contained in:
Derek Collison
2016-01-17 09:57:11 -08:00
parent 25732e087b
commit a28ce73281
5 changed files with 27 additions and 23 deletions

23
scripts/cov.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash -e
# Run from directory above via ./scripts/cov.sh
rm -rf ./cov
mkdir cov
go test -v -covermode=atomic -coverprofile=./cov/auth.out ./auth
go test -v -covermode=atomic -coverprofile=./cov/conf.out ./conf
go test -v -covermode=atomic -coverprofile=./cov/hash.out ./hash
go test -v -covermode=atomic -coverprofile=./cov/hashmap.out ./hashmap
go test -v -covermode=atomic -coverprofile=./cov/log.out ./logger
go test -v -covermode=atomic -coverprofile=./cov/server.out ./server
go test -v -covermode=atomic -coverprofile=./cov/sublist.out ./sublist
go test -v -covermode=atomic -coverprofile=./cov/test.out ./test
gocovmerge ./cov/*.out > acc.out
rm -rf ./cov
# If we have an arg, assume travis run and push to coveralls. Otherwise launch browser results
if [[ -n $1 ]]; then
$HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci
rm -rf ./acc.out
else
go tool cover -html=acc.out
fi