mirror of https://github.com/asterisk/asterisk
Enable coverage with `./tests/CI/buildAsterisk.sh --coverage`. This will cause Asterisk to be compiled with coverage support. It also initializes 'before' coverage data for all sources. Accept --tested-only to disable modules which are not run by any test. Enabling coverage also sets tested-only true by default. To build everything with coverage enabled use `--coverage --tested-only=0`. ./tests/CI/processCoverage.sh is used to process the coverage and generate HTML reports. Fix utils/check_expr2 which failed to compiled with coverage enabled. Add status output 5 times per stage of astobj2_test_perf to ensure remote CLI does not timeout when compiled with coverage. Remote CLI disconnects if no output is received for 60 seconds. When coverage is enabled it takes about 70 seconds for my laptop to run the stages of this test, so with the change a message is printed every 14 seconds. Change-Id: I890f7d5665087426ad7d3e363187691b9afc2222pull/11/head
parent
a0426e136b
commit
addfc93815
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CIDIR=$(dirname $(readlink -fn $0))
|
||||
source $CIDIR/ci.functions
|
||||
|
||||
if [ ! -r main/asterisk.gcno ]; then
|
||||
# Coverage is not enabled.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z $LCOV_DIR ]; then
|
||||
LCOV_DIR="${OUTPUT_DIR:+${OUTPUT_DIR}/}lcov"
|
||||
fi
|
||||
|
||||
if [ -z $COVERAGE_DIR ]; then
|
||||
COVERAGE_DIR="${OUTPUT_DIR:+${OUTPUT_DIR}/}coverage"
|
||||
fi
|
||||
|
||||
if [ -z $ASTERISK_VERSION ]; then
|
||||
ASTERISK_VERSION=$(./build_tools/make_version .)
|
||||
fi
|
||||
|
||||
set -x
|
||||
# Capture counter data from testing
|
||||
lcov --no-external --capture --directory . --output-file ${LCOV_DIR}/tested.info > /dev/null
|
||||
|
||||
# Combine initial and tested data.
|
||||
lcov \
|
||||
--add-tracefile ${LCOV_DIR}/initial.info \
|
||||
--add-tracefile ${LCOV_DIR}/tested.info \
|
||||
--output-file ${LCOV_DIR}/combined.info > /dev/null
|
||||
|
||||
# We don't care about coverage reporting for tests, utils or third-party.
|
||||
lcov --remove ${LCOV_DIR}/combined.info \
|
||||
"${PWD}/main/dns_test.*" \
|
||||
"${PWD}/main/test.*" \
|
||||
"${PWD}/tests/*" \
|
||||
"${PWD}/utils/*" \
|
||||
"${PWD}/third-party/*" \
|
||||
--output-file ${LCOV_DIR}/filtered.info > /dev/null
|
||||
|
||||
# Generate HTML coverage report.
|
||||
mkdir -p ${COVERAGE_DIR}
|
||||
genhtml --prefix ${PWD} --ignore-errors source ${LCOV_DIR}/filtered.info \
|
||||
--legend --title "Asterisk ${ASTERISK_VERSION}" --output-directory=${COVERAGE_DIR} > /dev/null
|
Loading…
Reference in new issue