From e043511635ce8d627f40054d22a876f1c189db46 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 21 Aug 2020 14:55:00 +0100 Subject: tests: Pass address-sanitizer options when building GObject scanner This allows a Meson build with -Db_sanitize=address,undefined to succeed (when combined with !52 to make the tests pass). Reproduces: #125 Signed-off-by: Simon McVittie --- tests/gobject/docs/meson.build | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/gobject/docs/meson.build b/tests/gobject/docs/meson.build index e1e6acc..7c6d9d9 100644 --- a/tests/gobject/docs/meson.build +++ b/tests/gobject/docs/meson.build @@ -38,6 +38,22 @@ test( ], ) +sanitizer_args = [] + +if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address,undefined' + sanitizer_args += [ + '--extra-cflags=-fsanitize=address', + '--ldflags=-fsanitize=address', + ] +endif + +if get_option('b_sanitize') == 'undefined' or get_option('b_sanitize') == 'address,undefined' + sanitizer_args += [ + '--extra-cflags=-fsanitize=undefined', + '--ldflags=-fsanitize=undefined', + ] +endif + test( 'test-gobject-scangobj', python_prg, @@ -51,6 +67,9 @@ test( '--extra-pkg=@0@'.format('gobject-2.0'), '--extra-lib=@0@'.format(gobject_test_lib.full_path()), '--module=@0@'.format('tester'), + ] + sanitizer_args, + env: [ + 'ASAN_OPTIONS=detect_leaks=0', ], ) -- cgit v1.2.1