Skip to content

Commit a28ce73

Browse files
committed
Better coverage support
1 parent 25732e0 commit a28ce73

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

.travis.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ install:
77
- go get golang.org/x/tools/cmd/vet
88
- go get golang.org/x/tools/cmd/cover
99
- go get github.com/mattn/goveralls
10-
10+
- go get github.com/wadey/gocovmerge
1111
script:
1212
- go build
13-
- ./travis/gofmt.sh
14-
- ./travis/govet.sh
13+
- go fmt ./...
14+
- go vet ./...
1515
- go test -i -race ./...
1616
- go test -v -race ./...
17-
- ./travis/coveralls-script.sh
18-
env:
19-
global:
20-
secure: fi/zxSp5eF6Mt8yrgJakBVinDpCDFy3zPZ4Jy7jsyoKWgF7CdSFmh0WBcN932KOLCRaVm7ZqD2RwO9SifIsBcDtZqML4RKg3Q+T+Uqt4LpskVobMYkPKDcA5i3c3ifhJu/wzl7Y/jnysvjxCwQrH/nGAc4+AwyH6x2TjKF7UFoY=
17+
- ./scripts/cov.sh TRAVIS

scripts/cov.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash -e
2+
# Run from directory above via ./scripts/cov.sh
3+
4+
rm -rf ./cov
5+
mkdir cov
6+
go test -v -covermode=atomic -coverprofile=./cov/auth.out ./auth
7+
go test -v -covermode=atomic -coverprofile=./cov/conf.out ./conf
8+
go test -v -covermode=atomic -coverprofile=./cov/hash.out ./hash
9+
go test -v -covermode=atomic -coverprofile=./cov/hashmap.out ./hashmap
10+
go test -v -covermode=atomic -coverprofile=./cov/log.out ./logger
11+
go test -v -covermode=atomic -coverprofile=./cov/server.out ./server
12+
go test -v -covermode=atomic -coverprofile=./cov/sublist.out ./sublist
13+
go test -v -covermode=atomic -coverprofile=./cov/test.out ./test
14+
gocovmerge ./cov/*.out > acc.out
15+
rm -rf ./cov
16+
17+
# If we have an arg, assume travis run and push to coveralls. Otherwise launch browser results
18+
if [[ -n $1 ]]; then
19+
$HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci
20+
rm -rf ./acc.out
21+
else
22+
go tool cover -html=acc.out
23+
fi

travis/gofmt.sh scripts/gofmt.sh

File renamed without changes.

travis/govet.sh scripts/govet.sh

File renamed without changes.

travis/coveralls-script.sh

-16
This file was deleted.

0 commit comments

Comments
 (0)