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(),
79 '-DG_LOG_DOMAIN="GLib-GIO"',
80 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
81 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
82 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
85 # Check for libdbus1 - Optional - is only used in the GDBus test cases
86 # 1.2.14 required for dbus_message_set_serial
87 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
88 if not dbus1_dep.found()
89 if cc.get_id() == 'msvc'
90 # MSVC: Search for the DBus library by the configuration, which corresponds
91 # to the output of CMake builds of DBus. Note that debugoptimized
92 # is really a Release build with .PDB files.
93 if buildtype == 'debug'
94 dbus1_dep = cc.find_library('dbus-1d', required : false)
96 dbus1_dep = cc.find_library('dbus-1', required : false)
101 glib_conf.set('HAVE_DBUS1', 1)
103 exe = executable('gdbus-serialization',
104 'gdbus-serialization.c', 'gdbus-tests.c',
106 c_args : test_c_args,
107 dependencies : common_gio_tests_deps + [dbus1_dep])
108 test('gdbus-serialization', exe, env : test_env)
111 # Test programs buildable on UNIX only
112 if host_machine.system() != 'windows'
116 'gdbus-peer-object-manager',
123 'g-file-info-filesystem-readonly',
127 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
128 # unable to find the installed executable
129 if not glib_have_cocoa
136 test_extra_programs += [
137 ['basic-application'],
142 if not glib_have_cocoa
143 test_extra_programs += [['apps']]
144 gio_tests += ['mimeapps']
147 # Test programs that need to bring up a session bus (requires dbus-daemon)
148 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
150 # Generate gdbus-test-codegen-generated.{c,h}
151 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
152 input : ['test-codegen.xml'],
153 output : ['gdbus-test-codegen-generated.h',
154 'gdbus-test-codegen-generated.c'],
155 depend_files : gdbus_codegen_built_files,
156 command : [python, gdbus_codegen,
157 '--interface-prefix', 'org.project.',
158 '--output-directory', '@OUTDIR@',
159 '--generate-c-code', 'gdbus-test-codegen-generated',
160 '--c-generate-object-manager',
161 '--c-namespace', 'Foo_iGen',
162 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
163 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
164 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
165 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
166 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
167 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
168 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
169 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
170 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
175 ['gdbus-auth', [], []],
176 ['gdbus-bz627724', [], []],
177 ['gdbus-close-pending', [], []],
178 ['gdbus-connection', [], []],
179 ['gdbus-connection-loss', [], []],
180 ['gdbus-connection-slow', [], []],
181 ['gdbus-error', [], []],
182 ['gdbus-exit-on-close', [], []],
183 ['gdbus-export', [], []],
184 ['gdbus-introspection', [], []],
185 ['gdbus-names', [], []],
186 ['gdbus-proxy', [], []],
187 ['gdbus-proxy-threads', [], [dbus1_dep]],
188 ['gdbus-proxy-well-known-name', [], []],
189 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
190 ['gdbus-threading', [], []],
191 ['gmenumodel', [], []],
192 ['gnotification', ['gnotification-server.c'], []],
195 if not glib_have_cocoa
196 gio_dbus_tests = [['dbus-appinfo', [], []]]
199 # separate loop because extra source files for each test
200 foreach dbus_test : gio_dbus_tests
201 test_name = dbus_test[0]
202 extra_src = dbus_test[1]
203 extra_deps = dbus_test[2]
204 exe = executable(test_name, '@0@.c'.format(test_name),
205 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
207 c_args : test_c_args,
208 dependencies : common_gio_tests_deps + extra_deps)
209 test(test_name, exe, env : test_env)
212 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
213 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
215 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
216 dependencies : common_gio_tests_deps)
217 test('gdbus-test-codegen-old', exe, env : test_env)
219 # There is already a gapplication exe target in gio so need to use a
220 # different name for the unit test executable, since we can't have two
221 # targets of the same name even if in different directories
222 # (FIXME: just rename source file to gapplication-test.c)
223 if not glib_have_cocoa
224 exe = executable('gapplication-test', 'gapplication.c',
225 'gdbus-sessionbus.c', 'gdbus-tests.c',
227 c_args : test_c_args,
228 dependencies : common_gio_tests_deps)
230 test('gapplication', exe, env : test_env)
232 gio_tests += ['gdbus-unix-addresses']
233 endif # have_dbus_daemon
235 # This test is currently unreliable
236 executable('gdbus-overflow', 'gdbus-overflow.c',
238 c_args : test_c_args,
239 dependencies : common_gio_tests_deps)
241 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
242 'test-io-stream.c', 'test-pipe-unix.c',
244 c_args : test_c_args,
245 dependencies : common_gio_tests_deps)
246 test('gdbus-connection-flush', exe, env : test_env)
248 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
249 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
251 c_args : test_c_args,
252 dependencies : common_gio_tests_deps)
253 test('gdbus-non-socket', exe, env : test_env)
255 # Generate test.mo from de.po using msgfmt
256 msgfmt = find_program('msgfmt', required : false)
258 subdir('de/LC_MESSAGES')
259 # gsettings target exe already exists in gio directory
260 exe = executable('gsettings-test', 'gsettings.c', test_mo,
262 c_args : test_c_args + [
263 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
264 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
266 dependencies : common_gio_tests_deps)
267 test('gsettings', exe, env : test_env)
271 # Test programs buildable on Windows only
272 if host_machine.system() == 'windows'
273 gio_tests += ['win32-streams']
276 if cc.get_id() != 'msvc'
277 gio_tests += [ 'autoptr' ]
280 foreach test_name : gio_tests
282 srcs = ['@0@.c'.format(test_name)]
283 # conflicts with glib/tests/autoptr, can't have two targets with same name
284 if test_name == 'autoptr'
285 test_name = 'autoptr-gio'
286 elif test_name == 'defaultvalue'
287 srcs += [giotypefuncs_inc]
288 elif test_name == 'gdbus-peer'
289 # This is peer to peer so it doesn't need a session bus, so we can run
290 # it automatically as a test by default
291 extra_deps = [libgdbus_example_objectmanager_dep]
293 exe = executable(test_name, srcs,
295 c_args : test_c_args,
296 dependencies : common_gio_tests_deps + extra_deps)
297 if test_name == 'testfilemonitor'
298 test(test_name, exe, env : test_env, timeout : 45)
300 test(test_name, exe, env : test_env)
304 uninstalled_test_extra_programs = [
308 ['gapplication-example-actions'],
309 ['gapplication-example-cmdline'],
310 ['gapplication-example-cmdline2'],
311 ['gapplication-example-cmdline3'],
312 ['gapplication-example-cmdline4'],
313 ['gapplication-example-dbushooks'],
314 ['gapplication-example-open'],
315 ['gdbus-daemon', gdbus_daemon_sources],
316 ['gdbus-example-export'],
317 ['gdbus-example-own-name'],
318 ['gdbus-example-peer'],
319 ['gdbus-example-proxy-subclass'],
320 ['gdbus-example-server'],
321 ['gdbus-example-subtree'],
322 ['gdbus-example-watch-name'],
323 ['gdbus-example-watch-proxy'],
324 ['gsubprocess-testprog'],
330 ['socket-client', ['gtlsconsoleinteraction.c']],
331 ['tls-certificate', ['gtesttlsbackend.c']],
332 ['tls-interaction', ['gtesttlsbackend.c']],
333 # These three are manual-run tests because they need a session bus but don't bring one up themselves
334 # FIXME: these build but don't seem to work!
335 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
336 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
337 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
340 if host_machine.system() != 'windows'
341 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
344 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
345 srcs = ['@0@.c'.format(extra_program[0])]
346 if extra_program.length() > 1
347 srcs += extra_program[1]
350 if extra_program.length() > 2
351 extra_deps = extra_program[2]
353 executable(extra_program[0], srcs,
355 c_args : test_c_args,
356 dependencies : common_gio_tests_deps + extra_deps)
359 if not meson.is_cross_build() or meson.has_exe_wrapper()
361 plugin_resources_c = custom_target('plugin-resources.c',
362 input : 'test4.gresource.xml',
363 output : 'plugin-resources.c',
364 command : [glib_compile_resources,
366 '--sourcedir=' + meson.current_source_dir(),
368 '--c-name', '_g_plugin',
371 if host_system == 'windows'
372 resource_plugin_platform_link_args = ['-no-undefined']
374 resource_plugin_platform_link_args = []
376 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
377 link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
378 dependencies : common_gio_tests_deps)
380 test_gresource = custom_target('test.gresource',
381 input : 'test.gresource.xml',
382 output : 'test.gresource',
383 command : [glib_compile_resources,
385 '--sourcedir=' + meson.current_source_dir(),
386 '--sourcedir=' + meson.current_build_dir(),
389 test_resources2_c = custom_target('test_resources2.c',
390 input : 'test3.gresource.xml',
391 output : 'test_resources2.c',
392 command : [glib_compile_resources,
394 '--sourcedir=' + meson.current_source_dir(),
396 '--c-name', '_g_test2',
400 test_resources2_h = custom_target('test_resources2.h',
401 input : 'test3.gresource.xml',
402 output : 'test_resources2.h',
403 command : [glib_compile_resources,
405 '--sourcedir=' + meson.current_source_dir(),
407 '--c-name', '_g_test2',
411 test_resources_c = custom_target('test_resources.c',
412 input : 'test2.gresource.xml',
413 output : 'test_resources.c',
414 command : [glib_compile_resources,
416 '--sourcedir=' + meson.current_source_dir(),
418 '--c-name', '_g_test1',
421 # referenced by test.gresource.xml
422 test_generated_txt = configure_file(input : 'test1.txt',
423 output : 'test-generated.txt',
424 configuration : configuration_data(),
427 exe = executable('resources', 'resources.c', test_gresource,
428 test_resources_c, test_resources2_c, test_resources2_h,
430 c_args : test_c_args,
431 dependencies : common_gio_tests_deps)
432 test('resources', exe, env : test_env)
435 # FIXME: subdir('services')