blob: c758aaa4da1bf4b636cb778c4cff50603bff3f35 [file] [log] [blame]
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -04001#!/usr/bin/env bash
Davide Pesaventoede59632022-08-26 20:35:44 -04002set -exo pipefail
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -04003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesaventocf148072021-11-06 19:38:01 -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!
Davide Pesavento583473a2022-04-20 13:23:06 -04007 gcovr --object-directory build \
Davide Pesaventocf148072021-11-06 19:38:01 -04008 --filter src/ \
9 --exclude-throw-branches \
10 --exclude-unreachable-branches \
Davide Pesavento583473a2022-04-20 13:23:06 -040011 --cobertura build/coverage.xml \
Davide Pesaventocf148072021-11-06 19:38:01 -040012 --html-details build/gcovr/ \
Davide Pesavento583473a2022-04-20 13:23:06 -040013 --print-summary
Davide Pesaventocf148072021-11-06 19:38:01 -040014
Davide Pesaventoba8a4ed2021-10-13 21:28:43 -040015 # Generate a detailed HTML report using lcov
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040016 lcov --quiet \
17 --capture \
18 --directory . \
Davide Pesaventoba8a4ed2021-10-13 21:28:43 -040019 --exclude "$PWD/tests/*" \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040020 --no-external \
21 --rc lcov_branch_coverage=1 \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040022 --output-file build/coverage.info
23
24 genhtml --branch-coverage \
25 --demangle-cpp \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040026 --legend \
Davide Pesaventoba8a4ed2021-10-13 21:28:43 -040027 --output-directory build/lcov \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040028 --title "NLSR unit tests" \
29 build/coverage.info
30fi