blob: f4e876995d7c9f5799dc550b2e47aac139428317 [file] [log] [blame]
Davide Pesavento8f9d0622018-11-27 01:23:37 -05001#!/usr/bin/env bash
Davide Pesaventoec61b742020-04-18 01:00:12 -04002set -ex
Davide Pesavento8f9d0622018-11-27 01:23:37 -05003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento4ad5c462021-11-06 02:58:02 -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 Pesavento8f9d0622018-11-27 01:23:37 -050015
Davide Pesavento3c7f6452021-10-02 04:06:26 -040016 # Generate a detailed HTML report using lcov
Davide Pesavento8f9d0622018-11-27 01:23:37 -050017 lcov --quiet \
18 --capture \
19 --directory . \
Davide Pesavento3c7f6452021-10-02 04:06:26 -040020 --exclude "$PWD/tests/*" \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050021 --no-external \
22 --rc lcov_branch_coverage=1 \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050023 --output-file build/coverage.info
24
25 genhtml --branch-coverage \
26 --demangle-cpp \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050027 --legend \
Davide Pesavento3c7f6452021-10-02 04:06:26 -040028 --output-directory build/lcov \
Davide Pesaventoec61b742020-04-18 01:00:12 -040029 --title "ndn-nac unit tests" \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050030 build/coverage.info
31fi