summaryrefslogtreecommitdiff
path: root/gmodule
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2022-11-08 12:30:53 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2022-11-08 12:30:53 +0000
commite2b9e28ecec9556b6e2ed6651106d457e5c2a2e6 (patch)
treef5a55106877992470b93dfe8a63a154101640fcd /gmodule
parent9a0c8a585d1dc31127b2c3dd5fa17d457011eb1d (diff)
parentc6eddf897b38ea7189f33e530db9a06e163cd1d9 (diff)
downloadglib-e2b9e28ecec9556b6e2ed6651106d457e5c2a2e6.tar.gz
Merge branch 'wip/3v1n0/meson-fix-tests-binary-dependencies' into 'main'
test/meson: Add tests dependencies on built programs, libraries and modules See merge request GNOME/glib!3015
Diffstat (limited to 'gmodule')
-rw-r--r--gmodule/tests/meson.build46
1 files changed, 31 insertions, 15 deletions
diff --git a/gmodule/tests/meson.build b/gmodule/tests/meson.build
index b9a0ee6f4..a78887529 100644
--- a/gmodule/tests/meson.build
+++ b/gmodule/tests/meson.build
@@ -1,17 +1,5 @@
gmodule_tests = {
'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
@@ -40,16 +28,20 @@ if ['darwin', 'ios'].contains(host_machine.system())
module_suffix = 'so'
endif
+gmodule_test_modules = []
+gmodule_test_libraries = []
if glib_build_shared
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],
install_dir : installed_tests_execdir,
install_tag : 'tests',
install : installed_tests_enabled,
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],
install_dir : installed_tests_execdir,
install_tag : 'tests',
@@ -59,6 +51,23 @@ if glib_build_shared
endforeach
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.set('G_TEST_SRCDIR', meson.current_source_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', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
+ depends = [extra_args.get('depends', [])]
if extra_args.get('can_fail', false)
suite += 'failing'
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