blob: 9c946b81161832aefff101623d513afb96efca31 [file] [log] [blame]
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04001#!/usr/bin/env bash
Davide Pesavento2349e282020-03-24 14:28:03 -04002set -ex
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!
7 gcovr -j$WAF_JOBS \
8 --object-directory build \
9 --filter ndn-cxx/ \
10 --exclude ndn-cxx/detail/nonstd/ \
11 --exclude-throw-branches \
12 --exclude-unreachable-branches \
13 --print-summary \
14 --html-details build/gcovr/ \
15 --xml build/coverage.xml
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080016
Davide Pesavento09d56622021-08-23 17:44:25 -040017 # Generate a detailed HTML report using lcov
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080018 lcov --quiet \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040019 --capture \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080020 --directory . \
Davide Pesavento09d56622021-08-23 17:44:25 -040021 --exclude "$PWD/ndn-cxx/detail/nonstd/*" \
22 --exclude "$PWD/tests/*" \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040023 --no-external \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080024 --rc lcov_branch_coverage=1 \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080025 --output-file build/coverage.info
26
Davide Pesaventoc44cc832017-04-03 22:11:48 -040027 genhtml --branch-coverage \
28 --demangle-cpp \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040029 --legend \
Davide Pesavento09d56622021-08-23 17:44:25 -040030 --output-directory build/lcov \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040031 --title "ndn-cxx unit tests" \
32 build/coverage.info
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040033fi