1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.coverprofile
|
||||
@@ -6,4 +6,5 @@ install:
|
||||
script:
|
||||
- go build ./...
|
||||
- go test -bench . ./...
|
||||
- ./script/coverage
|
||||
- ./script/lint
|
||||
|
||||
@@ -11,3 +11,6 @@ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh |
|
||||
|
||||
# embedmd required for documentation generation
|
||||
go get -u github.com/campoy/embedmd
|
||||
|
||||
# covertool for merging coverage reports
|
||||
go get -u github.com/dlespiau/covertool
|
||||
|
||||
21
script/coverage
Executable file
21
script/coverage
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
ext=".coverprofile"
|
||||
|
||||
# Clean existing coverage files.
|
||||
find . -name '*'${ext} | xargs rm -f
|
||||
|
||||
# Unit test coverage.
|
||||
go test -covermode=count -coverprofile=unit${ext} ./...
|
||||
|
||||
# Integration test coverage.
|
||||
find . -name 'asm.go' | while read main; do
|
||||
dir=$(dirname ${main})
|
||||
name=$(basename ${dir})
|
||||
coverprofile="${dir}/${name}${ext}"
|
||||
./script/covermain ${main} ${coverprofile} > /dev/null
|
||||
done
|
||||
|
||||
# Merge.
|
||||
all="all${ext}"
|
||||
find . -name '*'${ext} | xargs covertool merge --output ${all}
|
||||
Reference in New Issue
Block a user