File: coverage.sh

package info (click to toggle)
wiredpanda 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,560 kB
  • sloc: cpp: 16,024; sh: 232; ansic: 52; xml: 8; makefile: 5; javascript: 1
file content (35 lines) | stat: -rw-r--r-- 1,211 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
30
31
32
33
34
35
#!/bin/bash
# Copyright 2015 - 2025, GIBIS-Unifesp and the wiRedPanda contributors
# SPDX-License-Identifier: GPL-3.0-or-later

set -e

echo "๐Ÿ” Building with coverage enabled..."
cmake -B build -G Ninja -DENABLE_COVERAGE=ON
cmake --build build --config Release

echo "๐Ÿงช Running tests with coverage collection..."
QT_QPA_PLATFORM=offscreen ./build/wiredpanda-test

echo "๐Ÿ“Š Generating coverage data..."
cd build
gcov -abcfu $(find . -name "*.gcno")

echo "๐Ÿ“„ Generating HTML coverage report..."
# Install lcov if not available
if ! command -v lcov &> /dev/null; then
    echo "Installing lcov..."
    sudo apt-get update && sudo apt-get install -y lcov
fi

# Generate lcov info file
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/test/*' '*/build/*' --output-file coverage_filtered.info

# Generate HTML report with dark theme
genhtml coverage_filtered.info --output-directory coverage_html --css-file ../lcov-dark-theme.css

echo "โœ… Coverage report generated!"
echo "๐Ÿ“‚ Open coverage_html/index.html in your browser to view the report"
echo "๐Ÿ“ Coverage data location: build/coverage.info"
echo "๐ŸŒ HTML report location: build/coverage_html/"