forked from atlassian/gostatsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cover.sh
executable file
·35 lines (28 loc) · 929 Bytes
/
cover.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
function die() {
echo $*
exit 1
}
# Initialize coverage.out
echo "mode: count" > coverage.out
# Initialize error tracking
ERROR=""
declare -a packages=('' \
'cmd/gostatsd' 'cmd/tester'
'pkg/backends' 'pkg/backends/sender'
'pkg/backends/datadog' 'pkg/backends/graphite' 'pkg/backends/null' \
'pkg/backends/statsdaemon' 'pkg/backends/stdout' \
'pkg/cloudproviders' 'pkg/cloudproviders/aws' \
'pkg/fakesocket' 'pkg/statsd' \
'pkg/stats' 'pkg/cluster/nodes' 'pkg/web');
# Test each package and append coverage profile info to coverage.out
for pkg in "${packages[@]}"
do
go test -v -covermode=count -coverprofile=coverage_tmp.out "github.com/atlassian/gostatsd/$pkg" || ERROR="Error testing $pkg"
tail -n +2 coverage_tmp.out >> coverage.out 2> /dev/null ||:
done
rm -f coverage_tmp.out
if [ ! -z "$ERROR" ]
then
die "Encountered error, last error was: $ERROR"
fi