blob: a38ed0bcc799b8b19fe12a9c2c37b6c72d53038b [file] [log] [blame]
Zhiyi Zhang8617a792017-01-17 16:45:56 -08001#!/usr/bin/env bash
Davide Pesavento552174c2020-04-16 01:54:08 -04002set -ex
Zhiyi Zhang8617a792017-01-17 16:45:56 -08003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento725d3fc2021-11-19 23:37:03 -05005 # Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
6 # Note: trailing slashes are important in the paths below. Do not remove them!
7 gcovr -j$WAF_JOBS \
8 --object-directory build \
9 --filter src/ \
10 --exclude-throw-branches \
11 --exclude-unreachable-branches \
12 --print-summary \
13 --html-details build/gcovr/ \
14 --xml build/coverage.xml
Zhiyi Zhang8617a792017-01-17 16:45:56 -080015
Davide Pesavento725d3fc2021-11-19 23:37:03 -050016 # Generate a detailed HTML report using lcov
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050017 lcov --quiet \
18 --capture \
19 --directory . \
Davide Pesavento725d3fc2021-11-19 23:37:03 -050020 --exclude "$PWD/tests/*" \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050021 --no-external \
22 --rc lcov_branch_coverage=1 \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050023 --output-file build/coverage.info
24
25 genhtml --branch-coverage \
26 --demangle-cpp \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050027 --legend \
Davide Pesavento725d3fc2021-11-19 23:37:03 -050028 --output-directory build/lcov \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050029 --title "ndncert unit tests" \
30 build/coverage.info
Zhiyi Zhang8617a792017-01-17 16:45:56 -080031fi