File: make-coverage-report.sh

package info (click to toggle)
visp 3.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 119,296 kB
  • sloc: cpp: 500,914; ansic: 52,904; xml: 22,642; python: 7,365; java: 4,247; sh: 482; makefile: 237; objc: 145
file content (29 lines) | stat: -rwxr-xr-x 1,235 bytes parent folder | download
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
# usage: $ script/make-coverage-report.sh path/to/build
# CMake should already have been run once in the build folder, with BUILD_COVERAGE turned on

if test "$#" -ne 1; then
  echo "Script should take the path to the build directory as input, and should be started from the root of the visp source directory"
  exit 1
fi

source_dir=`pwd`
build_dir=$1

if test -d $build_dir; then
  echo "Build directory exists: $build_dir"
else
  echo "Create build directory: $build_dir"
  mkdir -p $build_dir
fi

cd $build_dir
lcov --zerocounters --directory .
cmake $source_dir -DBUILD_COVERAGE=ON -DBUILD_DEPRECATED_FUNCTIONS=OFF
cmake --build . --target all -j$(nproc)
cmake --build . --target test -j$(nproc)
lcov --directory . --capture --output-file visp-coverage.info
lcov --remove visp-coverage.info '/usr/*' '*/private/*' '*/test/*' "$source_dir/3rdparty/*" "$source_dir/demo/*" "$source_dir/example/*" "$source_dir/samples/*" "$source_dir/modules/gui*" "$source_dir/modules/io/src/parallel-port*" "$source_dir/modules/robot*" "$source_dir/modules/sensor*" --output-file visp-coverage.cleaned
genhtml visp-coverage.cleaned -o coverage

echo "Detected source directory: $source_dir"
echo "Coverage report generated in $build_dir/coverage"