diff options
| -rw-r--r-- | docs/markdown/Unit-tests.md | 8 | ||||
| -rw-r--r-- | docs/markdown/snippets/sanitizers_test.md | 6 | ||||
| -rw-r--r-- | docs/yaml/functions/test.yaml | 7 | ||||
| -rw-r--r-- | mesonbuild/mtest.py | 2 |
4 files changed, 16 insertions, 7 deletions
diff --git a/docs/markdown/Unit-tests.md b/docs/markdown/Unit-tests.md index 7ad95d264..dc509a818 100644 --- a/docs/markdown/Unit-tests.md +++ b/docs/markdown/Unit-tests.md @@ -38,11 +38,11 @@ set to a random value between 1..255. This can help find memory leaks on configurations using glibc, including with non-GCC compilers. This feature can be disabled as discussed in [[test]]. -### ASAN_OPTIONS and UBSAN_OPTIONS +### ASAN_OPTIONS, UBSAN_OPTIONS, and MSAN_OPTIONS -By default, the environment variables `ASAN_OPTIONS` and `UBSAN_OPTIONS` are -set to enable aborting on detected violations and to give a backtrace. This -feature can be disabled as discussed in [[test]]. +By default, the environment variables `ASAN_OPTIONS`, `UBSAN_OPTIONS`, and +`MSAN_OPTIONS` are set to enable aborting on detected violations and to give a +backtrace. This feature can be disabled as discussed in [[test]]. ## Coverage diff --git a/docs/markdown/snippets/sanitizers_test.md b/docs/markdown/snippets/sanitizers_test.md new file mode 100644 index 000000000..de9385253 --- /dev/null +++ b/docs/markdown/snippets/sanitizers_test.md @@ -0,0 +1,6 @@ +## Tests now abort on errors by default under more sanitizers + +Sanitizers like MemorySanitizer do not abort +by default on detected violations. Meson now exports `MSAN_OPTIONS` (in addition to +`ASAN_OPTIONS` and `UBSAN_OPTIONS` from a previous release) when unset in the +environment to provide sensible abort-by-default behavior. diff --git a/docs/yaml/functions/test.yaml b/docs/yaml/functions/test.yaml index 622b7c3b0..d56822e58 100644 --- a/docs/yaml/functions/test.yaml +++ b/docs/yaml/functions/test.yaml @@ -33,9 +33,10 @@ description: | test(..., env: nomalloc, ...) ``` - By default, the environment variables `ASAN_OPTIONS` and `UBSAN_OPTIONS` are - set to enable aborting on detected violations and to give a backtrace. To suppress - this, `ASAN_OPTIONS` and `UBSAN_OPTIONS` can be set in the environment. + By default, the environment variables `ASAN_OPTIONS`, `UBSAN_OPTIONS`, + and `MSAN_OPTIONS` are set to enable aborting on detected violations and to + give a backtrace. To suppress this, `ASAN_OPTIONS`, `UBSAN_OPTIONS`, or + `MSAN_OPTIONS` can be set in the environment. In addition to running individual executables as test cases, `test()` can also be used to invoke an external test harness. In this case, diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index d9ae783d9..b43f165ed 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1414,6 +1414,8 @@ class SingleTestRunner: env['ASAN_OPTIONS'] = 'halt_on_error=1:abort_on_error=1:print_summary=1' if ('UBSAN_OPTIONS' not in env or not env['UBSAN_OPTIONS']): env['UBSAN_OPTIONS'] = 'halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1' + if ('MSAN_OPTIONS' not in env or not env['MSAN_OPTIONS']): + env['UBSAN_OPTIONS'] = 'halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1' if self.options.gdb or self.test.timeout is None or self.test.timeout <= 0: timeout = None |
