blob: 6a6db855bfd1a58e68c04b2d8df0a41f58c562a7 [file] [log] [blame]
Davide Pesavento4a315b32018-11-24 14:32:19 -05001#!/usr/bin/env bash
Davide Pesaventofee7ee32020-04-15 02:45:07 -04002set -ex
Davide Pesavento4a315b32018-11-24 14:32:19 -05003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento7243f852021-11-06 19:13:23 -04005 # 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
Davide Pesavento4a315b32018-11-24 14:32:19 -050015
Davide Pesavento90a632b2021-10-04 01:05:24 -040016 # Generate a detailed HTML report using lcov
Davide Pesavento4a315b32018-11-24 14:32:19 -050017 lcov --quiet \
18 --capture \
19 --directory . \
Davide Pesavento90a632b2021-10-04 01:05:24 -040020 --exclude "$PWD/tests/*" \
Davide Pesavento4a315b32018-11-24 14:32:19 -050021 --no-external \
22 --rc lcov_branch_coverage=1 \
Davide Pesavento4a315b32018-11-24 14:32:19 -050023 --output-file build/coverage.info
24
25 genhtml --branch-coverage \
26 --demangle-cpp \
Davide Pesavento4a315b32018-11-24 14:32:19 -050027 --legend \
Davide Pesavento90a632b2021-10-04 01:05:24 -040028 --output-directory build/lcov \
Davide Pesavento4a315b32018-11-24 14:32:19 -050029 --title "NDNS unit tests" \
30 build/coverage.info
31fi