1 common_gio_tests_deps = [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep]
3 if host_system == 'darwin'
4 common_gio_tests_deps += [libintl]
7 subdir('gdbus-object-manager-example')
9 gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
10 giotypefuncs_inc = custom_target(
12 output : 'giotypefuncs.inc',
13 input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
14 command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
16 # Test programs buildable on all platforms
19 'async-close-output-stream',
20 'async-splice-output-stream',
21 'buffered-input-stream',
22 'buffered-output-stream',
31 'fileattributematcher',
42 'memory-input-stream',
43 'memory-output-stream',
51 'simple-async-result',
63 'thumbnail-verification',
66 test_extra_programs = [
67 ['gdbus-connection-flush-helper'],
72 'G_TEST_SRCDIR=' + meson.current_source_dir(),
73 'G_TEST_BUILDDIR=' + meson.current_build_dir(),
78 '-DG_LOG_DOMAIN="GLib-GIO"',
79 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
80 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
81 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
84 # Check for libdbus1 - Optional - is only used in the GDBus test cases
85 # 1.2.14 required for dbus_message_set_serial
86 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
87 if not dbus1_dep.found()
88 if cc.get_id() == 'msvc'
89 # MSVC: Search for the DBus library by the configuration, which corresponds
90 # to the output of CMake builds of DBus. Note that debugoptimized
91 # is really a Release build with .PDB files.
92 if buildtype == 'debug'
93 dbus1_dep = cc.find_library('dbus-1d', required : false)
95 dbus1_dep = cc.find_library('dbus-1', required : false)
100 glib_conf.set('HAVE_DBUS1', 1)
102 exe = executable('gdbus-serialization',
103 'gdbus-serialization.c', 'gdbus-tests.c',
105 c_args : test_c_args,
106 dependencies : common_gio_tests_deps + [dbus1_dep])
107 test('gdbus-serialization', exe, env : test_env)
110 # Test programs buildable on UNIX only
111 if host_machine.system() != 'windows'
115 'gdbus-peer-object-manager',
122 'g-file-info-filesystem-readonly',
126 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
127 # unable to find the installed executable
128 if not glib_have_cocoa
135 test_extra_programs += [
136 ['basic-application'],
141 if not glib_have_cocoa
142 test_extra_programs += [['apps']]
143 gio_tests += ['mimeapps']
146 # Test programs that need to bring up a session bus (requires dbus-daemon)
147 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
149 # Generate gdbus-test-codegen-generated.{c,h}
150 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
151 input : ['test-codegen.xml'],
152 output : ['gdbus-test-codegen-generated.h',
153 'gdbus-test-codegen-generated.c'],
154 depend_files : gdbus_codegen_built_files,
155 command : [python, gdbus_codegen,
156 '--interface-prefix', 'org.project.',
157 '--output-directory', '@OUTDIR@',
158 '--generate-c-code', 'gdbus-test-codegen-generated',
159 '--c-generate-object-manager',
160 '--c-namespace', 'Foo_iGen',
161 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
162 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
163 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
164 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
165 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
166 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
167 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
168 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
169 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
174 ['gdbus-auth', [], []],
175 ['gdbus-bz627724', [], []],
176 ['gdbus-close-pending', [], []],
177 ['gdbus-connection', [], []],
178 ['gdbus-connection-loss', [], []],
179 ['gdbus-connection-slow', [], []],
180 ['gdbus-error', [], []],
181 ['gdbus-exit-on-close', [], []],
182 ['gdbus-export', [], []],
183 ['gdbus-introspection', [], []],
184 ['gdbus-names', [], []],
185 ['gdbus-proxy', [], []],
186 ['gdbus-proxy-threads', [], [dbus1_dep]],
187 ['gdbus-proxy-well-known-name', [], []],
188 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
189 ['gdbus-threading', [], []],
190 ['gmenumodel', [], []],
191 ['gnotification', ['gnotification-server.c'], []],
194 if not glib_have_cocoa
195 gio_dbus_tests = [['dbus-appinfo', [], []]]
198 # separate loop because extra source files for each test
199 foreach dbus_test : gio_dbus_tests
200 test_name = dbus_test[0]
201 extra_src = dbus_test[1]
202 extra_deps = dbus_test[2]
203 exe = executable(test_name, '@0@.c'.format(test_name),
204 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
206 c_args : test_c_args,
207 dependencies : common_gio_tests_deps + extra_deps)
208 test(test_name, exe, env : test_env)
211 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
212 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
214 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
215 dependencies : common_gio_tests_deps)
216 test('gdbus-test-codegen-old', exe, env : test_env)
218 # There is already a gapplication exe target in gio so need to use a
219 # different name for the unit test executable, since we can't have two
220 # targets of the same name even if in different directories
221 # (FIXME: just rename source file to gapplication-test.c)
222 if not glib_have_cocoa
223 exe = executable('gapplication-test', 'gapplication.c',
224 'gdbus-sessionbus.c', 'gdbus-tests.c',
226 c_args : test_c_args,
227 dependencies : common_gio_tests_deps)
229 test('gapplication', exe, env : test_env)
231 gio_tests += ['gdbus-unix-addresses']
232 endif # have_dbus_daemon
234 # This test is currently unreliable
235 executable('gdbus-overflow', 'gdbus-overflow.c',
237 c_args : test_c_args,
238 dependencies : common_gio_tests_deps)
240 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
241 'test-io-stream.c', 'test-pipe-unix.c',
243 c_args : test_c_args,
244 dependencies : common_gio_tests_deps)
245 test('gdbus-connection-flush', exe, env : test_env)
247 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
248 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
250 c_args : test_c_args,
251 dependencies : common_gio_tests_deps)
252 test('gdbus-non-socket', exe, env : test_env)
254 # Generate test.mo from de.po using msgfmt
255 msgfmt = find_program('msgfmt', required : false)
257 subdir('de/LC_MESSAGES')
258 # gsettings target exe already exists in gio directory
259 exe = executable('gsettings-test', 'gsettings.c', test_mo,
261 c_args : test_c_args + [
262 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
263 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
265 dependencies : common_gio_tests_deps)
266 test('gsettings', exe, env : test_env)
270 # Test programs buildable on Windows only
271 if host_machine.system() == 'windows'
272 gio_tests += ['win32-streams']
275 if cc.get_id() != 'msvc'
276 gio_tests += [ 'autoptr' ]
279 foreach test_name : gio_tests
281 srcs = ['@0@.c'.format(test_name)]
282 # conflicts with glib/tests/autoptr, can't have two targets with same name
283 if test_name == 'autoptr'
284 test_name = 'autoptr-gio'
285 elif test_name == 'defaultvalue'
286 srcs += [giotypefuncs_inc]
287 elif test_name == 'gdbus-peer'
288 # This is peer to peer so it doesn't need a session bus, so we can run
289 # it automatically as a test by default
290 extra_deps = [libgdbus_example_objectmanager_dep]
292 exe = executable(test_name, srcs,
294 c_args : test_c_args,
295 dependencies : common_gio_tests_deps + extra_deps)
296 if test_name == 'testfilemonitor'
297 test(test_name, exe, env : test_env, timeout : 45)
299 test(test_name, exe, env : test_env)
303 uninstalled_test_extra_programs = [
307 ['gapplication-example-actions'],
308 ['gapplication-example-cmdline'],
309 ['gapplication-example-cmdline2'],
310 ['gapplication-example-cmdline3'],
311 ['gapplication-example-cmdline4'],
312 ['gapplication-example-dbushooks'],
313 ['gapplication-example-open'],
314 ['gdbus-daemon', gdbus_daemon_sources],
315 ['gdbus-example-export'],
316 ['gdbus-example-own-name'],
317 ['gdbus-example-peer'],
318 ['gdbus-example-proxy-subclass'],
319 ['gdbus-example-server'],
320 ['gdbus-example-subtree'],
321 ['gdbus-example-watch-name'],
322 ['gdbus-example-watch-proxy'],
323 ['gsubprocess-testprog'],
329 ['socket-client', ['gtlsconsoleinteraction.c']],
330 ['tls-certificate', ['gtesttlsbackend.c']],
331 ['tls-interaction', ['gtesttlsbackend.c']],
332 # These three are manual-run tests because they need a session bus but don't bring one up themselves
333 # FIXME: these build but don't seem to work!
334 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
335 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
336 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
339 if host_machine.system() != 'windows'
340 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
343 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
344 srcs = ['@0@.c'.format(extra_program[0])]
345 if extra_program.length() > 1
346 srcs += extra_program[1]
349 if extra_program.length() > 2
350 extra_deps = extra_program[2]
352 executable(extra_program[0], srcs,
354 c_args : test_c_args,
355 dependencies : common_gio_tests_deps + extra_deps)
358 if not meson.is_cross_build() or meson.has_exe_wrapper()
360 plugin_resources_c = custom_target('plugin-resources.c',
361 input : 'test4.gresource.xml',
362 output : 'plugin-resources.c',
363 command : [glib_compile_resources,
365 '--sourcedir=' + meson.current_source_dir(),
367 '--c-name', '_g_plugin',
370 if host_system == 'windows'
371 resource_plugin_platform_link_args = ['-no-undefined']
373 resource_plugin_platform_link_args = []
375 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
376 link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
377 dependencies : common_gio_tests_deps)
379 test_gresource = custom_target('test.gresource',
380 input : 'test.gresource.xml',
381 output : 'test.gresource',
382 command : [glib_compile_resources,
384 '--sourcedir=' + meson.current_source_dir(),
385 '--sourcedir=' + meson.current_build_dir(),
388 test_resources2_c = custom_target('test_resources2.c',
389 input : 'test3.gresource.xml',
390 output : 'test_resources2.c',
391 command : [glib_compile_resources,
393 '--sourcedir=' + meson.current_source_dir(),
395 '--c-name', '_g_test2',
399 test_resources2_h = custom_target('test_resources2.h',
400 input : 'test3.gresource.xml',
401 output : 'test_resources2.h',
402 command : [glib_compile_resources,
404 '--sourcedir=' + meson.current_source_dir(),
406 '--c-name', '_g_test2',
410 test_resources_c = custom_target('test_resources.c',
411 input : 'test2.gresource.xml',
412 output : 'test_resources.c',
413 command : [glib_compile_resources,
415 '--sourcedir=' + meson.current_source_dir(),
417 '--c-name', '_g_test1',
420 # referenced by test.gresource.xml
421 test_generated_txt = configure_file(input : 'test1.txt',
422 output : 'test-generated.txt',
423 configuration : configuration_data(),
426 exe = executable('resources', 'resources.c', test_gresource,
427 test_resources_c, test_resources2_c, test_resources2_h,
429 c_args : test_c_args,
430 dependencies : common_gio_tests_deps)
431 test('resources', exe, env : test_env)
434 # FIXME: subdir('services')