mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-21 22:59:16 +02:00
gmodule/tests/meson: Make tests depending on loaded libraries and modules
This commit is contained in:
parent
82fc49fa10
commit
eef2b0b39e
@ -1,17 +1,5 @@
|
|||||||
gmodule_tests = {
|
gmodule_tests = {
|
||||||
'max-version' : {'install': false},
|
'max-version' : {'install': false},
|
||||||
'module-test-library' : {
|
|
||||||
'export_dynamic' : true,
|
|
||||||
'source': 'module-test.c',
|
|
||||||
'c_args': ['-DMODULE_TYPE="library"'],
|
|
||||||
'can_fail': glib_build_static and host_system == 'windows',
|
|
||||||
},
|
|
||||||
'module-test-plugin' : {
|
|
||||||
'export_dynamic' : true,
|
|
||||||
'source': 'module-test.c',
|
|
||||||
'c_args': ['-DMODULE_TYPE="plugin"'],
|
|
||||||
'can_fail': glib_build_static and host_system == 'windows',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if have_cxx
|
if have_cxx
|
||||||
@ -40,16 +28,20 @@ if ['darwin', 'ios'].contains(host_machine.system())
|
|||||||
module_suffix = 'so'
|
module_suffix = 'so'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
gmodule_test_modules = []
|
||||||
|
gmodule_test_libraries = []
|
||||||
if glib_build_shared
|
if glib_build_shared
|
||||||
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
||||||
shared_module(module + '_plugin', 'lib@0@.c'.format(module),
|
gmodule_test_modules += shared_module(module + '_plugin',
|
||||||
|
'lib@0@.c'.format(module),
|
||||||
dependencies : [libglib_dep, libgmodule_dep],
|
dependencies : [libglib_dep, libgmodule_dep],
|
||||||
install_dir : installed_tests_execdir,
|
install_dir : installed_tests_execdir,
|
||||||
install_tag : 'tests',
|
install_tag : 'tests',
|
||||||
install : installed_tests_enabled,
|
install : installed_tests_enabled,
|
||||||
name_suffix : module_suffix
|
name_suffix : module_suffix
|
||||||
)
|
)
|
||||||
shared_library(module + '_library', 'lib@0@.c'.format(module),
|
gmodule_test_libraries += shared_library(module + '_library',
|
||||||
|
'lib@0@.c'.format(module),
|
||||||
dependencies : [libglib_dep, libgmodule_dep],
|
dependencies : [libglib_dep, libgmodule_dep],
|
||||||
install_dir : installed_tests_execdir,
|
install_dir : installed_tests_execdir,
|
||||||
install_tag : 'tests',
|
install_tag : 'tests',
|
||||||
@ -59,6 +51,23 @@ if glib_build_shared
|
|||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
gmodule_tests += {
|
||||||
|
'module-test-library' : {
|
||||||
|
'export_dynamic' : true,
|
||||||
|
'source': 'module-test.c',
|
||||||
|
'depends': gmodule_test_libraries,
|
||||||
|
'c_args': ['-DMODULE_TYPE="library"'],
|
||||||
|
'can_fail': glib_build_static_only,
|
||||||
|
},
|
||||||
|
'module-test-plugin' : {
|
||||||
|
'export_dynamic' : true,
|
||||||
|
'source': 'module-test.c',
|
||||||
|
'depends': gmodule_test_modules,
|
||||||
|
'c_args': ['-DMODULE_TYPE="plugin"'],
|
||||||
|
'can_fail': glib_build_static_only,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
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())
|
||||||
@ -98,10 +107,17 @@ foreach test_name, extra_args : gmodule_tests
|
|||||||
|
|
||||||
suite = ['gmodule'] + extra_args.get('suite', [])
|
suite = ['gmodule'] + extra_args.get('suite', [])
|
||||||
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
||||||
|
depends = [extra_args.get('depends', [])]
|
||||||
|
|
||||||
if extra_args.get('can_fail', false)
|
if extra_args.get('can_fail', false)
|
||||||
suite += 'failing'
|
suite += 'failing'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
test(test_name,
|
||||||
|
exe,
|
||||||
|
depends : depends,
|
||||||
|
env : test_env,
|
||||||
|
timeout : timeout,
|
||||||
|
suite : suite,
|
||||||
|
)
|
||||||
endforeach
|
endforeach
|
||||||
|
Loading…
x
Reference in New Issue
Block a user