mesonbuild / mesonbuild/meson

Valgrind wrapping for tests is error-prone

Open
#13,745 2 comments 0 reactions 1 assignee View on GitHub

@thesamesam is already working on this.

Since Mar 25, 2025.

test targets
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

We currently tell users to run meson test --wrapper valgrind to run their tests under Valgrind, but it's error-prone. By default, Valgrind doesn't error out on violations/issues it detects. This is a POLA violation and while I suspect we're not going to be able to change the default behaviour of Valgrind, we should try to do better in Meson.

1f76b76a84cb635f764ecbd2b77aaba1d375d72b added specific handling for Valgrind with tests, although it got dropped later in 951262d7590343ffa9730666c427ad9d708a9fb6.

We already try to do better in Meson for UBSAN, see 7b7d2e060b447de9c2642848847370a58711ac1c and 8ba0ea68017b489b0a461abbd375f319dc7a48f3.

A user even hit this in the past at https://github.com/mesonbuild/meson/issues/4727. See also https://github.com/mesonbuild/meson/issues/1175 and arguably https://github.com/mesonbuild/meson/issues/1105.

Specifically, we should consider adding:

  • --exit-on-first-error=yes (maybe)
  • --exit-errorcode=2 (or some other value instead of 2)
  • --trace-children=yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.