Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | fee7ee3 | 2020-04-15 02:45:07 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 3 | |
| 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
Davide Pesavento | 7243f85 | 2021-11-06 19:13:23 -0400 | [diff] [blame^] | 5 | # 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! |
| 7 | gcovr -j$WAF_JOBS \ |
| 8 | --object-directory build \ |
| 9 | --filter src/ \ |
| 10 | --exclude-throw-branches \ |
| 11 | --exclude-unreachable-branches \ |
| 12 | --print-summary \ |
| 13 | --html-details build/gcovr/ \ |
| 14 | --xml build/coverage.xml |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 15 | |
Davide Pesavento | 90a632b | 2021-10-04 01:05:24 -0400 | [diff] [blame] | 16 | # Generate a detailed HTML report using lcov |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 17 | lcov --quiet \ |
| 18 | --capture \ |
| 19 | --directory . \ |
Davide Pesavento | 90a632b | 2021-10-04 01:05:24 -0400 | [diff] [blame] | 20 | --exclude "$PWD/tests/*" \ |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 21 | --no-external \ |
| 22 | --rc lcov_branch_coverage=1 \ |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 23 | --output-file build/coverage.info |
| 24 | |
| 25 | genhtml --branch-coverage \ |
| 26 | --demangle-cpp \ |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 27 | --legend \ |
Davide Pesavento | 90a632b | 2021-10-04 01:05:24 -0400 | [diff] [blame] | 28 | --output-directory build/lcov \ |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 29 | --title "NDNS unit tests" \ |
| 30 | build/coverage.info |
| 31 | fi |