Commit 376894ff authored by Adam Reese's avatar Adam Reese

ref(scripts): cleanup coverage script

parent dd4263a0
......@@ -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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment