blob: 2c8ce8270b9ee94d76276dd72a547ed3d9cd437f [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
2set -e
3
4JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
7set -x
8
Eric Newberry716ab602016-12-29 21:49:57 -07009if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento956ac312016-09-20 19:11:30 +020010 gcovr --object-directory=build \
11 --output=build/coverage.xml \
Eric Newberry716ab602016-12-29 21:49:57 -070012 --exclude="$PWD/tests" \
Davide Pesavento956ac312016-09-20 19:11:30 +020013 --root=. \
14 --xml
Eric Newberry716ab602016-12-29 21:49:57 -070015
16 # Generate also a detailed HTML output, but using lcov (better results)
17 lcov --quiet \
Davide Pesavento931dfe82017-04-29 20:33:45 -040018 --capture \
Eric Newberry716ab602016-12-29 21:49:57 -070019 --directory . \
Davide Pesavento931dfe82017-04-29 20:33:45 -040020 --no-external \
Eric Newberry716ab602016-12-29 21:49:57 -070021 --rc lcov_branch_coverage=1 \
22 --output-file build/coverage-with-tests.info
23
24 lcov --quiet \
25 --remove build/coverage-with-tests.info "$PWD/tests/*" \
26 --rc lcov_branch_coverage=1 \
27 --output-file build/coverage.info
28
Davide Pesavento931dfe82017-04-29 20:33:45 -040029 genhtml --branch-coverage \
30 --demangle-cpp \
31 --frames \
32 --legend \
33 --output-directory build/coverage \
34 --title "ndn-tools unit tests" \
35 build/coverage.info
Davide Pesavento956ac312016-09-20 19:11:30 +020036fi