diff options
| author | Xiang Dai <long0dai@foxmail.com> | 2020-09-11 16:07:09 +0800 |
|---|---|---|
| committer | Xiang Dai <long0dai@foxmail.com> | 2021-01-09 09:36:10 +0800 |
| commit | 41453952e6be69e02b4863617c49d2d566e9c104 (patch) | |
| tree | 814063873d41aed9d96d082286d174fd1083704c /hack/lib/golang.sh | |
| parent | Merge pull request #2437 from Abirdcfly/master (diff) | |
| download | kubeedge-41453952e6be69e02b4863617c49d2d566e9c104.tar.gz | |
Generate coverprofile when test
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
Diffstat (limited to 'hack/lib/golang.sh')
| -rwxr-xr-x | hack/lib/golang.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 9bba8e1e3..3685166dd 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -434,5 +434,11 @@ kubeedge::golang::run_test() { testdirs+=("${KUBEEDGE_ALL_TESTCASES[@]}") fi - go test ${testdirs[@]} + local profile=${PROFILE:-""} + if [[ $profile ]]; then + go test "-coverprofile=${profile}" ${testdirs[@]} + go tool cover -func=coverage.out + else + go test ${testdirs[@]} + fi } |
