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 .*.swp
*.pyc *.pyc
.project .project
coverage.out
nohup.out nohup.out
/.coverage
/bin /bin
/vendor/* /vendor/*
/rootfs/manager/bin/manager /rootfs/manager/bin/manager

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

Loading…
Cancel
Save