1 common_gio_tests_deps = [
9 '-DG_LOG_DOMAIN="GLib-GIO"',
10 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
11 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
12 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
15 if host_machine.system() == 'windows'
16 common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
19 subdir('gdbus-object-manager-example')
21 gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
22 giotypefuncs_inc = custom_target(
24 output : 'giotypefuncs.inc',
25 input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
26 command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
28 # Test programs buildable on all platforms
29 # FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
30 # that supports '+=' operator on dictionnaries.
33 'async-close-output-stream' : {},
34 'async-splice-output-stream' : {},
35 'buffered-input-stream' : {},
36 'buffered-output-stream' : {},
40 'converter-stream' : {},
42 'data-input-stream' : {},
43 'data-output-stream' : {},
44 'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
45 'fileattributematcher' : {},
46 'filter-streams' : {},
52 'gdbus-addresses' : {},
56 'memory-input-stream' : {},
57 'memory-output-stream' : {},
59 'mount-operation' : {},
60 'network-address' : {},
61 'network-monitor' : {},
62 'network-monitor-race' : {},
67 'simple-async-result' : {},
71 'socket-listener' : {},
72 'socket-service' : {},
78 'testfilemonitor' : {'suite' : ['slow']},
79 'thumbnail-verification' : {},
80 'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']},
81 'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
84 # FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
85 # that supports '+=' operator on dictionnaries.
86 test_extra_programs = [{
87 'gdbus-connection-flush-helper' : {},
88 'gdbus-testserver' : {},
89 'gsubprocess-testprog' : {},
92 test_env = environment()
93 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
94 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
95 test_env.set('GIO_MODULE_DIR', '')
96 test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop')
98 # Check for libdbus1 - Optional - is only used in the GDBus test cases
99 # 1.2.14 required for dbus_message_set_serial
100 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
101 if not dbus1_dep.found()
102 if cc.get_id() == 'msvc'
103 # MSVC: Search for the DBus library by the configuration, which corresponds
104 # to the output of CMake builds of DBus. Note that debugoptimized
105 # is really a Release build with .PDB files.
106 if buildtype == 'debug'
107 dbus1_dep = cc.find_library('dbus-1d', required : false)
109 dbus1_dep = cc.find_library('dbus-1', required : false)
114 glib_conf.set('HAVE_DBUS1', 1)
117 'gdbus-serialization' : {
118 'extra_sources' : ['gdbus-tests.c'],
119 'dependencies' : [dbus1_dep],
124 # Test programs buildable on UNIX only
125 if host_machine.system() != 'windows'
129 'dependencies' : [libgdbus_example_objectmanager_dep],
130 'install_rpath' : installed_tests_execdir
132 'gdbus-peer-object-manager' : {},
134 'socket-address' : {},
135 'stream-rw_all' : {},
139 'g-file-info-filesystem-readonly' : {},
140 'gschema-compile' : {'install' : false},
144 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
145 # unable to find the installed executable
146 if not glib_have_cocoa
150 'is_parallel' : false,
152 'desktop-app-info' : {
154 'is_parallel' : false,
159 test_extra_programs += [{
160 'basic-application' : {},
165 if not glib_have_cocoa
166 test_extra_programs += [{
174 # Test programs that need to bring up a session bus (requires dbus-daemon)
175 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
178 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
179 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
180 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
181 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
182 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
183 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
184 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
185 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
187 # Generate gdbus-test-codegen-generated.{c,h}
188 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
189 input : ['test-codegen.xml'],
190 output : ['gdbus-test-codegen-generated.h',
191 'gdbus-test-codegen-generated.c'],
192 depend_files : gdbus_codegen_built_files,
193 command : [python, gdbus_codegen,
194 '--interface-prefix', 'org.project.',
195 '--output-directory', '@OUTDIR@',
196 '--generate-c-code', 'gdbus-test-codegen-generated',
197 '--c-generate-object-manager',
198 '--c-generate-autocleanup', 'all',
199 '--c-namespace', 'Foo_iGen',
200 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
204 gdbus_test_codegen_generated_interface_info = [
205 custom_target('gdbus-test-codegen-generated-interface-info-h',
206 input : ['test-codegen.xml'],
207 output : ['gdbus-test-codegen-generated-interface-info.h'],
208 depend_files : gdbus_codegen_built_files,
209 command : [python, gdbus_codegen,
210 '--interface-info-header',
212 '--output', '@OUTPUT@',
214 custom_target('gdbus-test-codegen-generated-interface-info-c',
215 input : ['test-codegen.xml'],
216 output : ['gdbus-test-codegen-generated-interface-info.c'],
217 depend_files : gdbus_codegen_built_files,
218 command : [python, gdbus_codegen,
219 '--interface-info-body',
221 '--output', '@OUTPUT@',
225 extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
229 'extra_sources' : extra_sources,
232 'gdbus-auth' : {'extra_sources' : extra_sources},
233 'gdbus-bz627724' : {'extra_sources' : extra_sources},
234 'gdbus-close-pending' : {'extra_sources' : extra_sources},
235 'gdbus-connection' : {'extra_sources' : extra_sources},
236 'gdbus-connection-loss' : {'extra_sources' : extra_sources},
237 'gdbus-connection-slow' : {'extra_sources' : extra_sources},
238 'gdbus-error' : {'extra_sources' : extra_sources},
239 'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
241 'extra_sources' : extra_sources,
244 'gdbus-introspection' : {'extra_sources' : extra_sources},
245 'gdbus-names' : {'extra_sources' : extra_sources},
246 'gdbus-proxy' : {'extra_sources' : extra_sources},
247 'gdbus-proxy-threads' : {
248 'extra_sources' : extra_sources,
249 'dependencies' : [dbus1_dep],
251 'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
252 'gdbus-test-codegen' : {
253 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
255 'gdbus-threading' : {
256 'extra_sources' : extra_sources,
260 'extra_sources' : extra_sources,
264 'extra_sources' : [extra_sources, 'gnotification-server.c'],
266 'gdbus-test-codegen-old' : {
267 'source' : 'gdbus-test-codegen.c',
268 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
269 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
270 '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
272 'gapplication' : {'extra_sources' : extra_sources},
273 'gdbus-unix-addresses' : {},
276 if not glib_have_cocoa
279 'extra_sources' : extra_sources,
283 endif # have_dbus_daemon
285 # This test is currently unreliable
286 executable('gdbus-overflow', 'gdbus-overflow.c',
287 c_args : test_c_args,
288 dependencies : common_gio_tests_deps,
289 install_dir : installed_tests_execdir,
290 install : installed_tests_enabled)
293 'gdbus-connection-flush' : {
294 'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
296 'gdbus-non-socket' : {
297 'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
301 # Generate test.mo from de.po using msgfmt
302 msgfmt = find_program('msgfmt', required : false)
304 subdir('de/LC_MESSAGES')
307 'extra_sources' : [test_mo],
308 'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
309 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
316 # Test programs buildable on Windows only
317 if host_machine.system() == 'windows'
318 gio_tests += [{'win32-streams' : {}}]
321 if cc.get_id() != 'msvc'
324 'source' : 'autoptr.c',
329 test_extra_programs += [{
330 'gio-du' : {'install' : false},
331 'echo-server' : {'install' : false},
332 'filter-cat' : {'install' : false},
333 'gapplication-example-actions' : {'install' : false},
334 'gapplication-example-cmdline' : {'install' : false},
335 'gapplication-example-cmdline2' : {'install' : false},
336 'gapplication-example-cmdline3' : {'install' : false},
337 'gapplication-example-cmdline4' : {'install' : false},
338 'gapplication-example-dbushooks' : {'install' : false},
339 'gapplication-example-open' : {'install' : false},
341 'extra_sources' : gdbus_daemon_sources,
344 'gdbus-example-export' : {'install' : false},
345 'gdbus-example-own-name' : {'install' : false},
346 'gdbus-example-peer' : {'install' : false},
347 'gdbus-example-proxy-subclass' : {'install' : false},
348 'gdbus-example-server' : {'install' : false},
349 'gdbus-example-subtree' : {'install' : false},
350 'gdbus-example-watch-name' : {'install' : false},
351 'gdbus-example-watch-proxy' : {'install' : false},
352 'httpd' : {'install' : false},
353 'proxy' : {'install' : false},
354 'resolver' : {'install' : false},
355 'send-data' : {'install' : false},
356 'socket-server' : {'install' : false},
358 'extra_sources' : ['gtlsconsoleinteraction.c'],
363 if cc.get_id() != 'msvc'
364 test_extra_programs += [{
365 # These three are manual-run tests because they need a session bus but don't bring one up themselves
366 # FIXME: these build but don't seem to work!
367 'gdbus-example-objectmanager-client' : {
368 'dependencies' : [libgdbus_example_objectmanager_dep],
371 'gdbus-example-objectmanager-server' : {
372 'dependencies' : [libgdbus_example_objectmanager_dep],
375 'gdbus-test-fixture' : {
376 'dependencies' : [libgdbus_example_objectmanager_dep],
382 if host_machine.system() != 'windows'
383 test_extra_programs += [{
384 'gdbus-example-unix-fd-client' : {
390 if installed_tests_enabled
394 'appinfo-test-actions.desktop',
395 'appinfo-test-gnome.desktop',
396 'appinfo-test-notgnome.desktop',
397 'appinfo-test.desktop',
398 'appinfo-test2.desktop',
400 'org.gtk.test.dbusappinfo.desktop',
401 install_dir : installed_tests_execdir,
403 install_subdir('x-content', install_dir : installed_tests_execdir)
404 install_subdir('desktop-files', install_dir : installed_tests_execdir)
405 install_subdir('thumbnails', install_dir : installed_tests_execdir)
406 install_subdir('cert-tests', install_dir : installed_tests_execdir)
409 if not meson.is_cross_build() or meson.has_exe_wrapper()
411 plugin_resources_c = custom_target('plugin-resources.c',
412 input : 'test4.gresource.xml',
413 output : 'plugin-resources.c',
414 command : [glib_compile_resources,
416 '--sourcedir=' + meson.current_source_dir(),
418 '--c-name', '_g_plugin',
421 shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
422 link_args : export_dynamic_ldflags,
423 dependencies : common_gio_tests_deps,
424 install_dir : installed_tests_execdir,
425 install : installed_tests_enabled
428 test_gresource = custom_target('test.gresource',
429 input : 'test.gresource.xml',
430 output : 'test.gresource',
431 command : [glib_compile_resources,
433 '--sourcedir=' + meson.current_source_dir(),
434 '--sourcedir=' + meson.current_build_dir(),
436 install_dir : installed_tests_execdir,
437 install : installed_tests_enabled)
439 test_resources2_c = custom_target('test_resources2.c',
440 input : 'test3.gresource.xml',
441 output : 'test_resources2.c',
442 command : [glib_compile_resources,
444 '--sourcedir=' + meson.current_source_dir(),
446 '--c-name', '_g_test2',
450 test_resources2_h = custom_target('test_resources2.h',
451 input : 'test3.gresource.xml',
452 output : 'test_resources2.h',
453 command : [glib_compile_resources,
455 '--sourcedir=' + meson.current_source_dir(),
457 '--c-name', '_g_test2',
461 test_resources_c = custom_target('test_resources.c',
462 input : 'test2.gresource.xml',
463 output : 'test_resources.c',
464 command : [glib_compile_resources,
466 '--sourcedir=' + meson.current_source_dir(),
468 '--c-name', '_g_test1',
471 # referenced by test.gresource.xml
472 test_generated_txt = configure_file(input : 'test1.txt',
473 output : 'test-generated.txt',
479 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
485 foreach test_dict : gio_tests
486 foreach test_name, extra_args : test_dict
487 source = extra_args.get('source', test_name + '.c')
488 extra_sources = extra_args.get('extra_sources', [])
489 install = installed_tests_enabled and extra_args.get('install', true)
492 test_conf = configuration_data()
493 test_conf.set('installed_tests_dir', installed_tests_execdir)
494 test_conf.set('program', test_name)
496 input: installed_tests_template_tap,
497 output: test_name + '.test',
498 install_dir: installed_tests_metadir,
499 configuration: test_conf
503 exe = executable(test_name, [source, extra_sources],
504 c_args : test_c_args + extra_args.get('c_args', []),
505 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
506 install_rpath : extra_args.get('install_rpath', ''),
507 install_dir: installed_tests_execdir,
511 suite = ['gio'] + extra_args.get('suite', [])
512 timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
518 is_parallel : extra_args.get('is_parallel', true),
523 foreach program_dict : test_extra_programs
524 foreach program_name, extra_args : program_dict
525 source = extra_args.get('source', program_name + '.c')
526 extra_sources = extra_args.get('extra_sources', [])
527 install = installed_tests_enabled and extra_args.get('install', true)
528 executable(program_name, [source, extra_sources],
529 c_args : test_c_args,
530 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
531 install_dir : installed_tests_execdir,
537 # FIXME: subdir('services')