File: run_coverage.sh

package info (click to toggle)
cupt 2.10.4%2Bnmu1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 3,144 kB
  • sloc: cpp: 23,642; perl: 1,599; sh: 40; makefile: 19
file content (36 lines) | stat: -rwxr-xr-x 838 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

OUTPUT=lcov.output.info

set -e
set -x

ABSOLUTE_SOURCE_ROOT_PATH=`git rev-parse --show-toplevel`/cpp

CAPTURE_OPTIONS="--directory . --base-directory "$ABSOLUTE_SOURCE_ROOT_PATH" --no-external"

if [ -z "$ONLY_CAPTURE" ]; then
	# recompile
	CXXFLAGS=-coverage cmake ../..
	make

	# clean leftovers from previous tests
	lcov --directory . --zerocounters

	# gather all source files
	lcov $CAPTURE_OPTIONS --capture --initial --output-file ${OUTPUT}.initial.base
	lcov --remove ${OUTPUT}.initial.base '*CMake*Compiler*' --output-file ${OUTPUT}.initial

	# test
	make test
fi

# capture
lcov $CAPTURE_OPTIONS --capture --output-file ${OUTPUT}.tests

# combine
lcov -a ${OUTPUT}.initial -a ${OUTPUT}.tests -o $OUTPUT

# visualise
genhtml --output-directory html --prefix $ABSOLUTE_SOURCE_ROOT_PATH $OUTPUT --no-function-coverage