mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
Meson: build and install remaining tests
This commit is contained in:
parent
96fafcfe92
commit
4b5bc3f459
@ -30,3 +30,5 @@ pkg.generate(libraries : [libgthread, thread_dep],
|
|||||||
name : 'GThread',
|
name : 'GThread',
|
||||||
description : 'Thread support for GLib',
|
description : 'Thread support for GLib',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
libgthread_dep = declare_dependency(link_with : libgthread)
|
||||||
|
@ -1,16 +1,3 @@
|
|||||||
gobject_tests = [
|
|
||||||
['gvalue-test'],
|
|
||||||
['paramspec-test'],
|
|
||||||
['deftype'],
|
|
||||||
['defaultiface', ['defaultiface.c', 'testmodule.c']],
|
|
||||||
['dynamictype', ['dynamictype.c', 'testmodule.c']],
|
|
||||||
['override'],
|
|
||||||
['signals'],
|
|
||||||
['singleton'],
|
|
||||||
['references'],
|
|
||||||
['testgobject'],
|
|
||||||
]
|
|
||||||
|
|
||||||
# We cannot use gnome.genmarshal() here
|
# We cannot use gnome.genmarshal() here
|
||||||
testmarshal_h = custom_target('testmarshal_h',
|
testmarshal_h = custom_target('testmarshal_h',
|
||||||
output : 'testmarshal.h',
|
output : 'testmarshal.h',
|
||||||
@ -39,41 +26,74 @@ testmarshal_c = custom_target('testmarshal_c',
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
gobject_tests += [
|
gobject_tests = {
|
||||||
['accumulator', ['accumulator.c', testmarshal_c, testmarshal_h]],
|
'gvalue-test' : {},
|
||||||
]
|
'paramspec-test' : {},
|
||||||
|
'deftype' : {},
|
||||||
|
'defaultiface' : {
|
||||||
|
'extra_sources' : ['testmodule.c'],
|
||||||
|
},
|
||||||
|
'dynamictype' : {
|
||||||
|
'extra_sources' : ['testmodule.c'],
|
||||||
|
},
|
||||||
|
'override' : {},
|
||||||
|
'signals' : {},
|
||||||
|
'singleton' : {},
|
||||||
|
'references' : {},
|
||||||
|
'testgobject' : {},
|
||||||
|
'accumulator' : {
|
||||||
|
'extra_sources' : [testmarshal_c, testmarshal_h],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
foreach t : gobject_tests
|
common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
|
||||||
test_name = t.get(0)
|
common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
|
||||||
test_src = t.get(1, test_name + '.c')
|
|
||||||
test_extra_cargs = t.get(2, [])
|
foreach test_name, extra_args : gobject_tests
|
||||||
test_timeout = t.get(3, 30)
|
source = extra_args.get('source', test_name + '.c')
|
||||||
test_suite = test_timeout == 30 ? ['gobject'] : ['gobject', 'slow']
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
|
install = installed_tests_enabled and extra_args.get('install', true)
|
||||||
|
|
||||||
|
if install
|
||||||
|
test_conf = configuration_data()
|
||||||
|
test_conf.set('installed_tests_dir', installed_tests_execdir)
|
||||||
|
test_conf.set('program', test_name)
|
||||||
|
configure_file(
|
||||||
|
input: installed_tests_template,
|
||||||
|
output: test_name + '.test',
|
||||||
|
install_dir: installed_tests_metadir,
|
||||||
|
configuration: test_conf
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
# FIXME? $(GLIB_DEBUG_FLAGS)
|
# FIXME? $(GLIB_DEBUG_FLAGS)
|
||||||
exe = executable(test_name + '-gobject', test_src,
|
exe = executable(test_name, [source, extra_sources],
|
||||||
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
|
c_args : common_c_args + extra_args.get('c_args', []),
|
||||||
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
|
dependencies : common_deps + extra_args.get('dependencies', []),
|
||||||
install : false,
|
install_dir: installed_tests_execdir,
|
||||||
|
install: install,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suite = ['gobject'] + extra_args.get('suite', [])
|
||||||
|
timeout = suite.contains('slow') ? 120 : 30
|
||||||
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
||||||
test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite)
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
# Don't install these ones, and keep them out of 'make check' because they take too long...
|
# Don't install these ones, and keep them out of 'make check' because they take too long...
|
||||||
executable('performance', 'performance.c',
|
executable('performance', 'performance.c',
|
||||||
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
|
c_args : common_c_args,
|
||||||
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
|
dependencies : common_deps,
|
||||||
install : false)
|
install : false)
|
||||||
|
|
||||||
executable('performance-threaded', 'performance-threaded.c',
|
executable('performance-threaded', 'performance-threaded.c',
|
||||||
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
|
c_args : common_c_args,
|
||||||
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
|
dependencies : common_deps,
|
||||||
install : false)
|
install : false)
|
||||||
|
|
||||||
if host_system != 'windows' and host_system != 'minix'
|
if host_system != 'windows' and host_system != 'minix'
|
||||||
executable('timeloop-closure', 'timeloop-closure.c',
|
executable('timeloop-closure', 'timeloop-closure.c',
|
||||||
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
|
c_args : common_c_args,
|
||||||
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
|
dependencies : common_deps,
|
||||||
install : false)
|
install : false)
|
||||||
endif
|
endif
|
||||||
|
@ -1,12 +1,144 @@
|
|||||||
# tests
|
# tests
|
||||||
|
|
||||||
|
# Not entirely random of course, but at least it changes over time
|
||||||
|
random_number = minor_version + meson.version().split('.').get(1).to_int()
|
||||||
|
|
||||||
test_env = environment()
|
test_env = environment()
|
||||||
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
||||||
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
||||||
test_env.set('G_DEBUG', 'gc-friendly')
|
test_env.set('G_DEBUG', 'gc-friendly')
|
||||||
test_env.set('MALLOC_CHECK_', '2')
|
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"']
|
||||||
|
|
||||||
subdir('gobject')
|
subdir('gobject')
|
||||||
subdir('refcount')
|
subdir('refcount')
|
||||||
|
|
||||||
|
# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
|
||||||
|
# that supports '+=' operator on dictionnaries.
|
||||||
|
tests = [{
|
||||||
|
'testglib' : {},
|
||||||
|
'testgdate' : {},
|
||||||
|
'datetime' : {},
|
||||||
|
'atomic-test' : {},
|
||||||
|
'bit-test' : {},
|
||||||
|
'child-test' : {},
|
||||||
|
'completion-test' : {},
|
||||||
|
'dirname-test' : {},
|
||||||
|
'file-test' : {},
|
||||||
|
'env-test' : {},
|
||||||
|
'gio-test' : {},
|
||||||
|
'mainloop-test' : {},
|
||||||
|
'mapping-test' : {},
|
||||||
|
'onceinit' : {},
|
||||||
|
'asyncqueue-test' : {},
|
||||||
|
'qsort-test' : {},
|
||||||
|
'relation-test' : {},
|
||||||
|
'slice-concurrent' : {},
|
||||||
|
'slice-threadinit' : {
|
||||||
|
'dependencies' : [libgthread_dep],
|
||||||
|
},
|
||||||
|
'sources' : {},
|
||||||
|
'thread-test' : {},
|
||||||
|
'threadpool-test' : {'suite' : ['slow']},
|
||||||
|
'type-test' : {},
|
||||||
|
'unicode-caseconv' : {},
|
||||||
|
'unicode-encoding' : {},
|
||||||
|
'module-test' : {
|
||||||
|
'dependencies' : [libgmodule_dep],
|
||||||
|
'export_dynamic' : true,
|
||||||
|
},
|
||||||
|
'timeloop' : {},
|
||||||
|
'cxx-test' : {
|
||||||
|
'source' : 'cxx-test.C',
|
||||||
|
'include_directories' : gmoduleinc,
|
||||||
|
'dependencies' : [libgio_dep],
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
test_extra_programs = {
|
||||||
|
'slice-test' : {
|
||||||
|
'extra_sources' : ['memchunks.c'],
|
||||||
|
},
|
||||||
|
'slice-color' : {
|
||||||
|
'extra_sources' : ['memchunks.c'],
|
||||||
|
},
|
||||||
|
'assert-msg-test' : {},
|
||||||
|
'unicode-collate' : {},
|
||||||
|
}
|
||||||
|
|
||||||
|
if host_machine.system() != 'windows'
|
||||||
|
tests += [{
|
||||||
|
'spawn-test' : {},
|
||||||
|
'iochannel-test' : {},
|
||||||
|
}]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if installed_tests_enabled
|
||||||
|
install_data(
|
||||||
|
'iochannel-test-infile',
|
||||||
|
'casemap.txt',
|
||||||
|
'casefold.txt',
|
||||||
|
'utf8.txt',
|
||||||
|
install_dir : installed_tests_execdir,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
||||||
|
shared_module(module, 'lib@0@.c'.format(module),
|
||||||
|
dependencies : [libglib_dep, libgmodule_dep],
|
||||||
|
install_dir : installed_tests_execdir,
|
||||||
|
install : installed_tests_enabled
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
|
||||||
|
common_deps = [libm, thread_dep, libglib_dep]
|
||||||
|
|
||||||
|
foreach test_dict : tests
|
||||||
|
foreach test_name, extra_args : test_dict
|
||||||
|
source = extra_args.get('source', test_name + '.c')
|
||||||
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
|
install = installed_tests_enabled and extra_args.get('install', true)
|
||||||
|
|
||||||
|
if install
|
||||||
|
test_conf = configuration_data()
|
||||||
|
test_conf.set('installed_tests_dir', installed_tests_execdir)
|
||||||
|
test_conf.set('program', test_name)
|
||||||
|
configure_file(
|
||||||
|
input: installed_tests_template,
|
||||||
|
output: test_name + '.test',
|
||||||
|
install_dir: installed_tests_metadir,
|
||||||
|
configuration: test_conf
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# FIXME? $(GLIB_DEBUG_FLAGS)
|
||||||
|
exe = executable(test_name, [source, extra_sources],
|
||||||
|
c_args : common_c_args + extra_args.get('c_args', []),
|
||||||
|
dependencies : common_deps + extra_args.get('dependencies', []),
|
||||||
|
export_dynamic : extra_args.get('export_dynamic', false),
|
||||||
|
include_directories : extra_args.get('include_directories', []),
|
||||||
|
install_dir: installed_tests_execdir,
|
||||||
|
install: install,
|
||||||
|
)
|
||||||
|
|
||||||
|
suite = ['glib'] + extra_args.get('suite', [])
|
||||||
|
timeout = suite.contains('slow') ? 120 : 30
|
||||||
|
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
||||||
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
|
endforeach
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
foreach program_name, extra_args : test_extra_programs
|
||||||
|
source = extra_args.get('source', program_name + '.c')
|
||||||
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
|
install = installed_tests_enabled and extra_args.get('install', true)
|
||||||
|
executable(program_name, [source, extra_sources],
|
||||||
|
c_args : common_c_args,
|
||||||
|
dependencies : common_deps + extra_args.get('dependencies', []),
|
||||||
|
install_dir : installed_tests_execdir,
|
||||||
|
install : install,
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
@ -1,30 +1,59 @@
|
|||||||
refcount_tests = [
|
refcount_tests = {
|
||||||
['closures', 'closures.c', [], 90],
|
'closures' : {'suite' : ['slow']},
|
||||||
['objects', 'objects.c', []],
|
'objects' : {},
|
||||||
['objects2', 'objects2.c', [], 90],
|
'objects2' : {'suite' : ['slow']},
|
||||||
['properties', 'properties.c', []],
|
'properties' : {},
|
||||||
['properties2', 'properties2.c', [], 90],
|
'properties2' : {'suite' : ['slow']},
|
||||||
['properties3', 'properties3.c', [], 90], # extra long timeout
|
'properties3' : {'suite' : ['slow']},
|
||||||
['properties4', 'properties4.c', []],
|
'properties4' : {},
|
||||||
['signal1', 'signals.c', ['-DTESTNUM=1']],
|
'signal1' : {
|
||||||
['signal2', 'signals.c', ['-DTESTNUM=2']],
|
'source' : 'signals.c',
|
||||||
['signal3', 'signals.c', ['-DTESTNUM=3']],
|
'c_args' : ['-DTESTNUM=1'],
|
||||||
['signal4', 'signals.c', ['-DTESTNUM=4']],
|
},
|
||||||
]
|
'signal2' : {
|
||||||
|
'source' : 'signals.c',
|
||||||
|
'c_args' : ['-DTESTNUM=2'],
|
||||||
|
},
|
||||||
|
'signal3' : {
|
||||||
|
'source' : 'signals.c',
|
||||||
|
'c_args' : ['-DTESTNUM=3'],
|
||||||
|
},
|
||||||
|
'signal4' : {
|
||||||
|
'source' : 'signals.c',
|
||||||
|
'c_args' : ['-DTESTNUM=4'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
foreach t : refcount_tests
|
common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
|
||||||
test_name = t.get(0)
|
common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
|
||||||
test_src = t.get(1)
|
|
||||||
test_extra_cargs = t.get(2)
|
foreach test_name, extra_args : refcount_tests
|
||||||
test_timeout = t.get(3, 30)
|
source = extra_args.get('source', test_name + '.c')
|
||||||
test_suite = test_timeout == 30 ? ['refcount'] : ['refcount', 'slow']
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
|
install = installed_tests_enabled and extra_args.get('install', true)
|
||||||
|
|
||||||
|
if install
|
||||||
|
test_conf = configuration_data()
|
||||||
|
test_conf.set('installed_tests_dir', installed_tests_execdir)
|
||||||
|
test_conf.set('program', test_name)
|
||||||
|
configure_file(
|
||||||
|
input: installed_tests_template,
|
||||||
|
output: test_name + '.test',
|
||||||
|
install_dir: installed_tests_metadir,
|
||||||
|
configuration: test_conf
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
# FIXME? $(GLIB_DEBUG_FLAGS)
|
# FIXME? $(GLIB_DEBUG_FLAGS)
|
||||||
exe = executable(test_name + '-test', test_src,
|
exe = executable(test_name, [source, extra_sources],
|
||||||
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
|
c_args : common_c_args + extra_args.get('c_args', []),
|
||||||
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
|
dependencies : common_deps + extra_args.get('dependencies', []),
|
||||||
install : false,
|
install_dir: installed_tests_execdir,
|
||||||
|
install: install,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suite = ['refcount'] + extra_args.get('suite', [])
|
||||||
|
timeout = suite.contains('slow') ? 120 : 30
|
||||||
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
||||||
test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite)
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
endforeach
|
endforeach
|
||||||
|
Loading…
Reference in New Issue
Block a user