Get more accurate test coverage

This commit is contained in:
iamqizhao 2015-12-17 15:11:37 -08:00
Родитель a98f0170cf
Коммит e2f4a8ddb3
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -4,15 +4,20 @@ set -e
workdir=.cover
profile="$workdir/cover.out"
mode=count
mode=set
end2endtest="google.golang.org/grpc/test"
generate_cover_data() {
rm -rf "$workdir"
mkdir "$workdir"
for pkg in "$@"; do
f="$workdir/$(echo $pkg | tr / -).cover"
go test -covermode="$mode" -coverprofile="$f" "$pkg"
if [ $pkg == "google.golang.org/grpc" -o $pkg == "google.golang.org/grpc/transport" -o $pkg == "google.golang.org/grpc/metadata" -o $pkg == "google.golang.org/grpc/credentials" ]
then
f="$workdir/$(echo $pkg | tr / -)"
go test -covermode="$mode" -coverprofile="$f.cover" "$pkg"
go test -covermode="$mode" -coverpkg "$pkg" -coverprofile="$f.e2e.cover" "$end2endtest"
fi
done
echo "mode: $mode" >"$profile"