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 | |
| 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')
| -rwxr-xr-x | hack/lib/golang.sh | 8 | ||||
| -rwxr-xr-x | hack/make-rules/clean.sh | 1 |
2 files changed, 8 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 } diff --git a/hack/make-rules/clean.sh b/hack/make-rules/clean.sh index bbeec600e..525c975bd 100755 --- a/hack/make-rules/clean.sh +++ b/hack/make-rules/clean.sh @@ -25,6 +25,7 @@ source "${KUBEEDGE_ROOT}/hack/lib/init.sh" kubeedge::clean::cache(){ unset GOARM + go clean -testcache go clean -cache } |
