Debian Codegraph @

tests/CI/processCoverage.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 CIDIR=$(dirname $(readlink -fn $0))
4 source $CIDIR/ci.functions
5
6 if [ ! -r main/asterisk.gcno ]; then
7 # Coverage is not enabled.
8 exit 0
9 fi
10
11 if [ -z $LCOV_DIR ]; then
12 LCOV_DIR="${OUTPUT_DIR:+${OUTPUT_DIR}/}lcov"
13 fi
14
15 if [ -z $COVERAGE_DIR ]; then
16 COVERAGE_DIR="${OUTPUT_DIR:+${OUTPUT_DIR}/}coverage"
17 fi
18
19 if [ -z $ASTERISK_VERSION ]; then
20 ASTERISK_VERSION=$(./build_tools/make_version .)
21 fi
22
23 set -x
24 # Capture counter data from testing
25 lcov --no-external --capture --directory . --output-file ${LCOV_DIR}/tested.info > /dev/null
26
27 # Combine initial and tested data.
28 lcov \
29 --add-tracefile ${LCOV_DIR}/initial.info \
30 --add-tracefile ${LCOV_DIR}/tested.info \
31 --output-file ${LCOV_DIR}/combined.info > /dev/null
32
33 # We don't care about coverage reporting for tests, utils or third-party.
34 lcov --remove ${LCOV_DIR}/combined.info \
35 "${PWD}/main/dns_test.*" \
36 "${PWD}/main/test.*" \
37 "${PWD}/tests/*" \
38 "${PWD}/utils/*" \
39 "${PWD}/third-party/*" \
40 --output-file ${LCOV_DIR}/filtered.info > /dev/null
41
42 # Generate HTML coverage report.
43 mkdir -p ${COVERAGE_DIR}
44 genhtml --prefix ${PWD} --ignore-errors source ${LCOV_DIR}/filtered.info \
45 --legend --title "Asterisk ${ASTERISK_VERSION}" --output-directory=${COVERAGE_DIR} > /dev/null