Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Commit

Permalink
Make the coverage/test running script a little better
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Mar 22, 2014
1 parent 7da9316 commit 9c0b0d4
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions test-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
#!/bin/bash

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

for dir in $(find . -maxdepth 10 -not -path './.git*' -type d);
do
if ls $dir/*.go &> /dev/null;
then
returnval=`go test -coverprofile=profile.out $dir`
echo ${returnval}
if [[ ${returnval} != *FAIL* ]]
then
if [ -f profile.out ]
then
cat profile.out | grep -v "mode: set" >> acc.out
fi
else
exit 1
fi
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
if [ -n "$COVERALLS" ]

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

rm -rf ./profile.out
rm -rf ./acc.out
rm -f acc.out

exit $fail

0 comments on commit 9c0b0d4

Please sign in to comment.