aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/google.golang.org/grpc/coverage.sh
diff options
context:
space:
mode:
authorAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
committerAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
commit15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch)
tree255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/google.golang.org/grpc/coverage.sh
parent07971ca38143c5faf951d152fba370ddcbe26ad5 (diff)
downloadterraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz
terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst
terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/google.golang.org/grpc/coverage.sh')
-rw-r--r--vendor/google.golang.org/grpc/coverage.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/google.golang.org/grpc/coverage.sh b/vendor/google.golang.org/grpc/coverage.sh
new file mode 100644
index 0000000..b85f918
--- /dev/null
+++ b/vendor/google.golang.org/grpc/coverage.sh
@@ -0,0 +1,48 @@
1#!/usr/bin/env bash
2
3
4set -e
5
6workdir=.cover
7profile="$workdir/cover.out"
8mode=set
9end2endtest="google.golang.org/grpc/test"
10
11generate_cover_data() {
12 rm -rf "$workdir"
13 mkdir "$workdir"
14
15 for pkg in "$@"; do
16 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" ]
17 then
18 f="$workdir/$(echo $pkg | tr / -)"
19 go test -covermode="$mode" -coverprofile="$f.cover" "$pkg"
20 go test -covermode="$mode" -coverpkg "$pkg" -coverprofile="$f.e2e.cover" "$end2endtest"
21 fi
22 done
23
24 echo "mode: $mode" >"$profile"
25 grep -h -v "^mode:" "$workdir"/*.cover >>"$profile"
26}
27
28show_cover_report() {
29 go tool cover -${1}="$profile"
30}
31
32push_to_coveralls() {
33 goveralls -coverprofile="$profile"
34}
35
36generate_cover_data $(go list ./...)
37show_cover_report func
38case "$1" in
39"")
40 ;;
41--html)
42 show_cover_report html ;;
43--coveralls)
44 push_to_coveralls ;;
45*)
46 echo >&2 "error: invalid option: $1" ;;
47esac
48rm -rf "$workdir"