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'], 'suite': ['flaky']},
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'),
146 'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(meson.current_build_dir())
150 'gschema-compile' : {'install' : false},
154 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
155 # unable to find the installed executable
156 if not glib_have_cocoa
161 'desktop-app-info' : {
167 test_extra_programs += {
168 'basic-application' : {},
173 if not glib_have_cocoa
174 test_extra_programs += {
182 # Test programs that need to bring up a session bus (requires dbus-daemon)
183 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
186 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
187 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
188 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
189 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
190 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
191 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
192 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
193 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
195 # Generate gdbus-test-codegen-generated.{c,h}
196 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
197 input : ['test-codegen.xml'],
198 output : ['gdbus-test-codegen-generated.h',
199 'gdbus-test-codegen-generated.c'],
200 depend_files : gdbus_codegen_built_files,
201 command : [python, gdbus_codegen,
202 '--interface-prefix', 'org.project.',
203 '--output-directory', '@OUTDIR@',
204 '--generate-c-code', 'gdbus-test-codegen-generated',
205 '--c-generate-object-manager',
206 '--c-generate-autocleanup', 'all',
207 '--c-namespace', 'Foo_iGen',
208 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
212 gdbus_test_codegen_generated_interface_info = [
213 custom_target('gdbus-test-codegen-generated-interface-info-h',
214 input : ['test-codegen.xml'],
215 output : ['gdbus-test-codegen-generated-interface-info.h'],
216 depend_files : gdbus_codegen_built_files,
217 command : [python, gdbus_codegen,
218 '--interface-info-header',
220 '--output', '@OUTPUT@',
222 custom_target('gdbus-test-codegen-generated-interface-info-c',
223 input : ['test-codegen.xml'],
224 output : ['gdbus-test-codegen-generated-interface-info.c'],
225 depend_files : gdbus_codegen_built_files,
226 command : [python, gdbus_codegen,
227 '--interface-info-body',
229 '--output', '@OUTPUT@',
233 extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
237 'extra_sources' : extra_sources,
240 'gdbus-auth' : {'extra_sources' : extra_sources, 'suite': ['flaky']},
241 'gdbus-bz627724' : {'extra_sources' : extra_sources, 'suite': ['flaky']},
242 'gdbus-close-pending' : {'extra_sources' : extra_sources},
243 'gdbus-connection' : {'extra_sources' : extra_sources, 'suite': ['flaky']},
244 'gdbus-connection-loss' : {'extra_sources' : extra_sources},
245 'gdbus-connection-slow' : {'extra_sources' : extra_sources},
246 'gdbus-error' : {'extra_sources' : extra_sources},
247 'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
249 'extra_sources' : extra_sources,
252 'gdbus-introspection' : {'extra_sources' : extra_sources},
253 'gdbus-names' : {'extra_sources' : extra_sources},
254 'gdbus-proxy' : {'extra_sources' : extra_sources},
255 'gdbus-proxy-threads' : {
256 'extra_sources' : extra_sources,
257 'dependencies' : [dbus1_dep],
259 'gdbus-proxy-unique-name' : {'extra_sources' : extra_sources},
260 'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
261 'gdbus-test-codegen' : {
262 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
264 'gdbus-threading' : {
265 'extra_sources' : extra_sources,
266 'suite' : ['slow', 'flaky'],
269 'extra_sources' : extra_sources,
273 'extra_sources' : [extra_sources, 'gnotification-server.c'],
275 'gdbus-test-codegen-old' : {
276 'source' : 'gdbus-test-codegen.c',
277 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
278 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
279 '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
281 'gapplication' : {'extra_sources' : extra_sources},
282 'gdbus-unix-addresses' : {},
285 if not glib_have_cocoa
288 'extra_sources' : extra_sources,
292 endif # have_dbus_daemon
294 # This test is currently unreliable
295 executable('gdbus-overflow', 'gdbus-overflow.c',
296 c_args : test_c_args,
297 dependencies : common_gio_tests_deps,
298 install_dir : installed_tests_execdir,
299 install : installed_tests_enabled)
302 'gdbus-connection-flush' : {
303 'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
305 'gdbus-non-socket' : {
306 'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
310 # Generate test.mo from de.po using msgfmt
311 msgfmt = find_program('msgfmt', required : false)
313 subdir('de/LC_MESSAGES')
316 'extra_sources' : [test_mo],
317 'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
318 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
325 # Test programs buildable on Windows only
326 if host_machine.system() == 'windows'
327 gio_tests += {'win32-streams' : {}}
330 if cc.get_id() != 'msvc'
333 'source' : 'autoptr.c',
338 test_extra_programs += {
339 'gio-du' : {'install' : false},
340 'echo-server' : {'install' : false},
341 'filter-cat' : {'install' : false},
342 'gapplication-example-actions' : {'install' : false},
343 'gapplication-example-cmdline' : {'install' : false},
344 'gapplication-example-cmdline2' : {'install' : false},
345 'gapplication-example-cmdline3' : {'install' : false},
346 'gapplication-example-cmdline4' : {'install' : false},
347 'gapplication-example-dbushooks' : {'install' : false},
348 'gapplication-example-open' : {'install' : false},
350 'extra_sources' : gdbus_daemon_sources,
353 'gdbus-example-export' : {'install' : false},
354 'gdbus-example-own-name' : {'install' : false},
355 'gdbus-example-peer' : {'install' : false},
356 'gdbus-example-proxy-subclass' : {'install' : false},
357 'gdbus-example-server' : {'install' : false},
358 'gdbus-example-subtree' : {'install' : false},
359 'gdbus-example-watch-name' : {'install' : false},
360 'gdbus-example-watch-proxy' : {'install' : false},
361 'httpd' : {'install' : false},
362 'proxy' : {'install' : false},
363 'resolver' : {'install' : false},
364 'send-data' : {'install' : false},
365 'socket-server' : {'install' : false},
367 'extra_sources' : ['gtlsconsoleinteraction.c'],
372 if cc.get_id() != 'msvc'
373 test_extra_programs += {
374 # These three are manual-run tests because they need a session bus but don't bring one up themselves
375 # FIXME: these build but don't seem to work!
376 'gdbus-example-objectmanager-client' : {
377 'dependencies' : [libgdbus_example_objectmanager_dep],
380 'gdbus-example-objectmanager-server' : {
381 'dependencies' : [libgdbus_example_objectmanager_dep],
384 'gdbus-test-fixture' : {
385 'dependencies' : [libgdbus_example_objectmanager_dep],
391 if host_machine.system() != 'windows'
392 test_extra_programs += {
393 'gdbus-example-unix-fd-client' : {
399 appinfo_test_desktop_files = [
400 'appinfo-test-gnome.desktop',
401 'appinfo-test-notgnome.desktop',
402 'appinfo-test.desktop',
403 'appinfo-test2.desktop',
406 cdata = configuration_data()
407 if installed_tests_enabled
408 cdata.set('installed_tests_dir', installed_tests_execdir)
410 cdata.set('installed_tests_dir', meson.current_build_dir())
413 foreach appinfo_test_desktop_file : appinfo_test_desktop_files
415 input: appinfo_test_desktop_file + '.in',
416 output: appinfo_test_desktop_file,
417 install_dir: installed_tests_execdir,
418 install: installed_tests_enabled,
419 configuration: cdata,
423 if installed_tests_enabled
427 'appinfo-test-actions.desktop',
428 'appinfo-test-static.desktop',
430 'org.gtk.test.dbusappinfo.desktop',
431 install_dir : installed_tests_execdir,
433 install_subdir('x-content', install_dir : installed_tests_execdir)
434 install_subdir('desktop-files', install_dir : installed_tests_execdir)
435 install_subdir('thumbnails', install_dir : installed_tests_execdir)
436 install_subdir('cert-tests', install_dir : installed_tests_execdir)
438 cdata = configuration_data()
439 cdata.set('installed_tests_dir', installed_tests_execdir)
440 cdata.set('program', 'static-link.py ' + glib_pkgconfigreldir)
442 input: installed_tests_template,
443 output: 'static-link.test',
444 install_dir: installed_tests_metadir,
447 install_subdir('static-link', install_dir : installed_tests_execdir)
448 install_data('static-link.py', install_dir : installed_tests_execdir)
451 if not meson.is_cross_build() or meson.has_exe_wrapper()
453 plugin_resources_c = custom_target('plugin-resources.c',
454 input : 'test4.gresource.xml',
455 output : 'plugin-resources.c',
456 command : [glib_compile_resources,
458 '--sourcedir=' + meson.current_source_dir(),
460 '--c-name', '_g_plugin',
463 shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
464 link_args : export_dynamic_ldflags,
465 dependencies : common_gio_tests_deps,
466 install_dir : installed_tests_execdir,
467 install : installed_tests_enabled
470 # referenced by test2.gresource.xml
471 big_test_resource = custom_target(
472 'gresource-big-test.txt',
473 input : ['gen-big-test-resource.py'],
474 output : ['gresource-big-test.txt'],
475 command : [python, '@INPUT0@', '@OUTPUT@'])
477 test_gresource = custom_target('test.gresource',
478 input : 'test.gresource.xml',
479 output : 'test.gresource',
480 command : [glib_compile_resources,
482 '--sourcedir=' + meson.current_source_dir(),
483 '--sourcedir=' + meson.current_build_dir(),
485 install_dir : installed_tests_execdir,
486 install : installed_tests_enabled)
488 test_resources2_c = custom_target('test_resources2.c',
489 input : 'test3.gresource.xml',
490 output : 'test_resources2.c',
491 command : [glib_compile_resources,
493 '--sourcedir=' + meson.current_source_dir(),
495 '--c-name', '_g_test2',
499 test_resources2_h = custom_target('test_resources2.h',
500 input : 'test3.gresource.xml',
501 output : 'test_resources2.h',
502 command : [glib_compile_resources,
504 '--sourcedir=' + meson.current_source_dir(),
506 '--c-name', '_g_test2',
510 test_resources_c = custom_target('test_resources.c',
511 input : 'test2.gresource.xml',
512 depends : big_test_resource,
513 output : 'test_resources.c',
514 command : [glib_compile_resources,
516 '--sourcedir=' + meson.current_source_dir(),
517 '--sourcedir=' + meson.current_build_dir(),
519 '--c-name', '_g_test1',
522 # referenced by test.gresource.xml
523 test_generated_txt = configure_file(input : 'test1.txt',
524 output : 'test-generated.txt',
528 # Create object file containing resource data
529 # for testing the external data option
530 if build_machine.system() == 'linux'
531 test_gresource_binary = custom_target('test5.gresource',
532 input : 'test5.gresource.xml',
533 output : 'test5.gresource',
534 command : [glib_compile_resources,
536 '--sourcedir=' + meson.current_source_dir(),
537 '--sourcedir=' + meson.current_build_dir(),
539 install_dir : installed_tests_execdir,
540 install : installed_tests_enabled)
542 # Create resource data file
543 test_resources_binary_c = custom_target('test_resources_binary.c',
544 input : 'test5.gresource.xml',
545 output : 'test_resources_binary.c',
546 command : [glib_compile_resources,
548 '--sourcedir=' + meson.current_source_dir(),
549 '--sourcedir=' + meson.current_build_dir(),
552 '--c-name', '_g_binary_test1',
555 # Create object file containing resource data
556 test_resources_binary = custom_target('test_resources.o',
557 input : test_gresource_binary,
558 output : 'test_resources.o',
565 # Rename symbol to match the one in the C file
566 test_resources_binary2 = custom_target('test_resources2.o',
567 input : test_resources_binary,
568 output : 'test_resources2.o',
569 command : ['objcopy',
570 '--add-symbol','_g_binary_test1_resource_data=.data:0',
576 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
577 test_resources2_h, test_resources_binary_c,
578 test_resources_binary2],
584 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
591 foreach test_name, extra_args : gio_tests
592 source = extra_args.get('source', test_name + '.c')
593 extra_sources = extra_args.get('extra_sources', [])
594 install = installed_tests_enabled and extra_args.get('install', true)
597 test_conf = configuration_data()
598 test_conf.set('installed_tests_dir', installed_tests_execdir)
599 test_conf.set('program', test_name)
601 input: installed_tests_template_tap,
602 output: test_name + '.test',
603 install_dir: installed_tests_metadir,
604 configuration: test_conf
608 exe = executable(test_name, [source, extra_sources],
609 c_args : test_c_args + extra_args.get('c_args', []),
610 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
611 install_rpath : extra_args.get('install_rpath', ''),
612 install_dir: installed_tests_execdir,
616 suite = ['gio'] + extra_args.get('suite', [])
617 timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
618 local_test_env = test_env
620 foreach var, value : extra_args.get('env', {})
621 local_test_env.append(var, value)
625 env : local_test_env,
629 is_parallel : extra_args.get('is_parallel', true),
630 depends : extra_args.get('depends', []),
634 foreach program_name, extra_args : test_extra_programs
635 source = extra_args.get('source', program_name + '.c')
636 extra_sources = extra_args.get('extra_sources', [])
637 install = installed_tests_enabled and extra_args.get('install', true)
638 executable(program_name, [source, extra_sources],
639 c_args : test_c_args,
640 dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
641 install_dir : installed_tests_execdir,
646 # FIXME: subdir('services')