SIGN IN SIGN UP
go-kit / kit UNCLAIMED

A standard library for microservices.

0 0 0 Go
#!/usr/bin/env bash
2015-05-27 15:16:00 +02:00
# This script runs the cover tool on all packages with test files. If you set a
# WEB environment variable, it will additionally open the web-based coverage
2015-08-28 01:05:31 +02:00
# visualizer for each package.
2015-08-28 01:00:26 +02:00
2015-08-28 01:02:14 +02:00
set -e
function go_files { find . -name '*_test.go' ; }
function filter { grep -v '/_' ; }
function remove_relative_prefix { sed -e 's/^\.\///g' ; }
function directories {
go_files | filter | remove_relative_prefix | while read f
do
dirname $f
done
}
function unique_directories { directories | sort | uniq ; }
PATHS=${1:-$(unique_directories)}
2015-08-28 01:00:26 +02:00
function report {
for path in $PATHS
do
2015-08-28 01:00:26 +02:00
go test -coverprofile=$path/cover.coverprofile ./$path
done
}
2015-08-28 01:00:26 +02:00
function combine {
gover
}
function clean {
find . -name cover.coverprofile | xargs rm
}
report
2015-08-28 01:00:26 +02:00
combine
clean
if [ -n "${WEB+x}" ]
then
2015-08-28 01:05:31 +02:00
go tool cover -html=gover.coverprofile
2015-08-28 01:00:26 +02:00
fi