blob: 2ff210e3eb620623e5f1dd90fb8f0edb78f1e6fe [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
5 gcovr --object-directory=build \
6 --output=build/coverage.xml \
Davide Pesaventocf8a3682018-11-24 19:52:21 -05007 --exclude="$PWD/(examples|tests)" \
Davide Pesavento09348882016-09-17 02:39:44 +02008 --root=. \
9 --xml
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080010
11 # Generate also a detailed HTML output, but using lcov (better results)
12 lcov --quiet \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040013 --capture \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080014 --directory . \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040015 --no-external \
Alexander Afanasyeve19643d2017-01-15 23:56:32 -080016 --rc lcov_branch_coverage=1 \
17 --output-file build/coverage-with-tests.info
18
19 lcov --quiet \
20 --remove build/coverage-with-tests.info "$PWD/tests/*" \
21 --rc lcov_branch_coverage=1 \
22 --output-file build/coverage.info
23
Davide Pesaventoc44cc832017-04-03 22:11:48 -040024 genhtml --branch-coverage \
25 --demangle-cpp \
Davide Pesaventoc44cc832017-04-03 22:11:48 -040026 --legend \
27 --output-directory build/coverage \
28 --title "ndn-cxx unit tests" \
29 build/coverage.info
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040030fi