blob: 7ea2a913ba18bba61287f011f76305f74cb7cb9a [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
Davide Pesaventod8398822020-03-29 18:46:19 -04002set -ex
Davide Pesavento956ac312016-09-20 19:11:30 +02003
Eric Newberry716ab602016-12-29 21:49:57 -07004if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento956ac312016-09-20 19:11:30 +02005 gcovr --object-directory=build \
6 --output=build/coverage.xml \
Eric Newberry716ab602016-12-29 21:49:57 -07007 --exclude="$PWD/tests" \
Davide Pesavento956ac312016-09-20 19:11:30 +02008 --root=. \
9 --xml
Eric Newberry716ab602016-12-29 21:49:57 -070010
11 # Generate also a detailed HTML output, but using lcov (better results)
12 lcov --quiet \
Davide Pesavento931dfe82017-04-29 20:33:45 -040013 --capture \
Eric Newberry716ab602016-12-29 21:49:57 -070014 --directory . \
Davide Pesavento931dfe82017-04-29 20:33:45 -040015 --no-external \
Eric Newberry716ab602016-12-29 21:49:57 -070016 --rc lcov_branch_coverage=1 \
17 --output-file build/coverage-with-tests.info
18
19 lcov --quiet \
20 --remove build/coverage-with-tests.info "$PWD/tests/*" \
21 --rc lcov_branch_coverage=1 \
22 --output-file build/coverage.info
23
Davide Pesavento931dfe82017-04-29 20:33:45 -040024 genhtml --branch-coverage \
25 --demangle-cpp \
Davide Pesavento931dfe82017-04-29 20:33:45 -040026 --legend \
27 --output-directory build/coverage \
28 --title "ndn-tools unit tests" \
29 build/coverage.info
Davide Pesavento956ac312016-09-20 19:11:30 +020030fi