Update code coverage script (#8280)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
This commit is contained in:
groot 2021-09-22 16:01:53 +08:00 committed by GitHub
parent f834ceafdd
commit 77e88144fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 14 deletions

12
.gitignore vendored
View File

@ -76,15 +76,15 @@ gtags.conf
# Delve generated file
**/__debug_bin
# go-codecov
# codecov-go generated files
coverage.txt
profile.out
cover.out
coverage.html
profile.txt
go_coverage.html
#cpp-codecov
*.info
lcov_out/
# codecov-cpp generated files
lcov_*.info
cpp_coverage/
# virtualenv
venv/

View File

@ -121,15 +121,15 @@ test-cpp: build-cpp-with-unittest
@(env bash $(PWD)/scripts/run_cpp_unittest.sh)
# Runs code coverage.
codecov: go-codecov cpp-codecov
codecov: codecov-go codecov-cpp
# Run go-codecov
go-codecov: build-cpp-with-unittest
# Run codecov-go
codecov-go: build-cpp-with-unittest
@echo "Running go coverage..."
@(env bash $(PWD)/scripts/run_go_codecov.sh)
# Run cpp-codecov
cpp-codecov: build-cpp-with-unittest
# Run codecov-cpp
codecov-cpp: build-cpp-with-unittest
@echo "Running cpp coverage..."
@(env bash $(PWD)/scripts/run_cpp_codecov.sh)

View File

@ -24,7 +24,7 @@ FILE_INFO_BASE="${ROOT_DIR}/lcov_base.info"
FILE_INFO_UT="${ROOT_DIR}/lcov_ut.info"
FILE_INFO_COMBINE="${ROOT_DIR}/lcov_combine.info"
FILE_INFO_OUTPUT="${ROOT_DIR}/lcov_output.info"
DIR_LCOV_OUTPUT="${ROOT_DIR}/lcov_html"
DIR_LCOV_OUTPUT="${ROOT_DIR}/cpp_coverage"
DIR_GCNO="${ROOT_DIR}/cmake_build/"
# delete old code coverage info files

View File

@ -1,12 +1,14 @@
#!/usr/bin/env bash
set -e
echo "" > coverage.txt
echo "mode: atomic" > coverage.txt
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
cat profile.out >> coverage.txt
sed '1d' profile.out >> coverage.txt
rm profile.out
fi
done
go tool cover -html=./coverage.txt -o ./go_coverage.html