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
20 'async-close-output-stream',
21 'async-splice-output-stream',
22 'buffered-input-stream',
23 'buffered-output-stream',
32 'fileattributematcher',
43 'memory-input-stream',
44 'memory-output-stream',
49 'network-monitor-race',
54 'simple-async-result',
66 'thumbnail-verification',
77 test_extra_programs = [
78 ['gdbus-connection-flush-helper'],
82 test_env = environment()
83 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
84 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
85 test_env.set('GIO_MODULE_DIR', '')
86 test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop')
89 '-DG_LOG_DOMAIN="GLib-GIO"',
90 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
91 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
92 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
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)
113 exe = executable('gdbus-serialization',
114 'gdbus-serialization.c', 'gdbus-tests.c',
116 c_args : test_c_args,
117 dependencies : common_gio_tests_deps + [dbus1_dep])
118 test('gdbus-serialization', exe, env : test_env, suite : ['gio'])
121 # Test programs buildable on UNIX only
122 if host_machine.system() != 'windows'
126 'gdbus-peer-object-manager',
133 'g-file-info-filesystem-readonly',
138 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
139 # unable to find the installed executable
140 if not glib_have_cocoa
147 test_extra_programs += [
148 ['basic-application'],
153 if not glib_have_cocoa
154 test_extra_programs += [['apps']]
155 gio_tests += ['mimeapps']
158 # Test programs that need to bring up a session bus (requires dbus-daemon)
159 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
161 # Generate gdbus-test-codegen-generated.{c,h}
162 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
163 input : ['test-codegen.xml'],
164 output : ['gdbus-test-codegen-generated.h',
165 'gdbus-test-codegen-generated.c'],
166 depend_files : gdbus_codegen_built_files,
167 command : [python, gdbus_codegen,
168 '--interface-prefix', 'org.project.',
169 '--output-directory', '@OUTDIR@',
170 '--generate-c-code', 'gdbus-test-codegen-generated',
171 '--c-generate-object-manager',
172 '--c-namespace', 'Foo_iGen',
173 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
174 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
175 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
176 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
177 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
178 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
179 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
180 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
181 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
186 ['gdbus-auth', [], []],
187 ['gdbus-bz627724', [], []],
188 ['gdbus-close-pending', [], []],
189 ['gdbus-connection', [], []],
190 ['gdbus-connection-loss', [], []],
191 ['gdbus-connection-slow', [], []],
192 ['gdbus-error', [], []],
193 ['gdbus-exit-on-close', [], []],
194 ['gdbus-export', [], []],
195 ['gdbus-introspection', [], []],
196 ['gdbus-names', [], []],
197 ['gdbus-proxy', [], []],
198 ['gdbus-proxy-threads', [], [dbus1_dep]],
199 ['gdbus-proxy-well-known-name', [], []],
200 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
201 ['gdbus-threading', [], []],
202 ['gmenumodel', [], []],
203 ['gnotification', ['gnotification-server.c'], []],
206 if not glib_have_cocoa
207 gio_dbus_tests += [['dbus-appinfo', [], []]]
210 # separate loop because extra source files for each test
211 foreach dbus_test : gio_dbus_tests
212 test_name = dbus_test[0]
213 extra_src = dbus_test[1]
214 extra_deps = dbus_test[2]
215 exe = executable(test_name, '@0@.c'.format(test_name),
216 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
218 c_args : test_c_args,
219 dependencies : common_gio_tests_deps + extra_deps)
220 # These tests may take more than 30 seconds to run on the CI infrastructure
221 if slow_tests.contains(test_name)
222 test(test_name, exe, env : test_env, timeout : 120, suite : ['gio', 'slow'])
224 test(test_name, exe, env : test_env, suite : ['gio'])
228 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
229 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
231 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
232 dependencies : common_gio_tests_deps)
233 test('gdbus-test-codegen-old', exe, env : test_env, suite : ['gio'])
235 # There is already a gapplication exe target in gio so need to use a
236 # different name for the unit test executable, since we can't have two
237 # targets of the same name even if in different directories
238 # (FIXME: just rename source file to gapplication-test.c)
239 if not glib_have_cocoa
240 exe = executable('gapplication-test', 'gapplication.c',
241 'gdbus-sessionbus.c', 'gdbus-tests.c',
243 c_args : test_c_args,
244 dependencies : common_gio_tests_deps)
246 test('gapplication', exe, env : test_env, suite : ['gio'])
248 gio_tests += ['gdbus-unix-addresses']
249 endif # have_dbus_daemon
251 # This test is currently unreliable
252 executable('gdbus-overflow', 'gdbus-overflow.c',
254 c_args : test_c_args,
255 dependencies : common_gio_tests_deps)
257 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
258 'test-io-stream.c', 'test-pipe-unix.c',
260 c_args : test_c_args,
261 dependencies : common_gio_tests_deps)
262 test('gdbus-connection-flush', exe, env : test_env, suite : ['gio'])
264 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
265 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
267 c_args : test_c_args,
268 dependencies : common_gio_tests_deps)
269 test('gdbus-non-socket', exe, env : test_env, suite : ['gio'])
271 # Generate test.mo from de.po using msgfmt
272 msgfmt = find_program('msgfmt', required : false)
274 subdir('de/LC_MESSAGES')
275 # gsettings target exe already exists in gio directory
276 exe = executable('gsettings-test', 'gsettings.c', test_mo,
278 c_args : test_c_args + [
279 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
280 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
282 dependencies : common_gio_tests_deps)
283 test('gsettings', exe, env : test_env, suite : ['gio'])
287 # Test programs buildable on Windows only
288 if host_machine.system() == 'windows'
289 gio_tests += ['win32-streams']
292 if cc.get_id() != 'msvc'
293 gio_tests += [ 'autoptr' ]
296 foreach test_name : gio_tests
298 srcs = ['@0@.c'.format(test_name)]
299 # conflicts with glib/tests/autoptr, can't have two targets with same name
300 if test_name == 'autoptr'
301 test_name = 'autoptr-gio'
302 elif test_name == 'defaultvalue'
303 srcs += [giotypefuncs_inc]
304 elif test_name == 'gdbus-peer'
305 # This is peer to peer so it doesn't need a session bus, so we can run
306 # it automatically as a test by default
307 extra_deps = [libgdbus_example_objectmanager_dep]
308 elif test_name == 'tls-certificate' or test_name == 'tls-interaction'
309 srcs += ['gtesttlsbackend.c']
311 exe = executable(test_name, srcs,
313 c_args : test_c_args,
314 dependencies : common_gio_tests_deps + extra_deps)
315 # These tests may take more than 30 seconds to run on the CI infrastructure
316 if slow_tests.contains(test_name)
317 test(test_name, exe, env : test_env, timeout : 120, suite : ['gio', 'slow'])
319 test(test_name, exe, env : test_env, suite : ['gio'])
323 uninstalled_test_extra_programs = [
327 ['gapplication-example-actions'],
328 ['gapplication-example-cmdline'],
329 ['gapplication-example-cmdline2'],
330 ['gapplication-example-cmdline3'],
331 ['gapplication-example-cmdline4'],
332 ['gapplication-example-dbushooks'],
333 ['gapplication-example-open'],
334 ['gdbus-daemon', gdbus_daemon_sources],
335 ['gdbus-example-export'],
336 ['gdbus-example-own-name'],
337 ['gdbus-example-peer'],
338 ['gdbus-example-proxy-subclass'],
339 ['gdbus-example-server'],
340 ['gdbus-example-subtree'],
341 ['gdbus-example-watch-name'],
342 ['gdbus-example-watch-proxy'],
343 ['gsubprocess-testprog'],
349 ['socket-client', ['gtlsconsoleinteraction.c']],
350 # These three are manual-run tests because they need a session bus but don't bring one up themselves
351 # FIXME: these build but don't seem to work!
352 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
353 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
354 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
357 if host_machine.system() != 'windows'
358 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
361 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
362 srcs = ['@0@.c'.format(extra_program[0])]
363 if extra_program.length() > 1
364 srcs += extra_program[1]
367 if extra_program.length() > 2
368 extra_deps = extra_program[2]
370 executable(extra_program[0], srcs,
372 c_args : test_c_args,
373 dependencies : common_gio_tests_deps + extra_deps)
376 if not meson.is_cross_build() or meson.has_exe_wrapper()
378 plugin_resources_c = custom_target('plugin-resources.c',
379 input : 'test4.gresource.xml',
380 output : 'plugin-resources.c',
381 command : [glib_compile_resources,
383 '--sourcedir=' + meson.current_source_dir(),
385 '--c-name', '_g_plugin',
388 if host_system == 'windows'
389 resource_plugin_platform_link_args = ['-no-undefined']
391 resource_plugin_platform_link_args = []
393 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
394 link_args : export_dynamic_ldflags + resource_plugin_platform_link_args,
395 dependencies : common_gio_tests_deps)
397 test_gresource = custom_target('test.gresource',
398 input : 'test.gresource.xml',
399 output : 'test.gresource',
400 command : [glib_compile_resources,
402 '--sourcedir=' + meson.current_source_dir(),
403 '--sourcedir=' + meson.current_build_dir(),
406 test_resources2_c = custom_target('test_resources2.c',
407 input : 'test3.gresource.xml',
408 output : 'test_resources2.c',
409 command : [glib_compile_resources,
411 '--sourcedir=' + meson.current_source_dir(),
413 '--c-name', '_g_test2',
417 test_resources2_h = custom_target('test_resources2.h',
418 input : 'test3.gresource.xml',
419 output : 'test_resources2.h',
420 command : [glib_compile_resources,
422 '--sourcedir=' + meson.current_source_dir(),
424 '--c-name', '_g_test2',
428 test_resources_c = custom_target('test_resources.c',
429 input : 'test2.gresource.xml',
430 output : 'test_resources.c',
431 command : [glib_compile_resources,
433 '--sourcedir=' + meson.current_source_dir(),
435 '--c-name', '_g_test1',
438 # referenced by test.gresource.xml
439 test_generated_txt = configure_file(input : 'test1.txt',
440 output : 'test-generated.txt',
444 exe = executable('resources', 'resources.c', test_gresource,
445 test_resources_c, test_resources2_c, test_resources2_h,
447 c_args : test_c_args,
448 dependencies : common_gio_tests_deps)
449 test('resources', exe, env : test_env, suite : ['gio'])
452 # FIXME: subdir('services')