Enable to collect code coverage of samples/simple (#2003)
This commit is contained in:
@ -28,13 +28,14 @@ echo "Start to collect code coverage of ${SRC_COV_DIR} .."
|
||||
pushd ${SRC_COV_DIR} > /dev/null 2>&1
|
||||
|
||||
# collect all code coverage data
|
||||
lcov -o ${SRC_TEMP_COV_FILE} -c -d . --rc lcov_branch_coverage=1
|
||||
lcov -q -o ${SRC_TEMP_COV_FILE} -c -d . --rc lcov_branch_coverage=1
|
||||
# extract code coverage data of WAMR source files
|
||||
lcov -r ${SRC_TEMP_COV_FILE} -o ${SRC_TEMP_COV_FILE} \
|
||||
lcov -q -r ${SRC_TEMP_COV_FILE} -o ${SRC_TEMP_COV_FILE} \
|
||||
-rc lcov_branch_coverage=1 \
|
||||
"*/usr/*" "*/_deps/*" "*/deps/*" "*/tests/unit/*" \
|
||||
"*/llvm/include/*" "*/include/llvm/*" "*/samples/*" \
|
||||
"*/app-framework/*" "*/test-tools/*"
|
||||
"*/app-framework/*" "*/app-mgr/*" "*/test-tools/*" \
|
||||
"*/tests/standalone/*" "*/tests/*"
|
||||
|
||||
if [[ -s ${SRC_TEMP_COV_FILE} ]]; then
|
||||
if [[ -s ${DST_COV_FILE} ]]; then
|
||||
@ -46,9 +47,11 @@ if [[ -s ${SRC_TEMP_COV_FILE} ]]; then
|
||||
cp -a ${DST_COV_FILE} "${DST_COV_FILE}.orig"
|
||||
# replace the lcov file
|
||||
cp -a ${SRC_COV_FILE} ${DST_COV_FILE}
|
||||
echo "Code coverage file ${DST_COV_FILE} was appended"
|
||||
else
|
||||
cp -a ${SRC_TEMP_COV_FILE} ${SRC_COV_FILE}
|
||||
cp -a ${SRC_COV_FILE} ${DST_COV_FILE}
|
||||
echo "Code coverage file ${DST_COV_FILE} was generated"
|
||||
fi
|
||||
|
||||
# get ignored prefix path
|
||||
@ -59,7 +62,7 @@ if [[ -s ${SRC_TEMP_COV_FILE} ]]; then
|
||||
|
||||
# generate html output for merged code coverage data
|
||||
rm -fr ${DST_COV_DIR}/wamr-lcov
|
||||
genhtml -t "WAMR Code Coverage" \
|
||||
genhtml -q -t "WAMR Code Coverage" \
|
||||
--rc lcov_branch_coverage=1 --prefix=${prefix_full_path} \
|
||||
-o ${DST_COV_DIR}/wamr-lcov \
|
||||
${DST_COV_FILE}
|
||||
@ -69,7 +72,6 @@ if [[ -s ${SRC_TEMP_COV_FILE} ]]; then
|
||||
zip -r -q -o wamr-lcov.zip wamr-lcov
|
||||
rm -fr wamr-lcov
|
||||
|
||||
echo "Code coverage file ${DST_COV_FILE} was generated or appended"
|
||||
echo "Code coverage html ${DST_COV_DIR}/wamr-lcov.zip was generated"
|
||||
else
|
||||
echo "generate code coverage html failed"
|
||||
|
||||
@ -574,19 +574,64 @@ function malformed_test()
|
||||
./malformed_test.py --run ${IWASM_CMD} | tee ${REPORT_DIR}/malfomed_$1_test_report.txt
|
||||
}
|
||||
|
||||
function collect_standalone()
|
||||
{
|
||||
if [[ ${COLLECT_CODE_COVERAGE} == 1 ]]; then
|
||||
pushd ${WORK_DIR} > /dev/null 2>&1
|
||||
|
||||
CODE_COV_FILE=""
|
||||
if [[ -z "${CODE_COV_FILE}" ]]; then
|
||||
CODE_COV_FILE="${WORK_DIR}/wamr.lcov"
|
||||
else
|
||||
CODE_COV_FILE="${CODE_COV_FILE}"
|
||||
fi
|
||||
|
||||
STANDALONE_DIR=${WORK_DIR}/../../standalone
|
||||
|
||||
echo "Collect code coverage of standalone dump-call-stack"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/dump-call-stack/build"
|
||||
echo "Collect code coverage of standalone dump-mem-profiling"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/dump-mem-profiling/build"
|
||||
echo "Collect code coverage of standalone dump-perf-profiling"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/dump-perf-profiling/build"
|
||||
if [[ $1 == "aot" ]]; then
|
||||
echo "Collect code coverage of standalone pad-test"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/pad-test/build"
|
||||
fi
|
||||
echo "Collect code coverage of standalone test-invoke-native"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/test-invoke-native/build"
|
||||
echo "Collect code coverage of standalone test-running-modes"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/test-running-modes/build"
|
||||
echo "Collect code coverage of standalone test-running-modes/c-embed"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/test-running-modes/c-embed/build"
|
||||
echo "Collect code coverage of standalone test-ts2"
|
||||
./collect_coverage.sh "${CODE_COV_FILE}" "${STANDALONE_DIR}/test-ts2/build"
|
||||
|
||||
popd > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
function standalone_test()
|
||||
{
|
||||
if [[ ${COLLECT_CODE_COVERAGE} == 1 ]]; then
|
||||
export COLLECT_CODE_COVERAGE=1
|
||||
fi
|
||||
|
||||
cd ${WORK_DIR}/../../standalone
|
||||
|
||||
args="--$1"
|
||||
|
||||
[[ ${SGX_OPT} == "--sgx" ]] && args="$args --sgx" || args="$args --no-sgx"
|
||||
|
||||
[[ ${ENABLE_MULTI_THREAD} == 1 ]] && args="$args --thread" && args="$args --no-thread"
|
||||
[[ ${ENABLE_MULTI_THREAD} == 1 ]] && args="$args --thread" || args="$args --no-thread"
|
||||
|
||||
[[ ${ENABLE_SIMD} == 1 ]] && args="$args --simd" && args="$args --no-simd"
|
||||
[[ ${ENABLE_SIMD} == 1 ]] && args="$args --simd" || args="$args --no-simd"
|
||||
|
||||
args="$args ${TARGET}"
|
||||
|
||||
./standalone.sh $args | tee ${REPORT_DIR}/standalone_$1_test_report.txt
|
||||
|
||||
collect_standalone "$1"
|
||||
}
|
||||
|
||||
function build_iwasm_with_cfg()
|
||||
@ -648,10 +693,10 @@ function collect_coverage()
|
||||
ln -sf ${WORK_DIR}/../spec-test-script/collect_coverage.sh ${WORK_DIR}
|
||||
|
||||
CODE_COV_FILE=""
|
||||
if [[ -z "${COV_FILE}" ]]; then
|
||||
if [[ -z "${CODE_COV_FILE}" ]]; then
|
||||
CODE_COV_FILE="${WORK_DIR}/wamr.lcov"
|
||||
else
|
||||
CODE_COV_FILE="${COV_FILE}"
|
||||
CODE_COV_FILE="${CODE_COV_FILE}"
|
||||
fi
|
||||
|
||||
pushd ${WORK_DIR} > /dev/null 2>&1
|
||||
|
||||
Reference in New Issue
Block a user