[glib: 1/13] build: Add -UG_DISABLE_ASSERT when building tests



commit d89f18bb22ec73fb068a66f4a489a9bd749e6059
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Mar 5 10:55:19 2019 +0000

    build: Add -UG_DISABLE_ASSERT when building tests
    
    In order to allow GLib itself to be built with G_DISABLE_ASSERT defined,
    we need to explicitly undefine it when building the tests, otherwise
    g_test_init() turns into an abort.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Fixes: #1708

 gio/tests/meson.build     | 1 +
 glib/meson.build          | 1 +
 glib/tests/meson.build    | 2 +-
 gobject/tests/meson.build | 2 +-
 tests/meson.build         | 2 +-
 5 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index 5c0e03365..48d666cc4 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -10,6 +10,7 @@ test_c_args = [
   '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
   '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
   '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
+  '-UG_DISABLE_ASSERT',
 ]
 
 if host_machine.system() == 'windows'
diff --git a/glib/meson.build b/glib/meson.build
index 8350ea283..765b93ba3 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -327,6 +327,7 @@ if host_system == 'windows'
 else
   gtester = executable('gtester', 'gtester.c',
     install : true,
+    c_args : ['-UG_DISABLE_ASSERT'],
     include_directories : configinc,
     dependencies : [libglib_dep])
 endif
diff --git a/glib/tests/meson.build b/glib/tests/meson.build
index 2b3f902ab..e6c5cbd22 100644
--- a/glib/tests/meson.build
+++ b/glib/tests/meson.build
@@ -176,7 +176,7 @@ test_env.set('MALLOC_CHECK_', '2')
 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
 
 test_deps = [libm, thread_dep, libglib_dep]
-test_cargs = ['-DG_LOG_DOMAIN="GLib"']
+test_cargs = ['-DG_LOG_DOMAIN="GLib"', '-UG_DISABLE_ASSERT']
 
 foreach test_name, extra_args : glib_tests
   source = extra_args.get('source', test_name + '.c')
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
index 2de2002d3..9d08d0a34 100644
--- a/gobject/tests/meson.build
+++ b/gobject/tests/meson.build
@@ -68,7 +68,7 @@ test_env.set('MALLOC_CHECK_', '2')
 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
 
 test_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
-test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"']
+test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT']
 
 foreach test_name, extra_args : gobject_tests
   source = extra_args.get('source', test_name + '.c')
diff --git a/tests/meson.build b/tests/meson.build
index 11075dd8e..288c5b847 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -10,7 +10,7 @@ test_env.set('G_DEBUG', 'gc-friendly')
 test_env.set('MALLOC_CHECK_', '2')
 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
 
-test_cargs = ['-DG_LOG_DOMAIN="GLib"']
+test_cargs = ['-DG_LOG_DOMAIN="GLib"', '-UG_DISABLE_ASSERT']
 
 subdir('gobject')
 subdir('refcount')


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