blob: 05418fa52d499a15abb06abb3acd364210e02a00 [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Davide Pesavento69857c32020-04-05 16:36:26 -04002set -ex
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00003
Davide Pesavento231ddd72016-09-02 22:20:00 +00004if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento2c61bad2021-08-30 22:40:35 -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 --exclude tests/ \
10 --exclude websocketpp/ \
11 --exclude-throw-branches \
12 --exclude-unreachable-branches \
13 --print-summary \
14 --html-details build/gcovr/ \
15 --xml build/coverage.xml
Davide Pesavento8d61c032017-04-29 20:06:33 -040016
Davide Pesavento2c61bad2021-08-30 22:40:35 -040017 # Generate a detailed HTML report using lcov
Davide Pesavento8d61c032017-04-29 20:06:33 -040018 lcov --quiet \
19 --capture \
20 --directory . \
Davide Pesavento2c61bad2021-08-30 22:40:35 -040021 --exclude "$PWD/tests/*" \
22 --exclude "$PWD/websocketpp/*" \
Davide Pesavento8d61c032017-04-29 20:06:33 -040023 --no-external \
24 --rc lcov_branch_coverage=1 \
Davide Pesavento8d61c032017-04-29 20:06:33 -040025 --output-file build/coverage.info
26
27 genhtml --branch-coverage \
28 --demangle-cpp \
Davide Pesavento8d61c032017-04-29 20:06:33 -040029 --legend \
Davide Pesavento2c61bad2021-08-30 22:40:35 -040030 --output-directory build/lcov \
Davide Pesavento8d61c032017-04-29 20:06:33 -040031 --title "NFD unit tests" \
32 build/coverage.info
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070033fi