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
31 'async-close-output-stream' : {},
32 'async-splice-output-stream' : {},
33 'buffered-input-stream' : {},
34 'buffered-output-stream' : {},
38 'converter-stream' : {},
40 'data-input-stream' : {},
41 'data-output-stream' : {},
42 'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
43 'fileattributematcher' : {},
44 'filter-streams' : {},
50 'gdbus-addresses' : {},
54 'memory-input-stream' : {},
55 'memory-output-stream' : {},
57 'mount-operation' : {},
58 'network-address' : {'extra_sources': ['mock-resolver.c']},
59 'network-monitor' : {},
60 'network-monitor-race' : {},
65 'simple-async-result' : {},
69 'socket-listener' : {},
70 'socket-service' : {},
76 'testfilemonitor' : {'suite' : ['slow', 'flaky']},
77 'thumbnail-verification' : {},
78 'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']},
79 'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
80 'tls-database' : {'extra_sources' : ['gtesttlsbackend.c']},
83 test_extra_programs = {
84 'gdbus-connection-flush-helper' : {},
85 'gdbus-testserver' : {},
86 'gsubprocess-testprog' : {},
89 test_env = environment()
90 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
91 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
92 test_env.set('GIO_MODULE_DIR', '')
93 test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop')
95 # Check for libdbus1 - Optional - is only used in the GDBus test cases
96 # 1.2.14 required for dbus_message_set_serial
97 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
98 if not dbus1_dep.found()
99 if cc.get_id() == 'msvc'
100 # MSVC: Search for the DBus library by the configuration, which corresponds
101 # to the output of CMake builds of DBus. Note that debugoptimized
102 # is really a Release build with .PDB files.
103 if buildtype == 'debug'
104 dbus1_dep = cc.find_library('dbus-1d', required : false)
106 dbus1_dep = cc.find_library('dbus-1', required : false)
111 glib_conf.set('HAVE_DBUS1', 1)
114 'gdbus-serialization' : {
115 'extra_sources' : ['gdbus-tests.c'],
116 'dependencies' : [dbus1_dep],
121 # Test programs buildable on UNIX only
122 if host_machine.system() != 'windows'
126 'dependencies' : [libgdbus_example_objectmanager_dep],
127 'install_rpath' : installed_tests_execdir
129 'gdbus-peer-object-manager' : {},
131 'socket-address' : {},
132 'stream-rw_all' : {},
136 'g-file-info-filesystem-readonly' : {},
137 'gsocketclient-slow' : {
139 shared_library('slow-connect-preload',
140 'slow-connect-preload.c',
142 dependencies: cc.find_library('dl'),
143 install_dir : installed_tests_execdir,
144 install: installed_tests_enabled,
148 'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(meson.current_build_dir())
150 'installed_tests_env' : {
151 'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(installed_tests_execdir),
154 'gschema-compile' : {'install' : false},
158 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
159 # unable to find the installed executable
160 if not glib_have_cocoa
165 'desktop-app-info' : {
171 test_extra_programs += {
172 'basic-application' : {},
177 if not glib_have_cocoa
178 test_extra_programs += {
186 # Test programs that need to bring up a session bus (requires dbus-daemon)
187 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
190 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
191 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
192 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
193 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
194 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
195 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
196 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
197 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
199 # Generate gdbus-test-codegen-generated.{c,h}
200 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
201 input : ['test-codegen.xml'],
202 output : ['gdbus-test-codegen-generated.h',
203 'gdbus-test-codegen-generated.c'],
204 depend_files : gdbus_codegen_built_files,
205 command : [python, gdbus_codegen,
206 '--interface-prefix', 'org.project.',
207 '--output-directory', '@OUTDIR@',
208 '--generate-c-code', 'gdbus-test-codegen-generated',
209 '--c-generate-object-manager',
210 '--c-generate-autocleanup', 'all',
211 '--c-namespace', 'Foo_iGen',
212 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
216 gdbus_test_codegen_generated_interface_info = [
217 custom_target('gdbus-test-codegen-generated-interface-info-h',
218 input : ['test-codegen.xml'],
219 output : ['gdbus-test-codegen-generated-interface-info.h'],
220 depend_files : gdbus_codegen_built_files,
221 command : [python, gdbus_codegen,
222 '--interface-info-header',
224 '--output', '@OUTPUT@',
226 custom_target('gdbus-test-codegen-generated-interface-info-c',
227 input : ['test-codegen.xml'],
228 output : ['gdbus-test-codegen-generated-interface-info.c'],
229 depend_files : gdbus_codegen_built_files,
230 command : [python, gdbus_codegen,
231 '--interface-info-body',
233 '--output', '@OUTPUT@',
237 extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
241 'extra_sources' : extra_sources,
244 'gdbus-auth' : {'extra_sources' : extra_sources, 'suite': ['flaky']},
245 'gdbus-bz627724' : {'extra_sources' : extra_sources, 'suite': ['flaky']},
246 'gdbus-close-pending' : {'extra_sources' : extra_sources},
247 'gdbus-connection' : {'extra_sources' : extra_sources, 'suite': ['flaky']},
248 'gdbus-connection-loss' : {'extra_sources' : extra_sources},
249 'gdbus-connection-slow' : {'extra_sources' : extra_sources},
250 'gdbus-error' : {'extra_sources' : extra_sources},
251 'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
253 'extra_sources' : extra_sources,
256 'gdbus-introspection' : {'extra_sources' : extra_sources},
257 'gdbus-names' : {'extra_sources' : extra_sources},
258 'gdbus-proxy' : {'extra_sources' : extra_sources},
259 'gdbus-proxy-threads' : {
260 'extra_sources' : extra_sources,
261 'dependencies' : [dbus1_dep],
263 'gdbus-proxy-unique-name' : {'extra_sources' : extra_sources},
264 'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
265 'gdbus-test-codegen' : {
266 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
268 'gdbus-threading' : {
269 'extra_sources' : extra_sources,
270 'suite' : ['slow', 'flaky'],
273 'extra_sources' : extra_sources,
277 'extra_sources' : [extra_sources, 'gnotification-server.c'],
279 'gdbus-test-codegen-old' : {
280 'source' : 'gdbus-test-codegen.c',
281 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
282 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
283 '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
285 'gapplication' : {'extra_sources' : extra_sources},
286 'gdbus-unix-addresses' : {},
289 if not glib_have_cocoa
292 'extra_sources' : extra_sources,
296 endif # have_dbus_daemon
298 # This test is currently unreliable
299 executable('gdbus-overflow', 'gdbus-overflow.c',
300 c_args : test_c_args,
301 dependencies : common_gio_tests_deps,
302 install_dir : installed_tests_execdir,
303 install : installed_tests_enabled)
306 'gdbus-connection-flush' : {
307 'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
309 'gdbus-non-socket' : {
310 'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
314 # Generate test.mo from de.po using msgfmt
315 msgfmt = find_program('msgfmt', required : false)
317 subdir('de/LC_MESSAGES')
320 'extra_sources' : [test_mo],
321 'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
322 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
329 # Test programs buildable on Windows only
330 if host_machine.system() == 'windows'
331 gio_tests += {'win32-streams' : {}}
334 if cc.get_id() != 'msvc'
337 'source' : 'autoptr.c',
342 test_extra_programs += {
343 'gio-du' : {'install' : false},
344 'echo-server' : {'install' : false},
345 'filter-cat' : {'install' : false},
346 'gapplication-example-actions' : {'install' : false},
347 'gapplication-example-cmdline' : {'install' : false},
348 'gapplication-example-cmdline2' : {'install' : false},
349 'gapplication-example-cmdline3' : {'install' : false},
350 'gapplication-example-cmdline4' : {'install' : false},
351 'gapplication-example-dbushooks' : {'install' : false},
352 'gapplication-example-open' : {'install' : false},
354 'extra_sources' : gdbus_daemon_sources,
357 'gdbus-example-export' : {'install' : false},
358 'gdbus-example-own-name' : {'install' : false},
359 'gdbus-example-peer' : {'install' : false},
360 'gdbus-example-proxy-subclass' : {'install' : false},
361 'gdbus-example-server' : {'install' : false},
362 'gdbus-example-subtree' : {'install' : false},
363 'gdbus-example-watch-name' : {'install' : false},
364 'gdbus-example-watch-proxy' : {'install' : false},
365 'httpd' : {'install' : false},
366 'proxy' : {'install' : false},
367 'resolver' : {'install' : false},
368 'send-data' : {'install' : false},
369 'socket-server' : {'install' : false},
371 'extra_sources' : ['gtlsconsoleinteraction.c'],
376 if cc.get_id() != 'msvc'
377 test_extra_programs += {
378 # These three are manual-run tests because they need a session bus but don't bring one up themselves
379 # FIXME: these build but don't seem to work!
380 'gdbus-example-objectmanager-client' : {
381 'dependencies' : [libgdbus_example_objectmanager_dep],
384 'gdbus-example-objectmanager-server' : {
385 'dependencies' : [libgdbus_example_objectmanager_dep],
388 'gdbus-test-fixture' : {
389 'dependencies' : [libgdbus_example_objectmanager_dep],
395 if host_machine.system() != 'windows'
396 test_extra_programs += {
397 'gdbus-example-unix-fd-client' : {
403 appinfo_test_desktop_files = [
404 'appinfo-test-gnome.desktop',
405 'appinfo-test-notgnome.desktop',
406 'appinfo-test.desktop',
407 'appinfo-test2.desktop',
410 cdata = configuration_data()
411 if installed_tests_enabled
412 cdata.set('installed_tests_dir', installed_tests_execdir)
414 cdata.set('installed_tests_dir', meson.current_build_dir())
417 foreach appinfo_test_desktop_file : appinfo_test_desktop_files
419 input: appinfo_test_desktop_file + '.in',
420 output: appinfo_test_desktop_file,
421 install_dir: installed_tests_execdir,
422 install: installed_tests_enabled,
423 configuration: cdata,
427 if installed_tests_enabled
431 'appinfo-test-actions.desktop',
432 'appinfo-test-static.desktop',
434 'org.gtk.test.dbusappinfo.desktop',
436 install_dir : installed_tests_execdir,
438 install_subdir('x-content', install_dir : installed_tests_execdir)
439 install_subdir('desktop-files', install_dir : installed_tests_execdir)
440 install_subdir('thumbnails', install_dir : installed_tests_execdir)
441 install_subdir('cert-tests', install_dir : installed_tests_execdir)
443 cdata = configuration_data()
444 cdata.set('installed_tests_dir', installed_tests_execdir)
445 cdata.set('program', 'static-link.py ' + glib_pkgconfigreldir)
447 input: installed_tests_template,
448 output: 'static-link.test',
449 install_dir: installed_tests_metadir,
452 install_subdir('static-link', install_dir : installed_tests_execdir)
453 install_data('static-link.py', install_dir : installed_tests_execdir)
456 if not meson.is_cross_build() or meson.has_exe_wrapper()
458 plugin_resources_c = custom_target('plugin-resources.c',
459 input : 'test4.gresource.xml',
460 output : 'plugin-resources.c',
461 command : [glib_compile_resources,
463 '--sourcedir=' + meson.current_source_dir(),
465 '--c-name', '_g_plugin',
468 shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
469 link_args : export_dynamic_ldflags,
470 dependencies : common_gio_tests_deps,
471 install_dir : installed_tests_execdir,
472 install : installed_tests_enabled
475 # referenced by test2.gresource.xml
476 big_test_resource = custom_target(
477 'gresource-big-test.txt',
478 input : ['gen-big-test-resource.py'],
479 output : ['gresource-big-test.txt'],
480 command : [python, '@INPUT0@', '@OUTPUT@'])
482 test_gresource = custom_target('test.gresource',
483 input : 'test.gresource.xml',
484 output : 'test.gresource',
485 command : [glib_compile_resources,
487 '--sourcedir=' + meson.current_source_dir(),
488 '--sourcedir=' + meson.current_build_dir(),
490 install_dir : installed_tests_execdir,
491 install : installed_tests_enabled)
493 test_resources2_c = custom_target('test_resources2.c',
494 input : 'test3.gresource.xml',
495 output : 'test_resources2.c',
496 command : [glib_compile_resources,
498 '--sourcedir=' + meson.current_source_dir(),
500 '--c-name', '_g_test2',
504 test_resources2_h = custom_target('test_resources2.h',
505 input : 'test3.gresource.xml',
506 output : 'test_resources2.h',
507 command : [glib_compile_resources,
509 '--sourcedir=' + meson.current_source_dir(),
511 '--c-name', '_g_test2',
515 test_resources_c = custom_target('test_resources.c',
516 input : 'test2.gresource.xml',
517 depends : big_test_resource,
518 output : 'test_resources.c',
519 command : [glib_compile_resources,
521 '--sourcedir=' + meson.current_source_dir(),
522 '--sourcedir=' + meson.current_build_dir(),
524 '--c-name', '_g_test1',
527 digit_test_resources_c = custom_target('digit_test_resources.c',
528 input : '111_digit_test.gresource.xml',
529 output : 'digit_test_resources.c',
530 command : [glib_compile_resources,
532 '--sourcedir=' + meson.current_source_dir(),
533 '--sourcedir=' + meson.current_build_dir(),
538 digit_test_resources_h = custom_target('digit_test_resources.h',
539 input : '111_digit_test.gresource.xml',
540 output : 'digit_test_resources.h',
541 command : [glib_compile_resources,
543 '--sourcedir=' + meson.current_source_dir(),
548 # referenced by test.gresource.xml
549 test_generated_txt = configure_file(input : 'test1.txt',
550 output : 'test-generated.txt',
554 # Create object file containing resource data
555 # for testing the external data option
556 if build_machine.system() == 'linux'
557 test_gresource_binary = custom_target('test5.gresource',
558 input : 'test5.gresource.xml',
559 output : 'test5.gresource',
560 command : [glib_compile_resources,
562 '--sourcedir=' + meson.current_source_dir(),
563 '--sourcedir=' + meson.current_build_dir(),
565 install_dir : installed_tests_execdir,
566 install : installed_tests_enabled)
568 # Create resource data file
569 test_resources_binary_c = custom_target('test_resources_binary.c',
570 input : 'test5.gresource.xml',
571 output : 'test_resources_binary.c',
572 command : [glib_compile_resources,
574 '--sourcedir=' + meson.current_source_dir(),
575 '--sourcedir=' + meson.current_build_dir(),
578 '--c-name', '_g_binary_test1',
581 # Create object file containing resource data
582 test_resources_binary = custom_target('test_resources.o',
583 input : test_gresource_binary,
584 output : 'test_resources.o',
591 # Rename symbol to match the one in the C file
592 test_resources_binary2 = custom_target('test_resources2.o',
593 input : test_resources_binary,
594 output : 'test_resources2.o',
595 command : ['objcopy',
596 '--add-symbol','_g_binary_test1_resource_data=.data:0',
602 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
603 test_resources2_h, test_resources_binary_c,
604 test_resources_binary2, digit_test_resources_c, digit_test_resources_h],
610 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
611 test_resources2_h, digit_test_resources_c, digit_test_resources_h],
617 foreach test_name, extra_args : gio_tests
618 source = extra_args.get('source', test_name + '.c')
619 extra_sources = extra_args.get('extra_sources', [])
620 install = installed_tests_enabled and extra_args.get('install', true)
621 installed_tests_env = extra_args.get('installed_tests_env', {})
624 test_conf = configuration_data()
625 test_conf.set('installed_tests_dir', installed_tests_execdir)
626 test_conf.set('program', test_name)
627 test_env_override = ''
628 if installed_tests_env != {}
630 foreach var, value : installed_tests_env
631 envs += '@0@=@1@'.format(var, value)
633 test_env_override = '@0@ @1@ '.format(env_program.path(), ' '.join(envs))
635 test_conf.set('env', test_env_override)
637 input: installed_tests_template_tap,
638 output: test_name + '.test',
639 install_dir: installed_tests_metadir,
640 configuration: test_conf
644 exe = executable(test_name, [source, extra_sources],
645 c_args : test_c_args + extra_args.get('c_args', []),
646 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
647 install_rpath : extra_args.get('install_rpath', ''),
648 install_dir: installed_tests_execdir,
652 suite = ['gio'] + extra_args.get('suite', [])
653 timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
654 local_test_env = test_env
656 foreach var, value : extra_args.get('env', {})
657 local_test_env.append(var, value)
661 env : local_test_env,
665 is_parallel : extra_args.get('is_parallel', true),
666 depends : extra_args.get('depends', []),
670 foreach program_name, extra_args : test_extra_programs
671 source = extra_args.get('source', program_name + '.c')
672 extra_sources = extra_args.get('extra_sources', [])
673 install = installed_tests_enabled and extra_args.get('install', true)
674 executable(program_name, [source, extra_sources],
675 c_args : test_c_args,
676 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
677 install_dir : installed_tests_execdir,
682 # FIXME: subdir('services')