Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 2 | set -e |
| 3 | |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 6 | |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 7 | set -x |
| 8 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 9 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
Davide Pesavento | 0a5e5e2 | 2016-09-13 18:29:33 +0000 | [diff] [blame] | 10 | gcovr --object-directory=build \ |
| 11 | --output=build/coverage.xml \ |
Alexander Afanasyev | 465056e | 2016-12-29 16:43:01 -0800 | [diff] [blame] | 12 | --exclude="$PWD/(tests|websocketpp)" \ |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 13 | --root=. \ |
Davide Pesavento | 0a5e5e2 | 2016-09-13 18:29:33 +0000 | [diff] [blame] | 14 | --xml |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 15 | |
| 16 | # Generate also a detailed HTML output, but using lcov (better results) |
| 17 | lcov --quiet \ |
| 18 | --capture \ |
| 19 | --directory . \ |
| 20 | --no-external \ |
| 21 | --rc lcov_branch_coverage=1 \ |
Davide Pesavento | 221f53b | 2017-06-04 17:17:31 -0400 | [diff] [blame^] | 22 | --output-file build/coverage-with-tests-and-websocketpp.info |
| 23 | |
| 24 | lcov --quiet \ |
| 25 | --remove build/coverage-with-tests-and-websocketpp.info "$PWD/websocketpp/*" \ |
| 26 | --rc lcov_branch_coverage=1 \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 27 | --output-file build/coverage-with-tests.info |
| 28 | |
| 29 | lcov --quiet \ |
| 30 | --remove build/coverage-with-tests.info "$PWD/tests/*" \ |
| 31 | --rc lcov_branch_coverage=1 \ |
| 32 | --output-file build/coverage.info |
| 33 | |
| 34 | genhtml --branch-coverage \ |
| 35 | --demangle-cpp \ |
| 36 | --frames \ |
| 37 | --legend \ |
| 38 | --output-directory build/coverage \ |
| 39 | --title "NFD unit tests" \ |
| 40 | build/coverage.info |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 41 | fi |