blob: e71deeddd542fca762663ff7a0c4287dc723f401 [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!
Davide Pesaventobde084f2022-04-17 00:21:35 -04007 gcovr --object-directory build \
Davide Pesavento4ad5c462021-11-06 02:58:02 -04008 --filter src/ \
9 --exclude-throw-branches \
10 --exclude-unreachable-branches \
Davide Pesaventobde084f2022-04-17 00:21:35 -040011 --cobertura build/coverage.xml \
Davide Pesavento4ad5c462021-11-06 02:58:02 -040012 --html-details build/gcovr/ \
Davide Pesaventobde084f2022-04-17 00:21:35 -040013 --print-summary
Davide Pesavento8f9d0622018-11-27 01:23:37 -050014
Davide Pesavento3c7f6452021-10-02 04:06:26 -040015 # Generate a detailed HTML report using lcov
Davide Pesavento8f9d0622018-11-27 01:23:37 -050016 lcov --quiet \
17 --capture \
18 --directory . \
Davide Pesavento3c7f6452021-10-02 04:06:26 -040019 --exclude "$PWD/tests/*" \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050020 --no-external \
21 --rc lcov_branch_coverage=1 \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050022 --output-file build/coverage.info
23
24 genhtml --branch-coverage \
25 --demangle-cpp \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050026 --legend \
Davide Pesavento3c7f6452021-10-02 04:06:26 -040027 --output-directory build/lcov \
Davide Pesaventoec61b742020-04-18 01:00:12 -040028 --title "ndn-nac unit tests" \
Davide Pesavento8f9d0622018-11-27 01:23:37 -050029 build/coverage.info
30fi