Skip to content

Commit

Permalink
test coverage script
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairhamed committed Apr 24, 2016
1 parent 73a447e commit ba0b719
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

echo "mode: set" > acc.out
fail=0

# Standard go tooling behavior is to ignore dirs with leading underscors
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
do
if ls $dir/*.go &> /dev/null; then
go test -coverprofile=profile.out $dir || fail=1
if [ -f profile.out ]
then
cat profile.out | grep -v "mode: set" >> acc.out
rm profile.out
fi
fi
done

# Failures have incomplete results, so don't send
if [ -n "$COVERALLS" ] && [ "$fail" -eq 0 ]
then
goveralls -v -coverprofile=acc.out $COVERALLS
fi

rm -f acc.out

exit $fail

0 comments on commit ba0b719

Please sign in to comment.