Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 0771dc5 | 2025-03-25 01:15:30 -0400 | [diff] [blame^] | 2 | set -eo pipefail |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 3 | |
Davide Pesavento | 0771dc5 | 2025-03-25 01:15:30 -0400 | [diff] [blame^] | 4 | [[ $JOB_NAME == *code-coverage ]] || exit 0 |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 5 | |
Davide Pesavento | 0771dc5 | 2025-03-25 01:15:30 -0400 | [diff] [blame^] | 6 | export FORCE_COLOR=1 |
| 7 | export UV_NO_MANAGED_PYTHON=1 |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 8 | |
Davide Pesavento | 0771dc5 | 2025-03-25 01:15:30 -0400 | [diff] [blame^] | 9 | set -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! |
| 13 | uvx gcovr@5.2 \ |
| 14 | --object-directory build \ |
| 15 | --filter tools/ \ |
| 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 |
| 23 | lcov --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 | |
| 31 | genhtml --branch-coverage \ |
| 32 | --demangle-cpp \ |
| 33 | --legend \ |
| 34 | --output-directory build/lcov \ |
| 35 | --title "ndn-tools unit tests" \ |
| 36 | build/coverage.info |