From c01fff797696edb3e2cccb1bbc65f2bd09a6d9ff Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Sat, 10 Aug 2019 18:26:37 +0000 Subject: [PATCH] =?UTF-8?q?circleci:=20coverage.sh:=20=E6=94=B9=E5=96=84?= =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B6=88=E8=80=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/coverage.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/coverage.sh b/scripts/coverage.sh index b108ecbe7e..92b06e03ae 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -35,13 +35,17 @@ if [ -z "$pkgs" ]; then fi echo "mode: $covermode" >"$profile" -go test -v \ - -coverprofile="$profile" \ - -covermode="$covermode" \ - -mod vendor \ - -ldflags '-w' \ - $pkgs -go tool cover -func "$profile" +echo "$pkgs" | xargs -n 8 --no-run-if-empty echo \ + | while read batch; do \ + go test -v \ + -coverprofile="$profile.tmp" \ + -covermode="$covermode" \ + -mod vendor \ + -ldflags '-w' \ + $batch; \ + tail -n +2 "$profile.tmp" >>"$profile"; \ + rm -f "$profile.tmp"; \ + done case "${1-}" in --html) @@ -51,5 +55,8 @@ case "${1-}" in if ! push_to_codecov; then echo "ignored: push to codecov failed" >&2 fi + ;; + *) + go tool cover -func "$profile" ;; esac