blob: a0e25e5264107497ad43683830e2152da6ff47f7 [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
Davide Pesaventod8398822020-03-29 18:46:19 -04002set -ex
Davide Pesavento956ac312016-09-20 19:11:30 +02003
Eric Newberry716ab602016-12-29 21:49:57 -07004if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento8c353902021-08-30 19:10:36 -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 tools/ \
10 --exclude-throw-branches \
11 --exclude-unreachable-branches \
12 --print-summary \
13 --html-details build/gcovr/ \
14 --xml build/coverage.xml
Eric Newberry716ab602016-12-29 21:49:57 -070015
Davide Pesavento8c353902021-08-30 19:10:36 -040016 # Generate a detailed HTML report using lcov
Eric Newberry716ab602016-12-29 21:49:57 -070017 lcov --quiet \
Davide Pesavento931dfe82017-04-29 20:33:45 -040018 --capture \
Eric Newberry716ab602016-12-29 21:49:57 -070019 --directory . \
Davide Pesavento8c353902021-08-30 19:10:36 -040020 --exclude "$PWD/tests/*" \
Davide Pesavento931dfe82017-04-29 20:33:45 -040021 --no-external \
Eric Newberry716ab602016-12-29 21:49:57 -070022 --rc lcov_branch_coverage=1 \
Eric Newberry716ab602016-12-29 21:49:57 -070023 --output-file build/coverage.info
24
Davide Pesavento931dfe82017-04-29 20:33:45 -040025 genhtml --branch-coverage \
26 --demangle-cpp \
Davide Pesavento931dfe82017-04-29 20:33:45 -040027 --legend \
Davide Pesavento8c353902021-08-30 19:10:36 -040028 --output-directory build/lcov \
Davide Pesavento931dfe82017-04-29 20:33:45 -040029 --title "ndn-tools unit tests" \
30 build/coverage.info
Davide Pesavento956ac312016-09-20 19:11:30 +020031fi