mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.65k stars 1.64k forks source link

Valgrind wrapping for tests is error-prone #13745

Open thesamesam opened 1 month ago

thesamesam commented 1 month ago

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:

thesamesam commented 1 month ago

The AX_VALGRIND_CHECK macro in autoconf-archive gets this right: https://github.com/autoconf-archive/autoconf-archive/blob/c673b0d795f2c4da83cb14afdb64e5df773c3ec3/m4/ax_valgrind_check.m4#L207.