mirror of https://github.com/milvus-io/milvus.git
[skip ci] Macro for go coverage script (#8999)
Signed-off-by: yhmo <yihua.mo@zilliz.com>pull/9025/head
parent
49cca66015
commit
9cd291d2a6
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
FILE_COVERAGE_INFO="go_coverage.txt"
|
||||
FILE_COVERAGE_HTML="go_coverage.html"
|
||||
|
||||
set -e
|
||||
echo "mode: atomic" > go_coverage.txt
|
||||
echo "mode: atomic" > ${FILE_COVERAGE_INFO}
|
||||
|
||||
for d in $(go list ./internal... | grep -v vendor); do
|
||||
go test -race -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d"
|
||||
if [ -f profile.out ]; then
|
||||
sed '1d' profile.out >> go_coverage.txt
|
||||
sed '1d' profile.out >> ${FILE_COVERAGE_INFO}
|
||||
rm profile.out
|
||||
fi
|
||||
done
|
||||
|
||||
go tool cover -html=./go_coverage.txt -o ./go_coverage.html
|
||||
echo "Export go coverage report to go_coverage.html"
|
||||
go tool cover -html=./${FILE_COVERAGE_INFO} -o ./${FILE_COVERAGE_HTML}
|
||||
echo "Export go coverage report to ${FILE_COVERAGE_HTML}"
|
||||
|
|
Loading…
Reference in New Issue