Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 2 | set -eo pipefail |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 3 | |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 4 | [[ $JOB_NAME == *code-coverage ]] || exit 0 |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 5 | |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 6 | export FORCE_COLOR=1 |
| 7 | export UV_NO_MANAGED_PYTHON=1 |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 8 | |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 9 | set -x |
| 10 | |
Davide Pesavento | 1c92524 | 2025-04-03 14:32:36 -0400 | [diff] [blame^] | 11 | # Generate a detailed HTML report and an XML report in Cobertura format using gcovr |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 12 | # Note: trailing slashes are important in the paths below. Do not remove them! |
Davide Pesavento | 1c92524 | 2025-04-03 14:32:36 -0400 | [diff] [blame^] | 13 | uvx --from 'git+https://github.com/gcovr/gcovr@99b82e7' gcovr \ |
| 14 | --decisions \ |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 15 | --filter ndn-cxx/ \ |
| 16 | --exclude ndn-cxx/detail/nonstd/ \ |
| 17 | --exclude-throw-branches \ |
| 18 | --exclude-unreachable-branches \ |
| 19 | --cobertura build/coverage.xml \ |
| 20 | --html-details build/gcovr/ \ |
Davide Pesavento | 1c92524 | 2025-04-03 14:32:36 -0400 | [diff] [blame^] | 21 | --txt-summary \ |
| 22 | build |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 23 | |
| 24 | # Generate a detailed HTML report using lcov |
Davide Pesavento | 1c92524 | 2025-04-03 14:32:36 -0400 | [diff] [blame^] | 25 | lcov \ |
| 26 | --quiet \ |
| 27 | --capture \ |
| 28 | --directory . \ |
| 29 | --include "$PWD/ndn-cxx/*" \ |
| 30 | --exclude "$PWD/ndn-cxx/detail/nonstd/*" \ |
| 31 | --ignore-errors count,inconsistent \ |
| 32 | --branch-coverage \ |
| 33 | --rc no_exception_branch=1 \ |
| 34 | --output-file build/coverage.info |
Davide Pesavento | ee3ebeb | 2025-03-21 22:08:02 -0400 | [diff] [blame] | 35 | |
Davide Pesavento | 1c92524 | 2025-04-03 14:32:36 -0400 | [diff] [blame^] | 36 | genhtml \ |
| 37 | --quiet \ |
| 38 | --branch-coverage \ |
| 39 | --demangle-cpp \ |
| 40 | --legend \ |
| 41 | --missed \ |
| 42 | --show-proportion \ |
| 43 | --title "ndn-cxx $(cat VERSION.info)" \ |
| 44 | --output-directory build/lcov \ |
| 45 | build/coverage.info |