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')
84 glib_conf.set('HAVE_DBUS1', 1)
86 exe = executable('gdbus-serialization',
87 'gdbus-serialization.c', 'gdbus-tests.c',
90 dependencies : common_gio_tests_deps + [dbus1_dep])
91 test('gdbus-serialization', exe, env : test_env)
94 # Test programs buildable on UNIX only
95 if host_machine.system() != 'windows'
99 'gdbus-peer-object-manager',
108 # Uninstalled because of the check-for-executable logic in DesktopAppInfo
109 # unable to find the installed executable
110 if not glib_have_cocoa
117 test_extra_programs += [
118 ['basic-application'],
123 if not glib_have_cocoa
124 test_extra_programs += [['apps']]
125 gio_tests += ['mimeapps']
128 # Test programs that need to bring up a session bus (requires dbus-daemon)
129 have_dbus_daemon = find_program('dbus-daemon', required : false).found()
131 # Generate gdbus-test-codegen-generated.{c,h}
132 gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
133 input : ['test-codegen.xml'],
134 output : ['gdbus-test-codegen-generated.h',
135 'gdbus-test-codegen-generated.c'],
136 command : [python, gdbus_codegen,
137 '--interface-prefix', 'org.project.',
138 '--output-directory', '@OUTDIR@',
139 '--generate-c-code', 'gdbus-test-codegen-generated',
140 '--c-generate-object-manager',
141 '--c-namespace', 'Foo_iGen',
142 '--generate-docbook', 'gdbus-test-codegen-generated-doc',
143 '--annotate', 'org.project.Bar', 'Key1', 'Value1',
144 '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
145 '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
146 '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
147 '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
148 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
149 '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
150 '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
155 ['gdbus-auth', [], []],
156 ['gdbus-bz627724', [], []],
157 ['gdbus-close-pending', [], []],
158 ['gdbus-connection', [], []],
159 ['gdbus-connection-loss', [], []],
160 ['gdbus-connection-slow', [], []],
161 ['gdbus-error', [], []],
162 ['gdbus-exit-on-close', [], []],
163 ['gdbus-export', [], []],
164 ['gdbus-introspection', [], []],
165 ['gdbus-names', [], []],
166 ['gdbus-proxy', [], []],
167 ['gdbus-proxy-threads', [], [dbus1_dep]],
168 ['gdbus-proxy-well-known-name', [], []],
169 ['gdbus-test-codegen', [gdbus_test_codegen_generated], []],
170 ['gdbus-threading', [], []],
171 ['gmenumodel', [], []],
172 ['gnotification', ['gnotification-server.c'], []],
175 if not glib_have_cocoa
176 gio_dbus_tests = [['dbus-appinfo', [], []]]
179 # separate loop because extra source files for each test
180 foreach dbus_test : gio_dbus_tests
181 test_name = dbus_test[0]
182 extra_src = dbus_test[1]
183 extra_deps = dbus_test[2]
184 exe = executable(test_name, '@0@.c'.format(test_name),
185 'gdbus-sessionbus.c', 'gdbus-tests.c', extra_src,
187 c_args : test_c_args,
188 dependencies : common_gio_tests_deps + extra_deps)
189 test(test_name, exe, env : test_env)
192 exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
193 'gdbus-sessionbus.c', 'gdbus-tests.c', gdbus_test_codegen_generated,
195 c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
196 dependencies : common_gio_tests_deps)
197 test('gdbus-test-codegen-old', exe, env : test_env)
199 # There is already a gapplication exe target in gio so need to use a
200 # different name for the unit test executable, since we can't have two
201 # targets of the same name even if in different directories
202 # (FIXME: just rename source file to gapplication-test.c)
203 if not glib_have_cocoa
204 exe = executable('gapplication-test', 'gapplication.c',
205 'gdbus-sessionbus.c', 'gdbus-tests.c',
207 c_args : test_c_args,
208 dependencies : common_gio_tests_deps)
210 test('gapplication', exe, env : test_env)
212 gio_tests += ['gdbus-unix-addresses']
213 endif # have_dbus_daemon
215 # This test is currently unreliable
216 executable('gdbus-overflow', 'gdbus-overflow.c',
218 c_args : test_c_args,
219 dependencies : common_gio_tests_deps)
221 exe = executable('gdbus-connection-flush', 'gdbus-connection-flush.c',
222 'test-io-stream.c', 'test-pipe-unix.c',
224 c_args : test_c_args,
225 dependencies : common_gio_tests_deps)
226 test('gdbus-connection-flush', exe, env : test_env)
228 exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
229 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
231 c_args : test_c_args,
232 dependencies : common_gio_tests_deps)
233 test('gdbus-non-socket', exe, env : test_env)
235 # Generate test.mo from de.po using msgfmt
236 msgfmt = find_program('msgfmt', required : false)
238 subdir('de/LC_MESSAGES')
239 # gsettings target exe already exists in gio directory
240 exe = executable('gsettings-test', 'gsettings.c', test_mo,
242 c_args : test_c_args + [
243 '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
244 '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
246 dependencies : common_gio_tests_deps)
247 test('gsettings', exe, env : test_env)
251 # Test programs buildable on Windows only
252 if host_machine.system() == 'windows'
253 gio_tests += ['win32-streams']
256 if cc.get_id() != 'msvc'
257 gio_tests += [ 'autoptr' ]
260 foreach test_name : gio_tests
262 srcs = ['@0@.c'.format(test_name)]
263 # conflicts with glib/tests/autoptr, can't have two targets with same name
264 if test_name == 'autoptr'
265 test_name = 'autoptr-gio'
266 elif test_name == 'defaultvalue'
267 srcs += [giotypefuncs_inc]
268 elif test_name == 'gdbus-peer'
269 # This is peer to peer so it doesn't need a session bus, so we can run
270 # it automatically as a test by default
271 extra_deps = [libgdbus_example_objectmanager_dep]
273 exe = executable(test_name, srcs,
275 c_args : test_c_args,
276 dependencies : common_gio_tests_deps + extra_deps)
277 if test_name == 'testfilemonitor'
278 test(test_name, exe, env : test_env, timeout : 45)
280 test(test_name, exe, env : test_env)
284 uninstalled_test_extra_programs = [
288 ['gapplication-example-actions'],
289 ['gapplication-example-cmdline'],
290 ['gapplication-example-cmdline2'],
291 ['gapplication-example-cmdline3'],
292 ['gapplication-example-dbushooks'],
293 ['gapplication-example-open'],
294 ['gdbus-daemon', gdbus_daemon_sources],
295 ['gdbus-example-export'],
296 ['gdbus-example-own-name'],
297 ['gdbus-example-peer'],
298 ['gdbus-example-proxy-subclass'],
299 ['gdbus-example-server'],
300 ['gdbus-example-subtree'],
301 ['gdbus-example-watch-name'],
302 ['gdbus-example-watch-proxy'],
303 ['gsubprocess-testprog'],
309 ['socket-client', ['gtlsconsoleinteraction.c']],
310 ['tls-certificate', ['gtesttlsbackend.c']],
311 ['tls-interaction', ['gtesttlsbackend.c']],
312 # These three are manual-run tests because they need a session bus but don't bring one up themselves
313 # FIXME: these build but don't seem to work!
314 ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]],
315 ['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
316 ['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
319 if host_machine.system() != 'windows'
320 uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
323 foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
324 srcs = ['@0@.c'.format(extra_program[0])]
325 if extra_program.length() > 1
326 srcs += extra_program[1]
329 if extra_program.length() > 2
330 extra_deps = extra_program[2]
332 executable(extra_program[0], srcs,
334 c_args : test_c_args,
335 dependencies : common_gio_tests_deps + extra_deps)
338 if not meson.is_cross_build() or meson.has_exe_wrapper()
340 plugin_resources_c = custom_target('plugin-resources.c',
341 input : 'test4.gresource.xml',
342 output : 'plugin-resources.c',
343 command : [glib_compile_resources,
345 '--sourcedir=' + meson.current_source_dir(),
347 '--c-name', '_g_plugin',
350 if host_system == 'windows'
351 resource_plugin_platform_link_args = ['-no-undefined']
353 resource_plugin_platform_link_args = []
355 shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
356 link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
357 dependencies : common_gio_tests_deps)
359 test_gresource = custom_target('test.gresource',
360 input : 'test.gresource.xml',
361 output : 'test.gresource',
362 command : [glib_compile_resources,
364 '--sourcedir=' + meson.current_source_dir(),
365 '--sourcedir=' + meson.current_build_dir(),
368 test_resources2_c = custom_target('test_resources2.c',
369 input : 'test3.gresource.xml',
370 output : 'test_resources2.c',
371 command : [glib_compile_resources,
373 '--sourcedir=' + meson.current_source_dir(),
375 '--c-name', '_g_test2',
379 test_resources2_h = custom_target('test_resources2.h',
380 input : 'test3.gresource.xml',
381 output : 'test_resources2.h',
382 command : [glib_compile_resources,
384 '--sourcedir=' + meson.current_source_dir(),
386 '--c-name', '_g_test2',
390 test_resources_c = custom_target('test_resources.c',
391 input : 'test2.gresource.xml',
392 output : 'test_resources.c',
393 command : [glib_compile_resources,
395 '--sourcedir=' + meson.current_source_dir(),
397 '--c-name', '_g_test1',
400 # referenced by test.gresource.xml
401 test_generated_txt = configure_file(input : 'test1.txt',
402 output : 'test-generated.txt',
403 configuration : configuration_data(),
406 exe = executable('resources', 'resources.c', test_gresource,
407 test_resources_c, test_resources2_c, test_resources2_h,
409 c_args : test_c_args,
410 dependencies : common_gio_tests_deps)
411 test('resources', exe, env : test_env)
414 # FIXME: subdir('services')