1 common_gio_tests_deps = [
9 subdir('gdbus-object-manager-example')
11 gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
12 giotypefuncs_inc = custom_target(
14 output : 'giotypefuncs.inc',
15 input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
16 command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
18 # Test programs buildable on all platforms
21 'async-close-output-stream',
22 'async-splice-output-stream',
23 'buffered-input-stream',
24 'buffered-output-stream',
33 'fileattributematcher',
44 'memory-input-stream',
45 'memory-output-stream',
49 'network-monitor-race',
54 'simple-async-result',
66 'thumbnail-verification',
69 test_extra_programs = [
70 ['gdbus-connection-flush-helper'],
75 'G_TEST_SRCDIR=' + meson.current_source_dir(),
76 'G_TEST_BUILDDIR=' + meson.current_build_dir(),
81 '-DG_LOG_DOMAIN="GLib-GIO"',
82 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
83 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
84 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
87 # Check for libdbus1 - Optional - is only used in the GDBus test cases
88 # 1.2.14 required for dbus_message_set_serial
89 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
90 if not dbus1_dep.found()
91 if cc.get_id() == 'msvc'
92 # MSVC: Search for the DBus library by the configuration, which corresponds
93 # to the output of CMake builds of DBus. Note that debugoptimized
94 # is really a Release build with .PDB files.
95 if buildtype == 'debug'
96 dbus1_dep = cc.find_library('dbus-1d', required : false)
98 dbus1_dep = cc.find_library('dbus-1', required : false)
103 glib_conf.set('HAVE_DBUS1', 1)
105 exe = executable('gdbus-serialization',
106 'gdbus-serialization.c', 'gdbus-tests.c',
108 c_args : test_c_args,
109 dependencies : common_gio_tests_deps + [dbus1_dep])
110 test('gdbus-serialization', exe, env : test_env)
113 # Test programs buildable on UNIX only
114 if host_machine.system() != 'windows'
118 'gdbus-peer-object-manager',
125 'g-file-info-filesystem-readonly',
129 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
130 # unable to find the installed executable
131 if not glib_have_cocoa
138 test_extra_programs += [
139 ['basic-application'],
144 if not glib_have_cocoa
145 test_extra_programs += [['apps']]
146 gio_tests += ['mimeapps']
149 # Test programs that need to bring up a session bus (requires dbus-daemon)
150 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
152 # Generate gdbus-test-codegen-generated.{c,h}
153 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
154 input : ['test-codegen.xml'],
155 output : ['gdbus-test-codegen-generated.h',
156 'gdbus-test-codegen-generated.c'],
157 depend_files : gdbus_codegen_built_files,
158 command : [python, gdbus_codegen,
159 '--interface-prefix', 'org.project.',
160 '--output-directory', '@OUTDIR@',
161 '--generate-c-code', 'gdbus-test-codegen-generated',
162 '--c-generate-object-manager',
163 '--c-namespace', 'Foo_iGen',
164 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
165 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
166 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
167 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
168 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
169 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
170 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
171 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
172 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
177 ['gdbus-auth', [], []],
178 ['gdbus-bz627724', [], []],
179 ['gdbus-close-pending', [], []],
180 ['gdbus-connection', [], []],
181 ['gdbus-connection-loss', [], []],
182 ['gdbus-connection-slow', [], []],
183 ['gdbus-error', [], []],
184 ['gdbus-exit-on-close', [], []],
185 ['gdbus-export', [], []],
186 ['gdbus-introspection', [], []],
187 ['gdbus-names', [], []],
188 ['gdbus-proxy', [], []],
189 ['gdbus-proxy-threads', [], [dbus1_dep]],
190 ['gdbus-proxy-well-known-name', [], []],
191 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
192 ['gdbus-threading', [], []],
193 ['gmenumodel', [], []],
194 ['gnotification', ['gnotification-server.c'], []],
197 if not glib_have_cocoa
198 gio_dbus_tests = [['dbus-appinfo', [], []]]
201 # separate loop because extra source files for each test
202 foreach dbus_test : gio_dbus_tests
203 test_name = dbus_test[0]
204 extra_src = dbus_test[1]
205 extra_deps = dbus_test[2]
206 exe = executable(test_name, '@0@.c'.format(test_name),
207 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
209 c_args : test_c_args,
210 dependencies : common_gio_tests_deps + extra_deps)
211 test(test_name, exe, env : test_env)
214 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
215 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
217 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
218 dependencies : common_gio_tests_deps)
219 test('gdbus-test-codegen-old', exe, env : test_env)
221 # There is already a gapplication exe target in gio so need to use a
222 # different name for the unit test executable, since we can't have two
223 # targets of the same name even if in different directories
224 # (FIXME: just rename source file to gapplication-test.c)
225 if not glib_have_cocoa
226 exe = executable('gapplication-test', 'gapplication.c',
227 'gdbus-sessionbus.c', 'gdbus-tests.c',
229 c_args : test_c_args,
230 dependencies : common_gio_tests_deps)
232 test('gapplication', exe, env : test_env)
234 gio_tests += ['gdbus-unix-addresses']
235 endif # have_dbus_daemon
237 # This test is currently unreliable
238 executable('gdbus-overflow', 'gdbus-overflow.c',
240 c_args : test_c_args,
241 dependencies : common_gio_tests_deps)
243 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
244 'test-io-stream.c', 'test-pipe-unix.c',
246 c_args : test_c_args,
247 dependencies : common_gio_tests_deps)
248 test('gdbus-connection-flush', exe, env : test_env)
250 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
251 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
253 c_args : test_c_args,
254 dependencies : common_gio_tests_deps)
255 test('gdbus-non-socket', exe, env : test_env)
257 # Generate test.mo from de.po using msgfmt
258 msgfmt = find_program('msgfmt', required : false)
260 subdir('de/LC_MESSAGES')
261 # gsettings target exe already exists in gio directory
262 exe = executable('gsettings-test', 'gsettings.c', test_mo,
264 c_args : test_c_args + [
265 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
266 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
268 dependencies : common_gio_tests_deps)
269 test('gsettings', exe, env : test_env)
273 # Test programs buildable on Windows only
274 if host_machine.system() == 'windows'
275 gio_tests += ['win32-streams']
278 if cc.get_id() != 'msvc'
279 gio_tests += [ 'autoptr' ]
282 foreach test_name : gio_tests
284 srcs = ['@0@.c'.format(test_name)]
285 # conflicts with glib/tests/autoptr, can't have two targets with same name
286 if test_name == 'autoptr'
287 test_name = 'autoptr-gio'
288 elif test_name == 'defaultvalue'
289 srcs += [giotypefuncs_inc]
290 elif test_name == 'gdbus-peer'
291 # This is peer to peer so it doesn't need a session bus, so we can run
292 # it automatically as a test by default
293 extra_deps = [libgdbus_example_objectmanager_dep]
295 exe = executable(test_name, srcs,
297 c_args : test_c_args,
298 dependencies : common_gio_tests_deps + extra_deps)
299 if test_name == 'testfilemonitor'
300 test(test_name, exe, env : test_env, timeout : 45)
302 test(test_name, exe, env : test_env)
306 uninstalled_test_extra_programs = [
310 ['gapplication-example-actions'],
311 ['gapplication-example-cmdline'],
312 ['gapplication-example-cmdline2'],
313 ['gapplication-example-cmdline3'],
314 ['gapplication-example-cmdline4'],
315 ['gapplication-example-dbushooks'],
316 ['gapplication-example-open'],
317 ['gdbus-daemon', gdbus_daemon_sources],
318 ['gdbus-example-export'],
319 ['gdbus-example-own-name'],
320 ['gdbus-example-peer'],
321 ['gdbus-example-proxy-subclass'],
322 ['gdbus-example-server'],
323 ['gdbus-example-subtree'],
324 ['gdbus-example-watch-name'],
325 ['gdbus-example-watch-proxy'],
326 ['gsubprocess-testprog'],
332 ['socket-client', ['gtlsconsoleinteraction.c']],
333 ['tls-certificate', ['gtesttlsbackend.c']],
334 ['tls-interaction', ['gtesttlsbackend.c']],
335 # These three are manual-run tests because they need a session bus but don't bring one up themselves
336 # FIXME: these build but don't seem to work!
337 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
338 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
339 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
342 if host_machine.system() != 'windows'
343 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
346 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
347 srcs = ['@0@.c'.format(extra_program[0])]
348 if extra_program.length() > 1
349 srcs += extra_program[1]
352 if extra_program.length() > 2
353 extra_deps = extra_program[2]
355 executable(extra_program[0], srcs,
357 c_args : test_c_args,
358 dependencies : common_gio_tests_deps + extra_deps)
361 if not meson.is_cross_build() or meson.has_exe_wrapper()
363 plugin_resources_c = custom_target('plugin-resources.c',
364 input : 'test4.gresource.xml',
365 output : 'plugin-resources.c',
366 command : [glib_compile_resources,
368 '--sourcedir=' + meson.current_source_dir(),
370 '--c-name', '_g_plugin',
373 if host_system == 'windows'
374 resource_plugin_platform_link_args = ['-no-undefined']
376 resource_plugin_platform_link_args = []
378 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
379 link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
380 dependencies : common_gio_tests_deps)
382 test_gresource = custom_target('test.gresource',
383 input : 'test.gresource.xml',
384 output : 'test.gresource',
385 command : [glib_compile_resources,
387 '--sourcedir=' + meson.current_source_dir(),
388 '--sourcedir=' + meson.current_build_dir(),
391 test_resources2_c = custom_target('test_resources2.c',
392 input : 'test3.gresource.xml',
393 output : 'test_resources2.c',
394 command : [glib_compile_resources,
396 '--sourcedir=' + meson.current_source_dir(),
398 '--c-name', '_g_test2',
402 test_resources2_h = custom_target('test_resources2.h',
403 input : 'test3.gresource.xml',
404 output : 'test_resources2.h',
405 command : [glib_compile_resources,
407 '--sourcedir=' + meson.current_source_dir(),
409 '--c-name', '_g_test2',
413 test_resources_c = custom_target('test_resources.c',
414 input : 'test2.gresource.xml',
415 output : 'test_resources.c',
416 command : [glib_compile_resources,
418 '--sourcedir=' + meson.current_source_dir(),
420 '--c-name', '_g_test1',
423 # referenced by test.gresource.xml
424 test_generated_txt = configure_file(input : 'test1.txt',
425 output : 'test-generated.txt',
426 configuration : configuration_data(),
429 exe = executable('resources', 'resources.c', test_gresource,
430 test_resources_c, test_resources2_c, test_resources2_h,
432 c_args : test_c_args,
433 dependencies : common_gio_tests_deps)
434 test('resources', exe, env : test_env)
437 # FIXME: subdir('services')