Imported Upstream version 2.62.3
[platform/upstream/glib.git] / gio / tests / meson.build
1 common_gio_tests_deps = [
2   libglib_dep,
3   libgmodule_dep,
4   libgobject_dep,
5   libgio_dep,
6 ]
7
8 test_c_args = [
9   '-DG_LOG_DOMAIN="GLib-GIO"',
10   '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
11   '-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
12   '-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
13   '-UG_DISABLE_ASSERT',
14 ]
15
16 if host_machine.system() == 'windows'
17   common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
18 endif
19
20 subdir('gdbus-object-manager-example')
21
22 gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
23 giotypefuncs_inc = custom_target(
24   'giotypefuncs.inc',
25   output : 'giotypefuncs.inc',
26   input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
27   command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
28
29 #  Test programs buildable on all platforms
30 gio_tests = {
31   'appmonitor' : {},
32   'async-close-output-stream' : {},
33   'async-splice-output-stream' : {},
34   'buffered-input-stream' : {},
35   'buffered-output-stream' : {},
36   'cancellable' : {},
37   'contexts' : {},
38   'contenttype' : {},
39   'converter-stream' : {},
40   'credentials' : {},
41   'data-input-stream' : {},
42   'data-output-stream' : {},
43   'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
44   'fileattributematcher' : {},
45   'filter-streams' : {},
46   'giomodule' : {},
47   'gsubprocess' : {},
48   'g-file' : {},
49   'g-file-info' : {},
50   'g-icon' : {},
51   'gdbus-addresses' : {},
52   'gdbus-message' : {},
53   'inet-address' : {},
54   'io-stream' : {},
55   'memory-input-stream' : {},
56   'memory-output-stream' : {},
57   'mount-operation' : {},
58   'network-address' : {'extra_sources': ['mock-resolver.c']},
59   'network-monitor' : {},
60   'network-monitor-race' : {},
61   'permission' : {},
62   'pollable' : {},
63   'proxy-test' : {},
64   'readwrite' : {},
65   'simple-async-result' : {},
66   'simple-proxy' : {},
67   'sleepy-stream' : {},
68   'socket' : {},
69   'socket-listener' : {},
70   'socket-service' : {},
71   'srvtarget' : {},
72   'task' : {},
73   'vfs' : {},
74   'volumemonitor' : {},
75   'glistmodel' : {},
76   'testfilemonitor' : {'suite' : ['slow', 'flaky']},
77   'thumbnail-verification' : {},
78   'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']},
79   'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
80   'tls-database' : {'extra_sources' : ['gtesttlsbackend.c']},
81   'gdbus-address-get-session' : {},
82 }
83
84 test_extra_programs = {
85   'gdbus-connection-flush-helper' : {},
86   'gdbus-testserver' : {},
87   'gsubprocess-testprog' : {},
88 }
89
90 test_env = environment()
91 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
92 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
93 test_env.set('GIO_MODULE_DIR', '')
94 test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop')
95
96 # Check for libdbus1 - Optional - is only used in the GDBus test cases
97 # 1.2.14 required for dbus_message_set_serial
98 dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
99 if not dbus1_dep.found()
100   if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
101     # MSVC: Search for the DBus library by the configuration, which corresponds
102     # to the output of CMake builds of DBus.  Note that debugoptimized
103     # is really a Release build with .PDB files.
104     if buildtype == 'debug'
105       dbus1_dep = cc.find_library('dbus-1d', required : false)
106     else
107       dbus1_dep = cc.find_library('dbus-1', required : false)
108     endif
109   endif
110 endif
111 if dbus1_dep.found()
112   glib_conf.set('HAVE_DBUS1', 1)
113
114   gio_tests += {
115     'gdbus-serialization' : {
116       'extra_sources' : ['gdbus-tests.c'],
117       'dependencies' : [dbus1_dep],
118     }
119   }
120 endif
121
122 #  Test programs buildable on UNIX only
123 if host_machine.system() != 'windows'
124   gio_tests += {
125     'file' : {},
126     'gdbus-peer' : {
127       'dependencies' : [libgdbus_example_objectmanager_dep],
128       'install_rpath' : installed_tests_execdir
129     },
130     'gdbus-peer-object-manager' : {},
131     'live-g-file' : {},
132     'socket-address' : {},
133     'stream-rw_all' : {},
134     'unix-fd' : {},
135     'unix-mounts' : {},
136     'unix-streams' : {},
137     'g-file-info-filesystem-readonly' : {},
138     'gschema-compile' : {'install' : false},
139     'trash' : {},
140   }
141
142   if have_rtld_next
143     gio_tests += {
144       'gsocketclient-slow' : {
145         'depends' : [
146           shared_library('slow-connect-preload',
147             'slow-connect-preload.c',
148             name_prefix : '',
149             dependencies: libdl_dep,
150             install_dir : installed_tests_execdir,
151             install: installed_tests_enabled,
152           )
153         ],
154         'env' : {
155           'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(meson.current_build_dir())
156         },
157         'installed_tests_env' : {
158           'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(installed_tests_execdir),
159         },
160       },
161     }
162   endif
163
164   # Uninstalled because of the check-for-executable logic in DesktopAppInfo
165   # unable to find the installed executable
166   if not glib_have_cocoa
167     gio_tests += {
168       'appinfo' : {
169         'install' : false,
170       },
171       'desktop-app-info' : {
172         'install' : false,
173       },
174     }
175   endif
176
177   test_extra_programs += {
178     'basic-application' : {},
179     'dbus-launch' : {},
180     'appinfo-test' : {},
181   }
182
183   if not glib_have_cocoa
184     test_extra_programs += {
185       'apps' : {},
186     }
187     gio_tests += {
188       'mimeapps' : {},
189     }
190   endif
191
192   #  Test programs that need to bring up a session bus (requires dbus-daemon)
193   have_dbus_daemon = find_program('dbus-daemon', required : false).found()
194   if have_dbus_daemon
195     annotate_args = [
196       '--annotate', 'org.project.Bar', 'Key1', 'Value1',
197       '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
198       '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
199       '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
200       '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
201       '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
202       '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
203       '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
204     ]
205     # Generate gdbus-test-codegen-generated.{c,h}
206     gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
207         input :   ['test-codegen.xml'],
208         output :  ['gdbus-test-codegen-generated.h',
209                    'gdbus-test-codegen-generated.c'],
210         depend_files : gdbus_codegen_built_files,
211         command : [python, gdbus_codegen,
212                    '--interface-prefix', 'org.project.',
213                    '--output-directory', '@OUTDIR@',
214                    '--generate-c-code', 'gdbus-test-codegen-generated',
215                    '--c-generate-object-manager',
216                    '--c-generate-autocleanup', 'all',
217                    '--c-namespace', 'Foo_iGen',
218                    '--generate-docbook', 'gdbus-test-codegen-generated-doc',
219                    annotate_args,
220                    '@INPUT@'])
221
222     gdbus_test_codegen_generated_interface_info = [
223       custom_target('gdbus-test-codegen-generated-interface-info-h',
224           input :   ['test-codegen.xml'],
225           output :  ['gdbus-test-codegen-generated-interface-info.h'],
226           depend_files : gdbus_codegen_built_files,
227           command : [python, gdbus_codegen,
228                      '--interface-info-header',
229                      annotate_args,
230                      '--output', '@OUTPUT@',
231                      '@INPUT@']),
232       custom_target('gdbus-test-codegen-generated-interface-info-c',
233           input :   ['test-codegen.xml'],
234           output :  ['gdbus-test-codegen-generated-interface-info.c'],
235           depend_files : gdbus_codegen_built_files,
236           command : [python, gdbus_codegen,
237                      '--interface-info-body',
238                      annotate_args,
239                      '--output', '@OUTPUT@',
240                      '@INPUT@']),
241     ]
242
243     extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
244
245     gio_tests += {
246       'actions' : {
247         'extra_sources' : extra_sources,
248         'suite' : ['slow'],
249       },
250       'gdbus-auth' : {'extra_sources' : extra_sources},
251       'gdbus-bz627724' : {'extra_sources' : extra_sources},
252       'gdbus-close-pending' : {'extra_sources' : extra_sources},
253       'gdbus-connection' : {'extra_sources' : extra_sources},
254       'gdbus-connection-loss' : {'extra_sources' : extra_sources},
255       'gdbus-connection-slow' : {'extra_sources' : extra_sources},
256       'gdbus-error' : {'extra_sources' : extra_sources},
257       'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
258       'gdbus-export' : {
259         'extra_sources' : extra_sources,
260         'suite' : ['slow'],
261       },
262       'gdbus-introspection' : {'extra_sources' : extra_sources},
263       'gdbus-names' : {'extra_sources' : extra_sources},
264       'gdbus-proxy' : {'extra_sources' : extra_sources},
265       'gdbus-proxy-threads' : {
266         'extra_sources' : extra_sources,
267         'dependencies' : [dbus1_dep],
268       },
269       'gdbus-proxy-unique-name' : {'extra_sources' : extra_sources},
270       'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
271       'gdbus-test-codegen' : {
272         'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
273       },
274       'gdbus-threading' : {
275         'extra_sources' : extra_sources,
276         'suite' : ['slow', 'flaky'],
277       },
278       'gmenumodel' : {
279         'extra_sources' : extra_sources,
280         'suite' : ['slow'],
281       },
282       'gnotification' : {
283         'extra_sources' : [extra_sources, 'gnotification-server.c'],
284       },
285       'gdbus-test-codegen-old' : {
286         'source' : 'gdbus-test-codegen.c',
287         'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
288         'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
289                     '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
290       },
291       'gapplication' : {'extra_sources' : extra_sources},
292     }
293
294     if not glib_have_cocoa
295       gio_tests += {
296         'dbus-appinfo' : {
297           'extra_sources' : extra_sources,
298         },
299       }
300     endif
301   endif # have_dbus_daemon
302
303   # This test is currently unreliable
304   executable('gdbus-overflow', 'gdbus-overflow.c',
305       c_args : test_c_args,
306       dependencies : common_gio_tests_deps,
307       install_dir : installed_tests_execdir,
308       install : installed_tests_enabled)
309
310   gio_tests += {
311     'gdbus-connection-flush' : {
312       'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
313     },
314     'gdbus-non-socket' : {
315       'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
316     },
317   }
318
319   # Generate test.mo from de.po using msgfmt
320   msgfmt = find_program('msgfmt', required : false)
321   if msgfmt.found()
322     subdir('de/LC_MESSAGES')
323     gio_tests += {
324       'gsettings' : {
325         'extra_sources' : [test_mo],
326         'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
327                     '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
328         'install' : false,
329       },
330     }
331   endif
332 endif # unix
333
334 #  Test programs buildable on Windows only
335 if host_machine.system() == 'windows'
336   gio_tests += {'win32-streams' : {}}
337 endif
338
339 if cc.get_id() != 'msvc'
340   gio_tests += {
341     'autoptr-gio' : {
342       'source' : 'autoptr.c',
343     },
344   }
345 endif
346
347 test_extra_programs += {
348   'gio-du' : {'install' : false},
349   'echo-server' : {'install' : false},
350   'filter-cat' : {'install' : false},
351   'gapplication-example-actions' : {'install' : false},
352   'gapplication-example-cmdline' : {'install' : false},
353   'gapplication-example-cmdline2' : {'install' : false},
354   'gapplication-example-cmdline3' : {'install' : false},
355   'gapplication-example-cmdline4' : {'install' : false},
356   'gapplication-example-dbushooks' : {'install' : false},
357   'gapplication-example-open' : {'install' : false},
358   'gdbus-daemon' : {
359     'extra_sources' : gdbus_daemon_sources,
360     'install' : false,
361   },
362   'gdbus-example-export' : {'install' : false},
363   'gdbus-example-own-name' : {'install' : false},
364   'gdbus-example-peer' : {'install' : false},
365   'gdbus-example-proxy-subclass' : {'install' : false},
366   'gdbus-example-server' : {'install' : false},
367   'gdbus-example-subtree' : {'install' : false},
368   'gdbus-example-watch-name' : {'install' : false},
369   'gdbus-example-watch-proxy' : {'install' : false},
370   'httpd' : {'install' : false},
371   'proxy' : {'install' : false},
372   'resolver' : {'install' : false},
373   'send-data' : {'install' : false},
374   'socket-server' : {'install' : false},
375   'socket-client' : {
376     'extra_sources' : ['gtlsconsoleinteraction.c'],
377     'install' : false,
378   },
379 }
380
381 if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
382   test_extra_programs += {
383     # These three are manual-run tests because they need a session bus but don't bring one up themselves
384     # FIXME: these build but don't seem to work!
385     'gdbus-example-objectmanager-client' : {
386       'dependencies' : [libgdbus_example_objectmanager_dep],
387       'install' : false,
388     },
389     'gdbus-example-objectmanager-server' : {
390       'dependencies' : [libgdbus_example_objectmanager_dep],
391       'install' : false,
392     },
393     'gdbus-test-fixture' : {
394       'dependencies' : [libgdbus_example_objectmanager_dep],
395       'install' : false,
396     },
397   }
398 endif
399
400 if host_machine.system() != 'windows'
401   test_extra_programs += {
402     'gdbus-example-unix-fd-client' : {
403       'install' : false,
404     },
405   }
406 endif
407
408 appinfo_test_desktop_files = [
409   'appinfo-test-gnome.desktop',
410   'appinfo-test-notgnome.desktop',
411   'appinfo-test.desktop',
412   'appinfo-test2.desktop',
413 ]
414
415 cdata = configuration_data()
416 if installed_tests_enabled
417   cdata.set('installed_tests_dir', installed_tests_execdir)
418 else
419   cdata.set('installed_tests_dir', meson.current_build_dir())
420 endif
421
422 foreach appinfo_test_desktop_file : appinfo_test_desktop_files
423   if installed_tests_enabled
424     configure_file(
425       input: appinfo_test_desktop_file + '.in',
426       output: appinfo_test_desktop_file,
427       install_dir: installed_tests_execdir,
428       configuration: cdata,
429     )
430   else
431     configure_file(
432       input: appinfo_test_desktop_file + '.in',
433       output: appinfo_test_desktop_file,
434       configuration: cdata,
435     )
436   endif
437 endforeach
438
439 if installed_tests_enabled
440   install_data(
441     'contexts.c',
442     'g-icon.c',
443     'appinfo-test-actions.desktop',
444     'appinfo-test-static.desktop',
445     'file.c',
446     'org.gtk.test.dbusappinfo.desktop',
447     'test1.overlay',
448     install_dir : installed_tests_execdir,
449   )
450   install_subdir('x-content', install_dir : installed_tests_execdir)
451   install_subdir('desktop-files', install_dir : installed_tests_execdir)
452   install_subdir('thumbnails', install_dir : installed_tests_execdir)
453   install_subdir('cert-tests', install_dir : installed_tests_execdir)
454
455   cdata = configuration_data()
456   cdata.set('installed_tests_dir', installed_tests_execdir)
457   cdata.set('program', 'static-link.py ' + glib_pkgconfigreldir)
458   configure_file(
459     input: installed_tests_template,
460     output: 'static-link.test',
461     install_dir: installed_tests_metadir,
462     configuration: cdata
463   )
464   install_subdir('static-link', install_dir : installed_tests_execdir)
465   install_data('static-link.py', install_dir : installed_tests_execdir)
466 endif
467
468 if not meson.is_cross_build() or meson.has_exe_wrapper()
469
470   plugin_resources_c = custom_target('plugin-resources.c',
471     input : 'test4.gresource.xml',
472     output : 'plugin-resources.c',
473     command : [glib_compile_resources,
474                '--target=@OUTPUT@',
475                '--sourcedir=' + meson.current_source_dir(),
476                '--generate-source',
477                '--c-name', '_g_plugin',
478                '@INPUT@'])
479
480   shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
481     link_args : export_dynamic_ldflags,
482     dependencies : common_gio_tests_deps,
483     install_dir : installed_tests_execdir,
484     install : installed_tests_enabled
485   )
486
487   # referenced by test2.gresource.xml
488   big_test_resource = custom_target(
489     'gresource-big-test.txt',
490     input : ['gen-big-test-resource.py'],
491     output : ['gresource-big-test.txt'],
492     command : [python, '@INPUT0@', '@OUTPUT@'])
493
494   test_gresource = custom_target('test.gresource',
495     input : 'test.gresource.xml',
496     output : 'test.gresource',
497     command : [glib_compile_resources,
498                '--target=@OUTPUT@',
499                '--sourcedir=' + meson.current_source_dir(),
500                '--sourcedir=' + meson.current_build_dir(),
501                '@INPUT@'],
502     install_dir : installed_tests_execdir,
503     install : installed_tests_enabled)
504
505   test_resources2_c = custom_target('test_resources2.c',
506     input : 'test3.gresource.xml',
507     output : 'test_resources2.c',
508     command : [glib_compile_resources,
509                '--target=@OUTPUT@',
510                '--sourcedir=' + meson.current_source_dir(),
511                '--generate',
512                '--c-name', '_g_test2',
513                '--manual-register',
514                '@INPUT@'])
515
516   test_resources2_h = custom_target('test_resources2.h',
517     input : 'test3.gresource.xml',
518     output : 'test_resources2.h',
519     command : [glib_compile_resources,
520                '--target=@OUTPUT@',
521                '--sourcedir=' + meson.current_source_dir(),
522                '--generate',
523                '--c-name', '_g_test2',
524                '--manual-register',
525                '@INPUT@'])
526
527   test_resources_c = custom_target('test_resources.c',
528     input : 'test2.gresource.xml',
529     depends : big_test_resource,
530     output : 'test_resources.c',
531     command : [glib_compile_resources,
532                '--target=@OUTPUT@',
533                '--sourcedir=' + meson.current_source_dir(),
534                '--sourcedir=' + meson.current_build_dir(),
535                '--generate-source',
536                '--c-name', '_g_test1',
537                '@INPUT@'])
538
539   digit_test_resources_c = custom_target('digit_test_resources.c',
540     input : '111_digit_test.gresource.xml',
541     output : 'digit_test_resources.c',
542     command : [glib_compile_resources,
543                '--target=@OUTPUT@',
544                '--sourcedir=' + meson.current_source_dir(),
545                '--sourcedir=' + meson.current_build_dir(),
546                '--generate-source',
547                '--manual-register',
548                '@INPUT@'])
549
550   digit_test_resources_h = custom_target('digit_test_resources.h',
551     input : '111_digit_test.gresource.xml',
552     output : 'digit_test_resources.h',
553     command : [glib_compile_resources,
554                '--target=@OUTPUT@',
555                '--sourcedir=' + meson.current_source_dir(),
556                '--generate',
557                '--manual-register',
558                '@INPUT@'])
559
560   # referenced by test.gresource.xml
561   test_generated_txt = configure_file(input : 'test1.txt',
562     output : 'test-generated.txt',
563     copy : true,
564   )
565
566   resources_extra_sources = [
567     test_gresource,
568     test_resources_c,
569     test_resources2_c,
570     test_resources2_h,
571     digit_test_resources_c,
572     digit_test_resources_h,
573   ]
574
575   # Create object file containing resource data for testing the --external-data
576   # option. Currently only GNU ld and GNU objcopy support the right options.
577   # Support for --add-symbol was added to LLVM objcopy in 2019
578   # (https://reviews.llvm.org/D58234). FIXME: This test could be enabled for
579   # LLVM once that support is in a stable release.
580   objcopy = find_program('objcopy', required : false)
581
582   if build_machine.system() == 'linux' and cc.get_id() == 'gcc' and objcopy.found()
583     test_gresource_binary = custom_target('test5.gresource',
584       input : 'test5.gresource.xml',
585       output : 'test5.gresource',
586       command : [glib_compile_resources,
587                  '--target=@OUTPUT@',
588                  '--sourcedir=' + meson.current_source_dir(),
589                  '--sourcedir=' + meson.current_build_dir(),
590                  '@INPUT@'],
591       install_dir : installed_tests_execdir,
592       install : installed_tests_enabled)
593
594     # Create resource data file
595     test_resources_binary_c = custom_target('test_resources_binary.c',
596       input : 'test5.gresource.xml',
597       output : 'test_resources_binary.c',
598       command : [glib_compile_resources,
599                  '--target=@OUTPUT@',
600                  '--sourcedir=' + meson.current_source_dir(),
601                  '--sourcedir=' + meson.current_build_dir(),
602                  '--generate-source',
603                  '--external-data',
604                  '--c-name', '_g_binary_test1',
605                  '@INPUT@'])
606
607     # Create object file containing resource data
608     test_resources_binary = custom_target('test_resources.o',
609       input : test_gresource_binary,
610       output : 'test_resources.o',
611       command : ['ld',
612                  '-r',
613                  '-b','binary',
614                  '@INPUT@',
615                  '-o','@OUTPUT@'])
616
617     # Rename symbol to match the one in the C file
618     test_resources_binary2 = custom_target('test_resources2.o',
619       input : test_resources_binary,
620       output : 'test_resources2.o',
621       command : [objcopy,
622                  '--add-symbol','_g_binary_test1_resource_data=.data:0',
623                  '@INPUT@',
624                  '@OUTPUT@'])
625
626     resources_extra_sources += [
627       test_resources_binary_c,
628       test_resources_binary2,
629     ]
630   endif
631
632   gio_tests += {
633     'resources' : {
634       'extra_sources' : resources_extra_sources,
635     },
636   }
637 endif
638
639 foreach test_name, extra_args : gio_tests
640   source = extra_args.get('source', test_name + '.c')
641   extra_sources = extra_args.get('extra_sources', [])
642   install = installed_tests_enabled and extra_args.get('install', true)
643   installed_tests_env = extra_args.get('installed_tests_env', {})
644
645   if install
646     test_conf = configuration_data()
647     test_conf.set('installed_tests_dir', installed_tests_execdir)
648     test_conf.set('program', test_name)
649     test_env_override = ''
650     if installed_tests_env != {}
651       envs = []
652       foreach var, value : installed_tests_env
653          envs += '@0@=@1@'.format(var, value)
654       endforeach
655       test_env_override = '@0@ @1@ '.format(env_program.path(), ' '.join(envs))
656     endif
657     test_conf.set('env', test_env_override)
658     configure_file(
659       input: installed_tests_template_tap,
660       output: test_name + '.test',
661       install_dir: installed_tests_metadir,
662       configuration: test_conf
663     )
664   endif
665
666   exe = executable(test_name, [source, extra_sources],
667     c_args : test_c_args + extra_args.get('c_args', []),
668     dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
669     install_rpath : extra_args.get('install_rpath', ''),
670     install_dir: installed_tests_execdir,
671     install: install,
672   )
673
674   suite = ['gio'] + extra_args.get('suite', [])
675   timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
676   local_test_env = test_env
677
678   foreach var, value : extra_args.get('env', {})
679     local_test_env.append(var, value)
680   endforeach
681
682   test(test_name, exe,
683     env : local_test_env,
684     timeout : timeout,
685     suite : suite,
686     is_parallel : extra_args.get('is_parallel', true),
687     depends : extra_args.get('depends', []),
688   )
689 endforeach
690
691 foreach program_name, extra_args : test_extra_programs
692   source = extra_args.get('source', program_name + '.c')
693   extra_sources = extra_args.get('extra_sources', [])
694   install = installed_tests_enabled and extra_args.get('install', true)
695   executable(program_name, [source, extra_sources],
696       c_args : test_c_args,
697       dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
698       install_dir : installed_tests_execdir,
699       install : install,
700   )
701 endforeach
702
703 # FIXME: subdir('services')
704 subdir('modules')