Permalink
Browse files

testing: coverage script

Updates #27
  • Loading branch information...
mmcloughlin committed Jan 3, 2019
1 parent cf76c56 commit d92a14764440a067628b83ac3782fd36ab7e4956
Showing with 26 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 .travis.yml
  3. +3 −0 script/bootstrap
  4. +21 −0 script/coverage
@@ -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
@@ -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}

0 comments on commit d92a147

Please sign in to comment.