aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2025-03-25 07:09:04 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-02 23:50:38 +0300
commit80116498d076b840162d74541564a29c4a37335f (patch)
tree8608f655cc19b70bb6d6853958c447d8eee9053e /docs/markdown/snippets
parent05799aec80f3ea2afb19167846992348888123ce (diff)
downloadmeson-80116498d076b840162d74541564a29c4a37335f.zip
meson-80116498d076b840162d74541564a29c4a37335f.tar.gz
meson-80116498d076b840162d74541564a29c4a37335f.tar.bz2
mtest: set VALGRIND_OPTS to fail tests on errors
We currently suggest that users run `meson test --wrapper valgrind`, but this doesn't do what one might expect: Valgrind doesn't error out on violations/issues it detects. In the past, we had special handling for Valgrind in tests, see 1f76b76a84cb635f764ecbd2b77aaba1d375d72b but it was later dropped in 951262d7590343ffa9730666c427ad9d708a9fb6. This is similar to what we do for {A,UB,M}SAN_OPTIONS to give sensible behaviour that users expect out-of-the-box. Only do this if we see 'valgrind' in the wrapper command to avoid polluting logs. We may want to do that for the sanitizers variables in future too. Note that we're not adding --exit-on-first-error=yes here, as there may be several issues in an application, or a test may be rather slow, and so on. But --error-exitcode=1 to simply make Valgrind's exit status reflect whether an error was found is uncontroversial. Bug: https://github.com/mesonbuild/meson/issues/4727 Bug: https://github.com/mesonbuild/meson/issues/1105 Bug: https://github.com/mesonbuild/meson/issues/1175 Bug: https://github.com/mesonbuild/meson/issues/13745
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/valgrind_test.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/markdown/snippets/valgrind_test.md b/docs/markdown/snippets/valgrind_test.md
new file mode 100644
index 0000000..0787300
--- /dev/null
+++ b/docs/markdown/snippets/valgrind_test.md
@@ -0,0 +1,6 @@
+## Valgrind now fails tests if errors are found
+
+Valgrind does not reflect an error in its exit code by default, meaning
+a test may silently pass despite memory errors. Meson now exports
+`VALGRIND_OPTS` such that Valgrind will exit with status 1 to indicate
+an error if `VALGRIND_OPTS` is not set in the environment.