weston/coverage/meson.build
Pekka Paalanen a2f6eb4fe2 build: add manual gcovr coverage report
Meson's 'coverage-html' target defaults to using the Perl script LCOV.
LCOV has problems with newer GCCs like 14 in Debian Trixie, leading to
many consistency errors about function end lines. Gcovr OTOH runs just
fine.

Create a new target

  $ meson compile gcovr-report

that creates a coverage report in HTML and Cobertura using gcovr.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-13 15:25:31 +02:00

29 lines
722 B
Meson

prog_gcovr = find_program('gcovr', required: false, disabler: true)
# Configure the build:
# $ meson configure -Db_sanitize=none -Db_coverage=true -Dwerror=true
#
# Ensure there are no stale .gcno or .gcda files around:
# $ meson setup --wipe ~/git/weston
#
# Run the test suite:
# $ meson compile
# $ meson test
#
# Generate the reports:
# $ meson compile gcovr-report
run_target(
'gcovr-report',
command: [
prog_gcovr,
'--root', '@SOURCE_ROOT@',
'--cobertura', meson.current_build_dir() / 'cobertura.xml',
'--html', meson.current_build_dir() / 'index.html',
'--html-nested',
'--html-theme', 'github.green',
'--html-title', 'Weston test suite coverage',
'--print-summary',
meson.build_root(),
],
)