Files
docker-docs/script/coverage
Andrea Luzzardi 5bf339af48 Coverage: Refactoring.
- Make script/coverage runnable locally.
- Move the goveralls push to travis instead of script/coverage.
- Refactor code into a loop.
- Properly handle packages with no tests.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-15 17:29:16 -07:00

21 lines
449 B
Bash
Executable File

#!/bin/bash
MODE="mode: count"
ROOT=${TRAVIS_BUILD_DIR:-.}/../../..
# Grab the list of packages.
PACKAGES=`go list ./...`
# Create the empty coverage file.
echo $MODE > goverage.report
# Run coverage on every package.
for package in $PACKAGES; do
output="$ROOT/$package/coverage.out"
go test -test.short -covermode=count -coverprofile=$output $package
if [ -f "$output" ] ; then
cat "$output" | grep -v "$MODE" >> goverage.report
fi
done