[gtk-doc/wip/smcv/qsort-null-test] tests: Pass address-sanitizer options when building GObject scanner




commit e043511635ce8d627f40054d22a876f1c189db46
Author: Simon McVittie <smcv debian org>
Date:   Fri Aug 21 14:55:00 2020 +0100

    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 <smcv debian org>

 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',
   ],
 )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]