blob: aae00f5a76ce79494d2117fbe1ef497dfbd67f5e [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
Davide Pesaventobd3642f2022-08-12 18:19:31 -04002set -exo pipefail
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!
Davide Pesavento824c45b2022-04-03 18:30:41 -04007 gcovr --object-directory build \
Davide Pesavento8c353902021-08-30 19:10:36 -04008 --filter tools/ \
9 --exclude-throw-branches \
10 --exclude-unreachable-branches \
Davide Pesavento824c45b2022-04-03 18:30:41 -040011 --cobertura build/coverage.xml \
Davide Pesavento8c353902021-08-30 19:10:36 -040012 --html-details build/gcovr/ \
Davide Pesavento824c45b2022-04-03 18:30:41 -040013 --print-summary
Eric Newberry716ab602016-12-29 21:49:57 -070014
Davide Pesavento8c353902021-08-30 19:10:36 -040015 # Generate a detailed HTML report using lcov
Eric Newberry716ab602016-12-29 21:49:57 -070016 lcov --quiet \
Davide Pesavento931dfe82017-04-29 20:33:45 -040017 --capture \
Eric Newberry716ab602016-12-29 21:49:57 -070018 --directory . \
Davide Pesavento8c353902021-08-30 19:10:36 -040019 --exclude "$PWD/tests/*" \
Davide Pesavento931dfe82017-04-29 20:33:45 -040020 --no-external \
Eric Newberry716ab602016-12-29 21:49:57 -070021 --rc lcov_branch_coverage=1 \
Eric Newberry716ab602016-12-29 21:49:57 -070022 --output-file build/coverage.info
23
Davide Pesavento931dfe82017-04-29 20:33:45 -040024 genhtml --branch-coverage \
25 --demangle-cpp \
Davide Pesavento931dfe82017-04-29 20:33:45 -040026 --legend \
Davide Pesavento8c353902021-08-30 19:10:36 -040027 --output-directory build/lcov \
Davide Pesavento931dfe82017-04-29 20:33:45 -040028 --title "ndn-tools unit tests" \
29 build/coverage.info
Davide Pesavento956ac312016-09-20 19:11:30 +020030fi