Merge pull request #577 from adamreese/ref/coverage

ref(scripts): cleanup coverage script
pull/579/head
Adam Reese 9 years ago
commit cebc2c37e7

2
.gitignore vendored

@ -2,8 +2,8 @@
.*.swp
*.pyc
.project
coverage.out
nohup.out
/.coverage
/bin
/vendor/*
/rootfs/manager/bin/manager

@ -17,17 +17,22 @@ set -eo pipefail
[[ "$TRACE" ]] && set -x
COVERDIR=${COVERDIR:-.coverage}
COVERMODE=${COVERMODE:-atomic}
PACKAGES=($(go list $(glide novendor)))
echo "mode: ${COVERMODE}" > coverage.out
if [[ ! -d "$COVERDIR" ]]; then
mkdir -p "$COVERDIR"
fi
echo "mode: ${COVERMODE}" > "${COVERDIR}/coverage.out"
for d in "${PACKAGES[@]}"; do
go test -coverprofile=profile.out -covermode="$COVERMODE" "$d"
if [ -f profile.out ]; then
sed "/mode: $COVERMODE/d" profile.out >> coverage.out
sed "/mode: $COVERMODE/d" profile.out >> "${COVERDIR}/coverage.out"
rm profile.out
fi
done
go tool cover -html=coverage.out
go tool cover -html "${COVERDIR}/coverage.out" -o "${COVERDIR}/coverage.html"

Loading…
Cancel
Save