blob: 1fa9669b0ffd62f83d0a7b549b63a9881acba3b6 [file] [log] [blame]
Zhiyi Zhang8617a792017-01-17 16:45:56 -08001#!/usr/bin/env bash
Davide Pesavento6d1b6722022-08-20 17:54:05 -04002set -exo pipefail
Zhiyi Zhang8617a792017-01-17 16:45:56 -08003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento725d3fc2021-11-19 23:37:03 -05005 # 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 Pesavento9d6d4382022-04-19 17:26:03 -04007 gcovr --object-directory build \
Davide Pesavento725d3fc2021-11-19 23:37:03 -05008 --filter src/ \
9 --exclude-throw-branches \
10 --exclude-unreachable-branches \
Davide Pesavento9d6d4382022-04-19 17:26:03 -040011 --cobertura build/coverage.xml \
Davide Pesavento725d3fc2021-11-19 23:37:03 -050012 --html-details build/gcovr/ \
Davide Pesavento9d6d4382022-04-19 17:26:03 -040013 --print-summary
Zhiyi Zhang8617a792017-01-17 16:45:56 -080014
Davide Pesavento725d3fc2021-11-19 23:37:03 -050015 # Generate a detailed HTML report using lcov
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050016 lcov --quiet \
17 --capture \
18 --directory . \
Davide Pesavento725d3fc2021-11-19 23:37:03 -050019 --exclude "$PWD/tests/*" \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050020 --no-external \
21 --rc lcov_branch_coverage=1 \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050022 --output-file build/coverage.info
23
24 genhtml --branch-coverage \
25 --demangle-cpp \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050026 --legend \
Davide Pesavento725d3fc2021-11-19 23:37:03 -050027 --output-directory build/lcov \
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050028 --title "ndncert unit tests" \
29 build/coverage.info
Zhiyi Zhang8617a792017-01-17 16:45:56 -080030fi