Skip to content

Commit

Permalink
chore(build): fix test script
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Jul 18, 2017
1 parent 97e53ac commit 6294b93
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
#!/bin/sh
go test -race -v ./...

# Get Test dependencies
go get github.com/axw/gocov/gocov
go get github.com/mattn/goveralls
go get golang.org/x/tools/cmd/cover
# go get code.google.com/p/go.tools/cmd/cover
go get github.com/modocache/gover

# Run test coverage on each subdirectories and merge the coverage profile.

echo "mode: count" > profile.cov

# Standard go tooling behavior is to ignore dirs with leading underscors
for dir in $(find . -maxdepth 3 -not -path './.git*' -not -path '*/_*' -not -path '_*' -type d -not -path './examples*' -not -path './vendor*' -not -path './output*' -not -path './dist*' -not -path './build*' -not -path './bin*' -not -path './scripts*' -not -path './pact-*'); do
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); do
if ls $dir/*.go &> /dev/null; then
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
if [ $? = 1 ]; then
echo "Test failure, exiting"
exit 1
fi

if [ -f $dir/profile.tmp ]; then
cat $dir/profile.tmp | tail -n +2 >> profile.cov
rm $dir/profile.tmp
fi
fi
done

go tool cover -func profile.cov
go tool cover -func profile.cov

0 comments on commit 6294b93

Please sign in to comment.