1 common_gio_tests_deps = [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep]
3 subdir('gdbus-object-manager-example')
5 gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
6 giotypefuncs_inc = custom_target(
8 output : 'giotypefuncs.inc',
9 input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
10 command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
12 # Test programs buildable on all platforms
15 'async-close-output-stream',
16 'async-splice-output-stream',
17 'buffered-input-stream',
18 'buffered-output-stream',
27 'fileattributematcher',
38 'memory-input-stream',
39 'memory-output-stream',
47 'simple-async-result',
59 'thumbnail-verification',
62 test_extra_programs = [
63 ['gdbus-connection-flush-helper'],
68 'G_TEST_SRCDIR=' + meson.current_source_dir(),
69 'G_TEST_BUILDDIR=' + meson.current_build_dir(),
74 '-DG_LOG_DOMAIN="GLib-GIO"',
75 '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
76 '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
77 '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
80 # Check for libdbus1 - Optional - is only used in the GDBus test cases
81 # 1.2.14 required for dbus_message_set_serial
82 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
83 if not dbus1_dep.found()
84 if cc.get_id() == 'msvc'
85 # MSVC: Search for the DBus library by the configuration, which corresponds
86 # to the output of CMake builds of DBus. Note that debugoptimized
87 # is really a Release build with .PDB files.
88 if buildtype == 'debug'
89 dbus1_dep = cc.find_library('dbus-1d', required : false)
91 dbus1_dep = cc.find_library('dbus-1', required : false)
96 glib_conf.set('HAVE_DBUS1', 1)
98 exe = executable('gdbus-serialization',
99 'gdbus-serialization.c', 'gdbus-tests.c',
101 c_args : test_c_args,
102 dependencies : common_gio_tests_deps + [dbus1_dep])
103 test('gdbus-serialization', exe, env : test_env)
106 # Test programs buildable on UNIX only
107 if host_machine.system() != 'windows'
111 'gdbus-peer-object-manager',
118 'g-file-info-filesystem-readonly',
122 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
123 # unable to find the installed executable
124 if not glib_have_cocoa
131 test_extra_programs += [
132 ['basic-application'],
137 if not glib_have_cocoa
138 test_extra_programs += [['apps']]
139 gio_tests += ['mimeapps']
142 # Test programs that need to bring up a session bus (requires dbus-daemon)
143 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
145 # Generate gdbus-test-codegen-generated.{c,h}
146 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
147 input : ['test-codegen.xml'],
148 output : ['gdbus-test-codegen-generated.h',
149 'gdbus-test-codegen-generated.c'],
150 depend_files : gdbus_codegen_built_files,
151 command : [python, gdbus_codegen,
152 '--interface-prefix', 'org.project.',
153 '--output-directory', '@OUTDIR@',
154 '--generate-c-code', 'gdbus-test-codegen-generated',
155 '--c-generate-object-manager',
156 '--c-namespace', 'Foo_iGen',
157 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
158 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
159 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
160 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
161 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
162 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
163 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
164 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
165 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
170 ['gdbus-auth', [], []],
171 ['gdbus-bz627724', [], []],
172 ['gdbus-close-pending', [], []],
173 ['gdbus-connection', [], []],
174 ['gdbus-connection-loss', [], []],
175 ['gdbus-connection-slow', [], []],
176 ['gdbus-error', [], []],
177 ['gdbus-exit-on-close', [], []],
178 ['gdbus-export', [], []],
179 ['gdbus-introspection', [], []],
180 ['gdbus-names', [], []],
181 ['gdbus-proxy', [], []],
182 ['gdbus-proxy-threads', [], [dbus1_dep]],
183 ['gdbus-proxy-well-known-name', [], []],
184 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
185 ['gdbus-threading', [], []],
186 ['gmenumodel', [], []],
187 ['gnotification', ['gnotification-server.c'], []],
190 if not glib_have_cocoa
191 gio_dbus_tests = [['dbus-appinfo', [], []]]
194 # separate loop because extra source files for each test
195 foreach dbus_test : gio_dbus_tests
196 test_name = dbus_test[0]
197 extra_src = dbus_test[1]
198 extra_deps = dbus_test[2]
199 exe = executable(test_name, '@0@.c'.format(test_name),
200 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
202 c_args : test_c_args,
203 dependencies : common_gio_tests_deps + extra_deps)
204 test(test_name, exe, env : test_env)
207 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
208 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
210 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
211 dependencies : common_gio_tests_deps)
212 test('gdbus-test-codegen-old', exe, env : test_env)
214 # There is already a gapplication exe target in gio so need to use a
215 # different name for the unit test executable, since we can't have two
216 # targets of the same name even if in different directories
217 # (FIXME: just rename source file to gapplication-test.c)
218 if not glib_have_cocoa
219 exe = executable('gapplication-test', 'gapplication.c',
220 'gdbus-sessionbus.c', 'gdbus-tests.c',
222 c_args : test_c_args,
223 dependencies : common_gio_tests_deps)
225 test('gapplication', exe, env : test_env)
227 gio_tests += ['gdbus-unix-addresses']
228 endif # have_dbus_daemon
230 # This test is currently unreliable
231 executable('gdbus-overflow', 'gdbus-overflow.c',
233 c_args : test_c_args,
234 dependencies : common_gio_tests_deps)
236 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
237 'test-io-stream.c', 'test-pipe-unix.c',
239 c_args : test_c_args,
240 dependencies : common_gio_tests_deps)
241 test('gdbus-connection-flush', exe, env : test_env)
243 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
244 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
246 c_args : test_c_args,
247 dependencies : common_gio_tests_deps)
248 test('gdbus-non-socket', exe, env : test_env)
250 # Generate test.mo from de.po using msgfmt
251 msgfmt = find_program('msgfmt', required : false)
253 subdir('de/LC_MESSAGES')
254 # gsettings target exe already exists in gio directory
255 exe = executable('gsettings-test', 'gsettings.c', test_mo,
257 c_args : test_c_args + [
258 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
259 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
261 dependencies : common_gio_tests_deps)
262 test('gsettings', exe, env : test_env)
266 # Test programs buildable on Windows only
267 if host_machine.system() == 'windows'
268 gio_tests += ['win32-streams']
271 if cc.get_id() != 'msvc'
272 gio_tests += [ 'autoptr' ]
275 foreach test_name : gio_tests
277 srcs = ['@0@.c'.format(test_name)]
278 # conflicts with glib/tests/autoptr, can't have two targets with same name
279 if test_name == 'autoptr'
280 test_name = 'autoptr-gio'
281 elif test_name == 'defaultvalue'
282 srcs += [giotypefuncs_inc]
283 elif test_name == 'gdbus-peer'
284 # This is peer to peer so it doesn't need a session bus, so we can run
285 # it automatically as a test by default
286 extra_deps = [libgdbus_example_objectmanager_dep]
288 exe = executable(test_name, srcs,
290 c_args : test_c_args,
291 dependencies : common_gio_tests_deps + extra_deps)
292 if test_name == 'testfilemonitor'
293 test(test_name, exe, env : test_env, timeout : 45)
295 test(test_name, exe, env : test_env)
299 uninstalled_test_extra_programs = [
303 ['gapplication-example-actions'],
304 ['gapplication-example-cmdline'],
305 ['gapplication-example-cmdline2'],
306 ['gapplication-example-cmdline3'],
307 ['gapplication-example-dbushooks'],
308 ['gapplication-example-open'],
309 ['gdbus-daemon', gdbus_daemon_sources],
310 ['gdbus-example-export'],
311 ['gdbus-example-own-name'],
312 ['gdbus-example-peer'],
313 ['gdbus-example-proxy-subclass'],
314 ['gdbus-example-server'],
315 ['gdbus-example-subtree'],
316 ['gdbus-example-watch-name'],
317 ['gdbus-example-watch-proxy'],
318 ['gsubprocess-testprog'],
324 ['socket-client', ['gtlsconsoleinteraction.c']],
325 ['tls-certificate', ['gtesttlsbackend.c']],
326 ['tls-interaction', ['gtesttlsbackend.c']],
327 # These three are manual-run tests because they need a session bus but don't bring one up themselves
328 # FIXME: these build but don't seem to work!
329 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
330 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
331 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
334 if host_machine.system() != 'windows'
335 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
338 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
339 srcs = ['@0@.c'.format(extra_program[0])]
340 if extra_program.length() > 1
341 srcs += extra_program[1]
344 if extra_program.length() > 2
345 extra_deps = extra_program[2]
347 executable(extra_program[0], srcs,
349 c_args : test_c_args,
350 dependencies : common_gio_tests_deps + extra_deps)
353 if not meson.is_cross_build() or meson.has_exe_wrapper()
355 plugin_resources_c = custom_target('plugin-resources.c',
356 input : 'test4.gresource.xml',
357 output : 'plugin-resources.c',
358 command : [glib_compile_resources,
360 '--sourcedir=' + meson.current_source_dir(),
362 '--c-name', '_g_plugin',
365 if host_system == 'windows'
366 resource_plugin_platform_link_args = ['-no-undefined']
368 resource_plugin_platform_link_args = []
370 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
371 link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
372 dependencies : common_gio_tests_deps)
374 test_gresource = custom_target('test.gresource',
375 input : 'test.gresource.xml',
376 output : 'test.gresource',
377 command : [glib_compile_resources,
379 '--sourcedir=' + meson.current_source_dir(),
380 '--sourcedir=' + meson.current_build_dir(),
383 test_resources2_c = custom_target('test_resources2.c',
384 input : 'test3.gresource.xml',
385 output : 'test_resources2.c',
386 command : [glib_compile_resources,
388 '--sourcedir=' + meson.current_source_dir(),
390 '--c-name', '_g_test2',
394 test_resources2_h = custom_target('test_resources2.h',
395 input : 'test3.gresource.xml',
396 output : 'test_resources2.h',
397 command : [glib_compile_resources,
399 '--sourcedir=' + meson.current_source_dir(),
401 '--c-name', '_g_test2',
405 test_resources_c = custom_target('test_resources.c',
406 input : 'test2.gresource.xml',
407 output : 'test_resources.c',
408 command : [glib_compile_resources,
410 '--sourcedir=' + meson.current_source_dir(),
412 '--c-name', '_g_test1',
415 # referenced by test.gresource.xml
416 test_generated_txt = configure_file(input : 'test1.txt',
417 output : 'test-generated.txt',
418 configuration : configuration_data(),
421 exe = executable('resources', 'resources.c', test_gresource,
422 test_resources_c, test_resources2_c, test_resources2_h,
424 c_args : test_c_args,
425 dependencies : common_gio_tests_deps)
426 test('resources', exe, env : test_env)
429 # FIXME: subdir('services')