diff options
| author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-12-01 22:57:13 -0500 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-12-06 14:35:36 +0200 |
| commit | ee241f2aab535b1614be5a1d3cacdc3ab8cfb8b4 (patch) | |
| tree | f349e762ab32829a9f37b2b82fb3b6f244e6b37b /docs/markdown/Reference-manual.md | |
| parent | 9ca9bb7c09cc0d73ee1f79163408a46794aebee3 (diff) | |
| download | meson-ee241f2aab535b1614be5a1d3cacdc3ab8cfb8b4.tar.gz | |
mtest: document default MALLOC_PERTURB_=1..255 behavior [skip ci]
This default behavior can have surprising and time-consuming outcomes.
I was wondering why certain tests using several external, fixed libraries
would fail only with Meson and not with CMake or manual runs.
It turned out mtest.py enables MALLOC_PERTURB_ by default, which is
surprising--a topic for another Issue/PR.
At least, this surprising default is documented with workarounds.
Diffstat (limited to 'docs/markdown/Reference-manual.md')
| -rw-r--r-- | docs/markdown/Reference-manual.md | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 976295534..5c5d164e9 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -151,9 +151,10 @@ Abort with an error message if `condition` evaluates to `false`. ``` Creates a benchmark item that will be run when the benchmark target is -run. The behavior of this function is identical to `test` with the -exception that there is no `is_parallel` keyword, because benchmarks -are never run in parallel. +run. The behavior of this function is identical to [`test()`](#test) except for: + +* benchmark() has no `is_parallel` keyword because benchmarks are not run in parallel +* benchmark() does not automatically add the `MALLOC_PERTURB_` environment variable *Note:* Prior to 0.52.0 benchmark would warn that `depends` and `priority` were unsupported, this is incorrect @@ -1512,7 +1513,25 @@ object](#build-target-object) returned by object](#external-program-object) returned by [`find_program()`](#find_program). -Keyword arguments are the following: +By default, environment variable +[`MALLOC_PERTURB_`](http://man7.org/linux/man-pages/man3/mallopt.3.html) +is automatically set by `meson test` to a random value between 1..255. +This can help find memory leaks on configurations using glibc, +including with non-GCC compilers. However, this can have a performance impact, +and may fail a test due to external libraries whose internals are out of the +user's control. To check if this feature is causing an expected runtime crash, +disable the feature by temporarily setting environment variable +`MALLOC_PERTURB_=0`. While it's preferable to only temporarily disable this +check, if a project requires permanent disabling of this check +in meson.build do like: + +```meson +nomalloc = environment({'MALLOC_PERTURB_': '0'}) + +test(..., env: nomalloc, ...) +``` + +#### test() Keyword arguments - `args` arguments to pass to the executable |
