blob: 0363b9e81f0dfa5de021966296686198d2adc70e [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 \
26 --frames \
27 --legend \
28 --output-directory build/coverage \
29 --title "ndn-cxx unit tests" \
30 build/coverage.info
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040031fi