From 5fa20c75ca7fe2d4f684eb73dbc9fa558c35e01b Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 17 Apr 2026 16:29:42 +0300 Subject: [PATCH] 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 --- coverage/gcovr.cfg | 5 +++++ coverage/meson.build | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 coverage/gcovr.cfg diff --git a/coverage/gcovr.cfg b/coverage/gcovr.cfg new file mode 100644 index 000000000..4ec590674 --- /dev/null +++ b/coverage/gcovr.cfg @@ -0,0 +1,5 @@ +exclude-branches-by-pattern = \s*(?:weston_assert_) +html-nested = yes +html-theme = github.green +html-title = Weston test suite coverage +print-summary = yes diff --git a/coverage/meson.build b/coverage/meson.build index 1a537a66a..99b64d456 100644 --- a/coverage/meson.build +++ b/coverage/meson.build @@ -18,12 +18,9 @@ run_target( command: [ prog_gcovr, '--root', '@SOURCE_ROOT@', + '--config', files('gcovr.cfg'), '--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.project_build_root(), ], )