blob: 4ee9510e0651ddbdf994024f7a789ad78db5799d [file] [log] [blame]
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04001#!/usr/bin/env bash
Davide Pesavento73e946e2022-08-06 16:44:54 -04002set -exo pipefail
Davide Pesavento09348882016-09-17 02:39:44 +02003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento09d56622021-08-23 17:44:25 -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 Pesavento5b4b27f2022-04-19 16:31:03 -04007 gcovr --object-directory build \
Davide Pesavento09d56622021-08-23 17:44:25 -04008 --filter ndn-cxx/ \
9 --exclude ndn-cxx/detail/nonstd/ \
10 --exclude-throw-branches \
11 --exclude-unreachable-branches \
Davide Pesavento5b4b27f2022-04-19 16:31:03 -040012 --cobertura build/coverage.xml \
Davide Pesavento09d56622021-08-23 17:44:25 -040013 --html-details build/gcovr/ \
Davide Pesavento5b4b27f2022-04-19 16:31:03 -040014 --print-summary
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080015
Davide Pesavento09d56622021-08-23 17:44:25 -040016 # Generate a detailed HTML report using lcov
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080017 lcov --quiet \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040018 --capture \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080019 --directory . \
Davide Pesavento09d56622021-08-23 17:44:25 -040020 --exclude "$PWD/ndn-cxx/detail/nonstd/*" \
21 --exclude "$PWD/tests/*" \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040022 --no-external \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080023 --rc lcov_branch_coverage=1 \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080024 --output-file build/coverage.info
25
Davide Pesaventoc44cc832017-04-03 22:11:48 -040026 genhtml --branch-coverage \
27 --demangle-cpp \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040028 --legend \
Davide Pesavento09d56622021-08-23 17:44:25 -040029 --output-directory build/lcov \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040030 --title "ndn-cxx unit tests" \
31 build/coverage.info
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040032fi