blob: 7a6bea094afeda41e7d838f34408caeab863d06c [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 Pesavento90a632b2021-10-04 01:05:24 -04005 # Generate an XML report (Cobertura format) using gcovr
Davide Pesavento4a315b32018-11-24 14:32:19 -05006 gcovr --object-directory=build \
7 --output=build/coverage.xml \
8 --exclude="$PWD/tests" \
9 --root=. \
10 --xml
11
Davide Pesavento90a632b2021-10-04 01:05:24 -040012 # Generate a detailed HTML report using lcov
Davide Pesavento4a315b32018-11-24 14:32:19 -050013 lcov --quiet \
14 --capture \
15 --directory . \
Davide Pesavento90a632b2021-10-04 01:05:24 -040016 --exclude "$PWD/tests/*" \
Davide Pesavento4a315b32018-11-24 14:32:19 -050017 --no-external \
18 --rc lcov_branch_coverage=1 \
Davide Pesavento4a315b32018-11-24 14:32:19 -050019 --output-file build/coverage.info
20
21 genhtml --branch-coverage \
22 --demangle-cpp \
Davide Pesavento4a315b32018-11-24 14:32:19 -050023 --legend \
Davide Pesavento90a632b2021-10-04 01:05:24 -040024 --output-directory build/lcov \
Davide Pesavento4a315b32018-11-24 14:32:19 -050025 --title "NDNS unit tests" \
26 build/coverage.info
27fi