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',
120 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
121 # unable to find the installed executable
122 if not glib_have_cocoa
129 test_extra_programs += [
130 ['basic-application'],
135 if not glib_have_cocoa
136 test_extra_programs += [['apps']]
137 gio_tests += ['mimeapps']
140 # Test programs that need to bring up a session bus (requires dbus-daemon)
141 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
143 # Generate gdbus-test-codegen-generated.{c,h}
144 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
145 input : ['test-codegen.xml'],
146 output : ['gdbus-test-codegen-generated.h',
147 'gdbus-test-codegen-generated.c'],
148 command : [python, gdbus_codegen,
149 '--interface-prefix', 'org.project.',
150 '--output-directory', '@OUTDIR@',
151 '--generate-c-code', 'gdbus-test-codegen-generated',
152 '--c-generate-object-manager',
153 '--c-namespace', 'Foo_iGen',
154 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
155 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
156 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
157 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
158 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
159 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
160 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
161 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
162 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
167 ['gdbus-auth', [], []],
168 ['gdbus-bz627724', [], []],
169 ['gdbus-close-pending', [], []],
170 ['gdbus-connection', [], []],
171 ['gdbus-connection-loss', [], []],
172 ['gdbus-connection-slow', [], []],
173 ['gdbus-error', [], []],
174 ['gdbus-exit-on-close', [], []],
175 ['gdbus-export', [], []],
176 ['gdbus-introspection', [], []],
177 ['gdbus-names', [], []],
178 ['gdbus-proxy', [], []],
179 ['gdbus-proxy-threads', [], [dbus1_dep]],
180 ['gdbus-proxy-well-known-name', [], []],
181 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
182 ['gdbus-threading', [], []],
183 ['gmenumodel', [], []],
184 ['gnotification', ['gnotification-server.c'], []],
187 if not glib_have_cocoa
188 gio_dbus_tests = [['dbus-appinfo', [], []]]
191 # separate loop because extra source files for each test
192 foreach dbus_test : gio_dbus_tests
193 test_name = dbus_test[0]
194 extra_src = dbus_test[1]
195 extra_deps = dbus_test[2]
196 exe = executable(test_name, '@0@.c'.format(test_name),
197 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
199 c_args : test_c_args,
200 dependencies : common_gio_tests_deps + extra_deps)
201 test(test_name, exe, env : test_env)
204 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
205 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
207 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
208 dependencies : common_gio_tests_deps)
209 test('gdbus-test-codegen-old', exe, env : test_env)
211 # There is already a gapplication exe target in gio so need to use a
212 # different name for the unit test executable, since we can't have two
213 # targets of the same name even if in different directories
214 # (FIXME: just rename source file to gapplication-test.c)
215 if not glib_have_cocoa
216 exe = executable('gapplication-test', 'gapplication.c',
217 'gdbus-sessionbus.c', 'gdbus-tests.c',
219 c_args : test_c_args,
220 dependencies : common_gio_tests_deps)
222 test('gapplication', exe, env : test_env)
224 gio_tests += ['gdbus-unix-addresses']
225 endif # have_dbus_daemon
227 # This test is currently unreliable
228 executable('gdbus-overflow', 'gdbus-overflow.c',
230 c_args : test_c_args,
231 dependencies : common_gio_tests_deps)
233 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
234 'test-io-stream.c', 'test-pipe-unix.c',
236 c_args : test_c_args,
237 dependencies : common_gio_tests_deps)
238 test('gdbus-connection-flush', exe, env : test_env)
240 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
241 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
243 c_args : test_c_args,
244 dependencies : common_gio_tests_deps)
245 test('gdbus-non-socket', exe, env : test_env)
247 # Generate test.mo from de.po using msgfmt
248 msgfmt = find_program('msgfmt', required : false)
250 subdir('de/LC_MESSAGES')
251 # gsettings target exe already exists in gio directory
252 exe = executable('gsettings-test', 'gsettings.c', test_mo,
254 c_args : test_c_args + [
255 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
256 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
258 dependencies : common_gio_tests_deps)
259 test('gsettings', exe, env : test_env)
263 # Test programs buildable on Windows only
264 if host_machine.system() == 'windows'
265 gio_tests += ['win32-streams']
268 if cc.get_id() != 'msvc'
269 gio_tests += [ 'autoptr' ]
272 foreach test_name : gio_tests
274 srcs = ['@0@.c'.format(test_name)]
275 # conflicts with glib/tests/autoptr, can't have two targets with same name
276 if test_name == 'autoptr'
277 test_name = 'autoptr-gio'
278 elif test_name == 'defaultvalue'
279 srcs += [giotypefuncs_inc]
280 elif test_name == 'gdbus-peer'
281 # This is peer to peer so it doesn't need a session bus, so we can run
282 # it automatically as a test by default
283 extra_deps = [libgdbus_example_objectmanager_dep]
285 exe = executable(test_name, srcs,
287 c_args : test_c_args,
288 dependencies : common_gio_tests_deps + extra_deps)
289 if test_name == 'testfilemonitor'
290 test(test_name, exe, env : test_env, timeout : 45)
292 test(test_name, exe, env : test_env)
296 uninstalled_test_extra_programs = [
300 ['gapplication-example-actions'],
301 ['gapplication-example-cmdline'],
302 ['gapplication-example-cmdline2'],
303 ['gapplication-example-cmdline3'],
304 ['gapplication-example-dbushooks'],
305 ['gapplication-example-open'],
306 ['gdbus-daemon', gdbus_daemon_sources],
307 ['gdbus-example-export'],
308 ['gdbus-example-own-name'],
309 ['gdbus-example-peer'],
310 ['gdbus-example-proxy-subclass'],
311 ['gdbus-example-server'],
312 ['gdbus-example-subtree'],
313 ['gdbus-example-watch-name'],
314 ['gdbus-example-watch-proxy'],
315 ['gsubprocess-testprog'],
321 ['socket-client', ['gtlsconsoleinteraction.c']],
322 ['tls-certificate', ['gtesttlsbackend.c']],
323 ['tls-interaction', ['gtesttlsbackend.c']],
324 # These three are manual-run tests because they need a session bus but don't bring one up themselves
325 # FIXME: these build but don't seem to work!
326 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
327 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
328 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
331 if host_machine.system() != 'windows'
332 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
335 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
336 srcs = ['@0@.c'.format(extra_program[0])]
337 if extra_program.length() > 1
338 srcs += extra_program[1]
341 if extra_program.length() > 2
342 extra_deps = extra_program[2]
344 executable(extra_program[0], srcs,
346 c_args : test_c_args,
347 dependencies : common_gio_tests_deps + extra_deps)
350 if not meson.is_cross_build() or meson.has_exe_wrapper()
352 plugin_resources_c = custom_target('plugin-resources.c',
353 input : 'test4.gresource.xml',
354 output : 'plugin-resources.c',
355 command : [glib_compile_resources,
357 '--sourcedir=' + meson.current_source_dir(),
359 '--c-name', '_g_plugin',
362 if host_system == 'windows'
363 resource_plugin_platform_link_args = ['-no-undefined']
365 resource_plugin_platform_link_args = []
367 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
368 link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
369 dependencies : common_gio_tests_deps)
371 test_gresource = custom_target('test.gresource',
372 input : 'test.gresource.xml',
373 output : 'test.gresource',
374 command : [glib_compile_resources,
376 '--sourcedir=' + meson.current_source_dir(),
377 '--sourcedir=' + meson.current_build_dir(),
380 test_resources2_c = custom_target('test_resources2.c',
381 input : 'test3.gresource.xml',
382 output : 'test_resources2.c',
383 command : [glib_compile_resources,
385 '--sourcedir=' + meson.current_source_dir(),
387 '--c-name', '_g_test2',
391 test_resources2_h = custom_target('test_resources2.h',
392 input : 'test3.gresource.xml',
393 output : 'test_resources2.h',
394 command : [glib_compile_resources,
396 '--sourcedir=' + meson.current_source_dir(),
398 '--c-name', '_g_test2',
402 test_resources_c = custom_target('test_resources.c',
403 input : 'test2.gresource.xml',
404 output : 'test_resources.c',
405 command : [glib_compile_resources,
407 '--sourcedir=' + meson.current_source_dir(),
409 '--c-name', '_g_test1',
412 # referenced by test.gresource.xml
413 test_generated_txt = configure_file(input : 'test1.txt',
414 output : 'test-generated.txt',
415 configuration : configuration_data(),
418 exe = executable('resources', 'resources.c', test_gresource,
419 test_resources_c, test_resources2_c, test_resources2_h,
421 c_args : test_c_args,
422 dependencies : common_gio_tests_deps)
423 test('resources', exe, env : test_env)
426 # FIXME: subdir('services')