blob: 2908b17e1406f7868ebf02e408cdb39635369acf [file] [log] [blame]
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -04001#!/usr/bin/env bash
Davide Pesaventof6be8e32020-04-30 16:06:03 -04002set -ex
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!
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
15
Davide Pesaventoba8a4ed2021-10-13 21:28:43 -040016 # Generate a detailed HTML report using lcov
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040017 lcov --quiet \
18 --capture \
19 --directory . \
Davide Pesaventoba8a4ed2021-10-13 21:28:43 -040020 --exclude "$PWD/tests/*" \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040021 --no-external \
22 --rc lcov_branch_coverage=1 \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040023 --output-file build/coverage.info
24
25 genhtml --branch-coverage \
26 --demangle-cpp \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040027 --legend \
Davide Pesaventoba8a4ed2021-10-13 21:28:43 -040028 --output-directory build/lcov \
Davide Pesavento6ebfd7c2017-08-26 17:52:54 -040029 --title "NLSR unit tests" \
30 build/coverage.info
31fi