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
This commit is contained in:
Philip Withnall 2019-03-05 10:55:19 +00:00
parent f3610f14c4
commit d89f18bb22
5 changed files with 5 additions and 3 deletions

View File

@ -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'

View File

@ -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

View File

@ -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')

View File

@ -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')

View File

@ -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')