File: make-coverage-report.sh

package info (click to toggle)
visp 3.7.0-7
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 166,380 kB
  • sloc: cpp: 392,705; ansic: 224,448; xml: 23,444; python: 13,701; java: 4,792; sh: 206; objc: 145; makefile: 118
file content (29 lines) | stat: -rwxr-xr-x 1,278 bytes parent folder | download | duplicates (3)
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 -DCMAKE_BUILD_TYPE=Debug
cmake --build . --target all -j$(nproc)
cmake --build . --target test -j$(nproc)
lcov --directory . --ignore mismatch --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"