[Improvement](test) compute be full coverage (#23618)
This commit is contained in:
19
env.sh
19
env.sh
@ -144,6 +144,25 @@ elif [[ "${DORIS_TOOLCHAIN}" == "clang" ]]; then
|
||||
if [[ -f "${DORIS_CLANG_HOME}/bin/llvm-symbolizer" ]]; then
|
||||
export ASAN_SYMBOLIZER_PATH="${DORIS_CLANG_HOME}/bin/llvm-symbolizer"
|
||||
fi
|
||||
|
||||
covs=()
|
||||
while IFS='' read -r line; do covs+=("${line}"); done < <(find "${DORIS_CLANG_HOME}" -name "llvm-cov*")
|
||||
if [[ ${#covs[@]} -ge 1 ]]; then
|
||||
LLVM_COV="${covs[0]}"
|
||||
else
|
||||
LLVM_COV="$(command -v llvm-cov)"
|
||||
fi
|
||||
export LLVM_COV
|
||||
|
||||
profdatas=()
|
||||
while IFS='' read -r line; do profdatas+=("${line}"); done < <(find "${DORIS_CLANG_HOME}" -name "llvm-profdata*")
|
||||
if [[ ${#profdatas[@]} -ge 1 ]]; then
|
||||
LLVM_PROFDATA="${profdatas[0]}"
|
||||
else
|
||||
LLVM_PROFDATA="$(command -v llvm-profdata)"
|
||||
fi
|
||||
export LLVM_PROFDATA
|
||||
|
||||
if [[ -z "${ENABLE_PCH}" ]]; then
|
||||
ENABLE_PCH='ON'
|
||||
fi
|
||||
|
||||
@ -381,11 +381,20 @@ export JAVA_OPTS="-Xmx1024m -DlogPath=${DORIS_HOME}/log/jni.log -Xloggc:${DORIS_
|
||||
# find all executable test files
|
||||
test="${DORIS_TEST_BINARY_DIR}/doris_be_test"
|
||||
profraw=${DORIS_TEST_BINARY_DIR}/doris_be_test.profraw
|
||||
profdata=${DORIS_TEST_BINARY_DIR}/doris_be_test.profdata
|
||||
|
||||
file_name="${test##*/}"
|
||||
if [[ -f "${test}" ]]; then
|
||||
if [[ "_${DENABLE_CLANG_COVERAGE}" == "_ON" ]]; then
|
||||
LLVM_PROFILE_FILE="${profraw}" "${test}" --gtest_output="xml:${GTEST_OUTPUT_DIR}/${file_name}.xml" --gtest_print_time=true "${FILTER}"
|
||||
if [[ -d "${DORIS_TEST_BINARY_DIR}"/report ]]; then
|
||||
rm -rf "${DORIS_TEST_BINARY_DIR}"/report
|
||||
fi
|
||||
"${LLVM_PROFDATA} merge -o ${profdata} ${profraw}"
|
||||
"${LLVM_COV} show -output-dir=${DORIS_TEST_BINARY_DIR}/report -format=html \
|
||||
-ignore-filename-regex='(.*gensrc/.*)|(.*_test\.cpp$)|(.*be/test.*)|(.*apache-orc/.*)|(.*clucene/.*)' \
|
||||
-instr-profile=${profdata} \
|
||||
-object=${test}"
|
||||
else
|
||||
"${test}" --gtest_output="xml:${GTEST_OUTPUT_DIR}/${file_name}.xml" --gtest_print_time=true "${FILTER}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user