Files
go-sip/scripts/coverage.sh
T

13 lines
547 B
Bash
Executable File

#!/bin/sh
set -eu
profile=${COVER_PROFILE:-/tmp/go-sip-coverage.out}
business_profile=${COVER_BUSINESS_PROFILE:-/tmp/go-sip-coverage-business.out}
# Coverage patterns also match local module replacements. Instrument only
# this module's explicit package list, not the checked-in third-party SDK.
packages=$(go list ./... | paste -sd, -)
GOMAXPROCS=${GOMAXPROCS:-2} go test -p 1 -coverpkg="$packages" -coverprofile="$profile" ./...
awk 'NR == 1 || index($0, "/gen/") == 0' "$profile" > "$business_profile"
go tool cover -func="$business_profile"