From 0b552e18de016548dc1fb34568b4f20809b6c31d Mon Sep 17 00:00:00 2001 From: mpg Date: Fri, 20 Apr 2018 11:31:22 -0400 Subject: [PATCH] =?UTF-8?q?fine=20tune=20the=20-coverpkg=20settings,=20so?= =?UTF-8?q?=20that=20we=20don=E2=80=99t=20get=20any=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/go_test_multi_package_coverprofile.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ci/go_test_multi_package_coverprofile.sh b/ci/go_test_multi_package_coverprofile.sh index f6e6746..7f2f382 100755 --- a/ci/go_test_multi_package_coverprofile.sh +++ b/ci/go_test_multi_package_coverprofile.sh @@ -55,16 +55,23 @@ coverprofile="$workdir/$coverprofilename.coverprofile" # Sets -cover. mode=count -function join { local IFS="$1"; shift; echo "$*"; } -mypkgs=`go list ./...` -mypkgs=`join , $mypkgs` - # functions section generate_cover_data() { rm -rf "$workdir" mkdir "$workdir" for pkg in "$@"; do + + # Make a list of each proj-related package we depend on (plus ourself). + # We will collect coverage stats on all those packages, not just ourself, + # so that we can get coverage data across package boundaries. + mypkgs=$pkg + for i in `go list -f '{{.Deps}}' $pkg` ; do + if [[ "$i" = "github.com/go-spatial/proj"* ]]; then + mypkgs="$mypkgs,$i" + fi + done + f="$workdir/$(echo $pkg | tr / -).pkgcoverprofile" go test -covermode="$mode" -coverprofile="$f" -coverpkg=$mypkgs "$pkg" done