Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 3 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
Davide Pesavento | 2c61bad | 2021-08-30 22:40:35 -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 | --exclude tests/ \ |
| 10 | --exclude websocketpp/ \ |
| 11 | --exclude-throw-branches \ |
| 12 | --exclude-unreachable-branches \ |
| 13 | --print-summary \ |
| 14 | --html-details build/gcovr/ \ |
| 15 | --xml build/coverage.xml |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 16 | |
Davide Pesavento | 2c61bad | 2021-08-30 22:40:35 -0400 | [diff] [blame] | 17 | # Generate a detailed HTML report using lcov |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 18 | lcov --quiet \ |
| 19 | --capture \ |
| 20 | --directory . \ |
Davide Pesavento | 2c61bad | 2021-08-30 22:40:35 -0400 | [diff] [blame] | 21 | --exclude "$PWD/tests/*" \ |
| 22 | --exclude "$PWD/websocketpp/*" \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 23 | --no-external \ |
| 24 | --rc lcov_branch_coverage=1 \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 25 | --output-file build/coverage.info |
| 26 | |
| 27 | genhtml --branch-coverage \ |
| 28 | --demangle-cpp \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 29 | --legend \ |
Davide Pesavento | 2c61bad | 2021-08-30 22:40:35 -0400 | [diff] [blame] | 30 | --output-directory build/lcov \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 31 | --title "NFD unit tests" \ |
| 32 | build/coverage.info |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 33 | fi |