-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcoverage
More file actions
38 lines (31 loc) · 839 Bytes
/
coverage
File metadata and controls
38 lines (31 loc) · 839 Bytes
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
36
37
38
#!/bin/bash
set -o errexit
set -o pipefail
readonly GOPATH="${GOPATH%%:*}"
main() {
_cd_into_top_level
_generate_coverage_files
_combine_coverage_reports
}
_cd_into_top_level() {
cd "$(git rev-parse --show-toplevel)"
#cd nodes/stampzilla-server
}
_generate_coverage_files() {
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path '*/stampzilla-telldus-events' -not -path '*/stampzilla-hidcommander' -type d); do
if ls $dir/*.go &>/dev/null ; then
go test -covermode=atomic -coverprofile=$dir/profile.coverprofile $dir || fail=1
fi
done
}
_install_gover() {
if [[ ! -x "${GOPATH}/bin/gover" ]] ; then
go install github.com/modocache/gover@latest
fi
}
_combine_coverage_reports() {
_install_gover
${GOPATH}/bin/gover
mv gover.coverprofile coverage.txt
}
main "$@"