forked from asterisk/asterisk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add support for coverage processing.
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: I890f7d5665087426ad7d3e363187691b9afc2222
- Loading branch information
1 parent
a0426e1
commit addfc93
Showing
4 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters