meson: add tests/gobject and tests/refcount

This commit is contained in:
Tim-Philipp Müller 2017-05-02 17:04:58 +01:00 committed by Matthias Clasen
parent 6af4f1752a
commit 2e9fd74b25
4 changed files with 104 additions and 1 deletions

View File

@ -1,6 +1,6 @@
project('glib', 'c', 'cpp', project('glib', 'c', 'cpp',
version : '2.51.2', version : '2.51.2',
meson_version : '>= 0.37.1', meson_version : '>= 0.38.1',
default_options : [ default_options : [
'warning_level=1', 'warning_level=1',
'c_std=gnu89' 'c_std=gnu89'
@ -1387,6 +1387,7 @@ subdir('gio')
if xgettext.found() if xgettext.found()
subdir('po') subdir('po')
endif endif
subdir('tests')
# Configure and install pkg-config files # Configure and install pkg-config files
pc_files = [ pc_files = [

59
tests/gobject/meson.build Normal file
View File

@ -0,0 +1,59 @@
gobject_tests = [
['gvalue-test'],
['paramspec-test'],
['deftype'],
['defaultiface', ['defaultiface.c', 'testmodule.c']],
['dynamictype', ['dynamictype.c', 'testmodule.c']],
['override'],
['signals'],
['singleton'],
['references'],
]
# The marshal test requires running a binary, which means we cannot
# build it when cross-compiling
if not meson.is_cross_build() or meson.has_exe_wrapper()
gnome = import('gnome')
testmarshal_srcs = gnome.genmarshal('testmarshal',
sources : 'testmarshal.list',
prefix : 'test_marshal')
gobject_tests += [
['accumulator', ['accumulator.c', testmarshal_srcs]],
]
endif
foreach t : gobject_tests
test_name = t.get(0)
test_src = t.get(1, test_name + '.c')
test_extra_cargs = t.get(2, [])
test_timeout = t.get(3, 30)
# FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name, test_src,
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
install : false,
)
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : test_timeout)
endforeach
# Don't install these ones, and keep them out of 'make check' because they take too long...
executable('performance', 'performance.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
install : false)
executable('performance-threaded', 'performance-threaded.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
install : false)
if host_system != 'windows' and host_system != 'minix'
executable('timeloop-closure', 'timeloop-closure.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
install : false)
endif

14
tests/meson.build Normal file
View File

@ -0,0 +1,14 @@
# tests
test_env = [
'G_TEST_SRCDIR=' + meson.current_source_dir(),
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
'G_DEBUG=gc-friendly',
'MALLOC_CHECK_=2',
'MALLOC_PERTURB_=@0@'.format(random_number % 256),
]
test_cargs = ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"']
subdir('gobject')
subdir('refcount')

View File

@ -0,0 +1,29 @@
refcount_tests = [
['closures', 'closures.c', []],
['objects', 'objects.c', []],
['objects2', 'objects2.c', []],
['properties', 'properties.c', []],
['properties2', 'properties2.c', []],
['properties3', 'properties3.c', [], 90], # extra long timeout
['properties4', 'properties4.c', []],
['signal1', 'signals.c', ['-DTESTNUM=1']],
['signal2', 'signals.c', ['-DTESTNUM=2']],
['signal3', 'signals.c', ['-DTESTNUM=3']],
['signal4', 'signals.c', ['-DTESTNUM=4']],
]
foreach t : refcount_tests
test_name = t.get(0)
test_src = t.get(1)
test_extra_cargs = t.get(2)
test_timeout = t.get(3, 30)
# FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name + '-test', test_src,
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
install : false,
)
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : test_timeout)
endforeach