blob: b3e3022cb502a728c5c14939202800f1454ddcbc [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!
Davide Pesavento6153eaf2022-04-19 19:45:03 -04007 gcovr --object-directory build \
Davide Pesavento2c61bad2021-08-30 22:40:35 -04008 --exclude tests/ \
9 --exclude websocketpp/ \
10 --exclude-throw-branches \
11 --exclude-unreachable-branches \
Davide Pesavento6153eaf2022-04-19 19:45:03 -040012 --cobertura build/coverage.xml \
Davide Pesavento2c61bad2021-08-30 22:40:35 -040013 --html-details build/gcovr/ \
Davide Pesavento6153eaf2022-04-19 19:45:03 -040014 --print-summary
Davide Pesavento8d61c032017-04-29 20:06:33 -040015
Davide Pesavento2c61bad2021-08-30 22:40:35 -040016 # Generate a detailed HTML report using lcov
Davide Pesavento8d61c032017-04-29 20:06:33 -040017 lcov --quiet \
18 --capture \
19 --directory . \
Davide Pesavento2c61bad2021-08-30 22:40:35 -040020 --exclude "$PWD/tests/*" \
21 --exclude "$PWD/websocketpp/*" \
Davide Pesavento8d61c032017-04-29 20:06:33 -040022 --no-external \
23 --rc lcov_branch_coverage=1 \
Davide Pesavento8d61c032017-04-29 20:06:33 -040024 --output-file build/coverage.info
25
26 genhtml --branch-coverage \
27 --demangle-cpp \
Davide Pesavento8d61c032017-04-29 20:06:33 -040028 --legend \
Davide Pesavento2c61bad2021-08-30 22:40:35 -040029 --output-directory build/lcov \
Davide Pesavento8d61c032017-04-29 20:06:33 -040030 --title "NFD unit tests" \
31 build/coverage.info
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070032fi