From 9c0b0d40977c2dd6e72188c6880993524d2e736f Mon Sep 17 00:00:00 2001 From: Sam Boyer Date: Sat, 22 Mar 2014 18:36:01 -0400 Subject: [PATCH] Make the coverage/test running script a little better --- test-coverage.sh | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/test-coverage.sh b/test-coverage.sh index d68e7e9..4c4725e 100755 --- a/test-coverage.sh +++ b/test-coverage.sh @@ -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