1 common_gio_tests_deps = [
8 subdir('gdbus-object-manager-example')
10 gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
11 giotypefuncs_inc = custom_target(
13 output : 'giotypefuncs.inc',
14 input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
15 command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
17 # Test programs buildable on all platforms
18 # FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
19 # that supports '+=' operator on dictionnaries.
22 'async-close-output-stream' : {},
23 'async-splice-output-stream' : {},
24 'buffered-input-stream' : {},
25 'buffered-output-stream' : {},
29 'converter-stream' : {},
31 'data-input-stream' : {},
32 'data-output-stream' : {},
33 'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
34 'fileattributematcher' : {},
35 'filter-streams' : {},
41 'gdbus-addresses' : {},
45 'memory-input-stream' : {},
46 'memory-output-stream' : {},
48 'mount-operation' : {},
49 'network-address' : {},
50 'network-monitor' : {},
51 'network-monitor-race' : {},
56 'simple-async-result' : {},
60 'socket-listener' : {},
61 'socket-service' : {},
67 'testfilemonitor' : {'suite' : ['slow']},
68 'thumbnail-verification' : {},
69 'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']},
70 'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
73 # FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
74 # that supports '+=' operator on dictionnaries.
75 test_extra_programs = [{
76 'gdbus-connection-flush-helper' : {},
77 'gdbus-testserver' : {},
80 test_env = environment()
81 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
82 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
83 test_env.set('GIO_MODULE_DIR', '')
84 test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop')
87 '-DG_LOG_DOMAIN="GLib-GIO"',
88 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
89 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
90 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
93 # Check for libdbus1 - Optional - is only used in the GDBus test cases
94 # 1.2.14 required for dbus_message_set_serial
95 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
96 if not dbus1_dep.found()
97 if cc.get_id() == 'msvc'
98 # MSVC: Search for the DBus library by the configuration, which corresponds
99 # to the output of CMake builds of DBus. Note that debugoptimized
100 # is really a Release build with .PDB files.
101 if buildtype == 'debug'
102 dbus1_dep = cc.find_library('dbus-1d', required : false)
104 dbus1_dep = cc.find_library('dbus-1', required : false)
109 glib_conf.set('HAVE_DBUS1', 1)
112 'gdbus-serialization' : {
113 'extra_sources' : ['gdbus-tests.c'],
114 'dependencies' : [dbus1_dep],
119 # Test programs buildable on UNIX only
120 if host_machine.system() != 'windows'
123 'gdbus-peer' : {'dependencies' : [libgdbus_example_objectmanager_dep]},
124 'gdbus-peer-object-manager' : {},
126 'socket-address' : {},
127 'stream-rw_all' : {},
131 'g-file-info-filesystem-readonly' : {},
132 'gschema-compile' : {'install' : false},
136 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
137 # unable to find the installed executable
138 if not glib_have_cocoa
143 'desktop-app-info' : {
149 test_extra_programs += [{
150 'basic-application' : {},
155 if not glib_have_cocoa
156 test_extra_programs += [{
164 # Test programs that need to bring up a session bus (requires dbus-daemon)
165 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
167 # Generate gdbus-test-codegen-generated.{c,h}
168 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
169 input : ['test-codegen.xml'],
170 output : ['gdbus-test-codegen-generated.h',
171 'gdbus-test-codegen-generated.c'],
172 depend_files : gdbus_codegen_built_files,
173 command : [python, gdbus_codegen,
174 '--interface-prefix', 'org.project.',
175 '--output-directory', '@OUTDIR@',
176 '--generate-c-code', 'gdbus-test-codegen-generated',
177 '--c-generate-object-manager',
178 '--c-namespace', 'Foo_iGen',
179 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
180 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
181 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
182 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
183 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
184 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
185 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
186 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
187 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
190 extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
194 'extra_sources' : extra_sources,
197 'gdbus-auth' : {'extra_sources' : extra_sources},
198 'gdbus-bz627724' : {'extra_sources' : extra_sources},
199 'gdbus-close-pending' : {'extra_sources' : extra_sources},
200 'gdbus-connection' : {'extra_sources' : extra_sources},
201 'gdbus-connection-loss' : {'extra_sources' : extra_sources},
202 'gdbus-connection-slow' : {'extra_sources' : extra_sources},
203 'gdbus-error' : {'extra_sources' : extra_sources},
204 'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
206 'extra_sources' : extra_sources,
209 'gdbus-introspection' : {'extra_sources' : extra_sources},
210 'gdbus-names' : {'extra_sources' : extra_sources},
211 'gdbus-proxy' : {'extra_sources' : extra_sources},
212 'gdbus-proxy-threads' : {
213 'extra_sources' : extra_sources,
214 'dependencies' : [dbus1_dep],
216 'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
217 'gdbus-test-codegen' : {
218 'extra_sources' : [extra_sources, gdbus_test_codegen_generated],
220 'gdbus-threading' : {
221 'extra_sources' : extra_sources,
224 'gmenumodel' : {'extra_sources' : extra_sources},
226 'extra_sources' : [extra_sources, 'gnotification-server.c'],
228 'gdbus-test-codegen-old' : {
229 'source' : 'gdbus-test-codegen.c',
230 'extra_sources' : [extra_sources, gdbus_test_codegen_generated],
231 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
232 '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
234 'gapplication' : {'extra_sources' : extra_sources},
235 'gdbus-unix-addresses' : {},
238 if not glib_have_cocoa
241 'extra_sources' : extra_sources,
245 endif # have_dbus_daemon
247 # This test is currently unreliable
248 executable('gdbus-overflow', 'gdbus-overflow.c',
250 c_args : test_c_args,
251 dependencies : common_gio_tests_deps)
254 'gdbus-connection-flush' : {
255 'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
257 'gdbus-non-socket' : {
258 'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
262 # Generate test.mo from de.po using msgfmt
263 msgfmt = find_program('msgfmt', required : false)
265 subdir('de/LC_MESSAGES')
268 'extra_sources' : [test_mo],
269 'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
270 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
277 # Test programs buildable on Windows only
278 if host_machine.system() == 'windows'
279 gio_tests += [{'win32-streams' : {}}]
282 if cc.get_id() != 'msvc'
285 'source' : 'autoptr.c',
290 test_extra_programs += [{
291 'gio-du' : {'install' : false},
292 'echo-server' : {'install' : false},
293 'filter-cat' : {'install' : false},
294 'gapplication-example-actions' : {'install' : false},
295 'gapplication-example-cmdline' : {'install' : false},
296 'gapplication-example-cmdline2' : {'install' : false},
297 'gapplication-example-cmdline3' : {'install' : false},
298 'gapplication-example-cmdline4' : {'install' : false},
299 'gapplication-example-dbushooks' : {'install' : false},
300 'gapplication-example-open' : {'install' : false},
302 'extra_sources' : gdbus_daemon_sources,
305 'gdbus-example-export' : {'install' : false},
306 'gdbus-example-own-name' : {'install' : false},
307 'gdbus-example-peer' : {'install' : false},
308 'gdbus-example-proxy-subclass' : {'install' : false},
309 'gdbus-example-server' : {'install' : false},
310 'gdbus-example-subtree' : {'install' : false},
311 'gdbus-example-watch-name' : {'install' : false},
312 'gdbus-example-watch-proxy' : {'install' : false},
313 'gsubprocess-testprog' : {'install' : false},
314 'httpd' : {'install' : false},
315 'proxy' : {'install' : false},
316 'resolver' : {'install' : false},
317 'send-data' : {'install' : false},
318 'socket-server' : {'install' : false},
320 'extra_sources' : ['gtlsconsoleinteraction.c'],
323 # These three are manual-run tests because they need a session bus but don't bring one up themselves
324 # FIXME: these build but don't seem to work!
325 'gdbus-example-objectmanager-client' : {
326 'dependencies' : [libgdbus_example_objectmanager_dep],
329 'gdbus-example-objectmanager-server' : {
330 'dependencies' : [libgdbus_example_objectmanager_dep],
333 'gdbus-test-fixture' : {
334 'dependencies' : [libgdbus_example_objectmanager_dep],
339 if host_machine.system() != 'windows'
340 test_extra_programs += [{
341 'gdbus-example-unix-fd-client' : {
347 if not meson.is_cross_build() or meson.has_exe_wrapper()
349 plugin_resources_c = custom_target('plugin-resources.c',
350 input : 'test4.gresource.xml',
351 output : 'plugin-resources.c',
352 command : [glib_compile_resources,
354 '--sourcedir=' + meson.current_source_dir(),
356 '--c-name', '_g_plugin',
359 if host_system == 'windows'
360 resource_plugin_platform_link_args = ['-no-undefined']
362 resource_plugin_platform_link_args = []
364 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
365 link_args : export_dynamic_ldflags + resource_plugin_platform_link_args,
366 dependencies : common_gio_tests_deps)
368 test_gresource = custom_target('test.gresource',
369 input : 'test.gresource.xml',
370 output : 'test.gresource',
371 command : [glib_compile_resources,
373 '--sourcedir=' + meson.current_source_dir(),
374 '--sourcedir=' + meson.current_build_dir(),
377 test_resources2_c = custom_target('test_resources2.c',
378 input : 'test3.gresource.xml',
379 output : 'test_resources2.c',
380 command : [glib_compile_resources,
382 '--sourcedir=' + meson.current_source_dir(),
384 '--c-name', '_g_test2',
388 test_resources2_h = custom_target('test_resources2.h',
389 input : 'test3.gresource.xml',
390 output : 'test_resources2.h',
391 command : [glib_compile_resources,
393 '--sourcedir=' + meson.current_source_dir(),
395 '--c-name', '_g_test2',
399 test_resources_c = custom_target('test_resources.c',
400 input : 'test2.gresource.xml',
401 output : 'test_resources.c',
402 command : [glib_compile_resources,
404 '--sourcedir=' + meson.current_source_dir(),
406 '--c-name', '_g_test1',
409 # referenced by test.gresource.xml
410 test_generated_txt = configure_file(input : 'test1.txt',
411 output : 'test-generated.txt',
417 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
423 foreach test_dict : gio_tests
424 foreach test_name, extra_args : test_dict
425 source = extra_args.get('source', test_name + '.c')
426 extra_sources = extra_args.get('extra_sources', [])
427 install = installed_tests_enabled and extra_args.get('install', true)
430 test_conf = configuration_data()
431 test_conf.set('installed_tests_dir', installed_tests_execdir)
432 test_conf.set('program', test_name)
434 input: installed_tests_template,
435 output: test_name + '.test',
436 install_dir: installed_tests_metadir,
437 configuration: test_conf
441 exe = executable(test_name, [source, extra_sources],
442 c_args : test_c_args + extra_args.get('c_args', []),
443 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
444 install_dir: installed_tests_execdir,
448 suite = ['gio'] + extra_args.get('suite', [])
449 timeout = suite.contains('slow') ? 120 : 30
450 test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
454 foreach program_dict : test_extra_programs
455 foreach program_name, extra_args : program_dict
456 source = extra_args.get('source', program_name + '.c')
457 extra_sources = extra_args.get('extra_sources', [])
458 install = installed_tests_enabled and extra_args.get('install', true)
459 executable(program_name, [source, extra_sources],
460 c_args : test_c_args,
461 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
462 install_dir : installed_tests_execdir,
468 # FIXME: subdir('services')