From ba0b719a02a1a2b726e935aeb8f0880ecbb29edd Mon Sep 17 00:00:00 2001 From: Zubair Hamed Date: Sun, 24 Apr 2016 14:54:10 +0800 Subject: [PATCH] test coverage script --- test-coverage.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test-coverage.sh diff --git a/test-coverage.sh b/test-coverage.sh new file mode 100644 index 0000000..f3a2996 --- /dev/null +++ b/test-coverage.sh @@ -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 \ No newline at end of file