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

ref(scripts): cleanup coverage script

parent dd4263a0
...@@ -2,8 +2,8 @@ ...@@ -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 ...@@ -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"
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