blob: 846a14c24f74d73371d8179ab59fbf1ab887c459 [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
Davide Pesavento0771dc52025-03-25 01:15:30 -04002set -eo pipefail
Davide Pesavento956ac312016-09-20 19:11:30 +02003
Davide Pesavento0771dc52025-03-25 01:15:30 -04004[[ $JOB_NAME == *code-coverage ]] || exit 0
Eric Newberry716ab602016-12-29 21:49:57 -07005
Davide Pesavento0771dc52025-03-25 01:15:30 -04006export FORCE_COLOR=1
7export UV_NO_MANAGED_PYTHON=1
Eric Newberry716ab602016-12-29 21:49:57 -07008
Davide Pesavento0771dc52025-03-25 01:15:30 -04009set -x
10
Davide Pesavento65657272025-04-04 15:12:52 -040011# Generate a detailed HTML report and an XML report in Cobertura format using gcovr
Davide Pesavento0771dc52025-03-25 01:15:30 -040012# Note: trailing slashes are important in the paths below. Do not remove them!
Davide Pesavento65657272025-04-04 15:12:52 -040013uvx --from 'git+https://github.com/gcovr/gcovr@99b82e7' gcovr \
14 --decisions \
Davide Pesavento0771dc52025-03-25 01:15:30 -040015 --filter tools/ \
16 --exclude-throw-branches \
17 --exclude-unreachable-branches \
18 --cobertura build/coverage.xml \
19 --html-details build/gcovr/ \
Davide Pesavento65657272025-04-04 15:12:52 -040020 --txt-summary \
21 build
Davide Pesavento0771dc52025-03-25 01:15:30 -040022
23# Generate a detailed HTML report using lcov
Davide Pesavento65657272025-04-04 15:12:52 -040024lcov \
25 --quiet \
26 --capture \
27 --directory . \
28 --include "$PWD/tools/*" \
Davide Pesavento65657272025-04-04 15:12:52 -040029 --branch-coverage \
30 --rc no_exception_branch=1 \
Davide Pesaventoe158c1f2025-05-05 12:25:12 -040031 --ignore-errors inconsistent,mismatch,mismatch \
Davide Pesavento65657272025-04-04 15:12:52 -040032 --output-file build/coverage.info
Davide Pesavento0771dc52025-03-25 01:15:30 -040033
Davide Pesavento65657272025-04-04 15:12:52 -040034genhtml \
35 --quiet \
36 --branch-coverage \
37 --demangle-cpp \
38 --legend \
39 --missed \
40 --show-proportion \
41 --title "ndn-tools $(cat VERSION.info)" \
Davide Pesaventoe158c1f2025-05-05 12:25:12 -040042 --ignore-errors inconsistent,inconsistent \
Davide Pesavento65657272025-04-04 15:12:52 -040043 --output-directory build/lcov \
44 build/coverage.info