weston/coverage/meson.build
Pekka Paalanen 5fa20c75ca coverage: exclude assert branches
Assertions have two branches, and the fail branch must never be taken,
so it does not make sense to count them in branch coverage. Ignore all
branches on lines matching weston_assert_ regular expression.

The RE must match from the beginning of the line, hence allow leading
whitespace. This is a Python 're' module usage thing. Unfortunately it
is impossible to pass a backslash in a meson.build file as an argument
to a command[1], so let's use a configuration file.

[1]: https://github.com/mesonbuild/meson/issues/1564

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-06-10 14:11:27 +00:00

26 lines
642 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@',
'--config', files('gcovr.cfg'),
'--cobertura', meson.current_build_dir() / 'cobertura.xml',
'--html', meson.current_build_dir() / 'index.html',
meson.project_build_root(),
],
)