blob: decff99c44d21e253fa4b4afb5f773138219db67 [file] [log] [blame]
Davide Pesavento4a315b32018-11-24 14:32:19 -05001#!/usr/bin/env bash
Davide Pesavento679c42a2025-03-25 20:50:03 -04002set -eo pipefail
Davide Pesavento4a315b32018-11-24 14:32:19 -05003
Davide Pesavento679c42a2025-03-25 20:50:03 -04004[[ $JOB_NAME == *code-coverage ]] || exit 0
Davide Pesavento4a315b32018-11-24 14:32:19 -05005
Davide Pesavento679c42a2025-03-25 20:50:03 -04006export FORCE_COLOR=1
7export UV_NO_MANAGED_PYTHON=1
Davide Pesavento4a315b32018-11-24 14:32:19 -05008
Davide Pesavento679c42a2025-03-25 20:50:03 -04009set -x
10
11# Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
12# Note: trailing slashes are important in the paths below. Do not remove them!
13uvx gcovr@5.2 \
14 --object-directory build \
15 --filter src/ \
16 --exclude-throw-branches \
17 --exclude-unreachable-branches \
18 --cobertura build/coverage.xml \
19 --html-details build/gcovr/ \
20 --print-summary
21
22# Generate a detailed HTML report using lcov
23lcov --quiet \
24 --capture \
25 --directory . \
26 --exclude "$PWD/tests/*" \
27 --no-external \
28 --rc lcov_branch_coverage=1 \
29 --output-file build/coverage.info
30
31genhtml --branch-coverage \
32 --demangle-cpp \
33 --legend \
34 --output-directory build/lcov \
35 --title "NDNS unit tests" \
36 build/coverage.info