blob: 236d4417e4c9a7f74e211d179a7c20c0123e6ccf [file] [log] [blame]
Davide Pesavento87d4e202020-08-09 01:18:52 -04001#!/usr/bin/env bash
Davide Pesaventoda1a4d32022-08-19 19:03:24 -04002set -exo pipefail
Davide Pesavento87d4e202020-08-09 01:18:52 -04003
4if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesaventof078fb52021-11-05 16:08:44 -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 Pesavento0ba5eb62022-04-19 18:05:16 -04007 gcovr --object-directory build \
Davide Pesaventof078fb52021-11-05 16:08:44 -04008 --filter PSync/ \
9 --exclude-throw-branches \
10 --exclude-unreachable-branches \
Davide Pesavento0ba5eb62022-04-19 18:05:16 -040011 --cobertura build/coverage.xml \
Davide Pesaventof078fb52021-11-05 16:08:44 -040012 --html-details build/gcovr/ \
Davide Pesavento0ba5eb62022-04-19 18:05:16 -040013 --print-summary
Davide Pesaventof078fb52021-11-05 16:08:44 -040014
Davide Pesavento8dce1942021-10-02 22:31:26 -040015 # Generate a detailed HTML report using lcov
Davide Pesavento87d4e202020-08-09 01:18:52 -040016 lcov --quiet \
17 --capture \
18 --directory . \
Davide Pesavento8dce1942021-10-02 22:31:26 -040019 --exclude "$PWD/tests/*" \
Davide Pesavento87d4e202020-08-09 01:18:52 -040020 --no-external \
21 --rc lcov_branch_coverage=1 \
Davide Pesavento87d4e202020-08-09 01:18:52 -040022 --output-file build/coverage.info
23
24 genhtml --branch-coverage \
25 --demangle-cpp \
26 --legend \
Davide Pesavento8dce1942021-10-02 22:31:26 -040027 --output-directory build/lcov \
Davide Pesavento87d4e202020-08-09 01:18:52 -040028 --title "PSync unit tests" \
29 build/coverage.info
30fi