Imported Upstream version 2.61.1
[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'
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     # FIXME: This list will probably grow; see
144     # https://gitlab.gnome.org/GNOME/glib/issues/1739
145     no_libdl_systems = ['freebsd', 'netbsd', 'openbsd']
146
147     gio_tests += {
148       'gsocketclient-slow' : {
149         'depends' : [
150           shared_library('slow-connect-preload',
151             'slow-connect-preload.c',
152             name_prefix : '',
153             dependencies: cc.find_library('dl', required: not no_libdl_systems.contains(host_machine.system())),
154             install_dir : installed_tests_execdir,
155             install: installed_tests_enabled,
156           )
157         ],
158         'env' : {
159           'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(meson.current_build_dir())
160         },
161         'installed_tests_env' : {
162           'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(installed_tests_execdir),
163         },
164       },
165     }
166   endif
167
168   # Uninstalled because of the check-for-executable logic in DesktopAppInfo
169   # unable to find the installed executable
170   if not glib_have_cocoa
171     gio_tests += {
172       'appinfo' : {
173         'install' : false,
174       },
175       'desktop-app-info' : {
176         'install' : false,
177       },
178     }
179   endif
180
181   test_extra_programs += {
182     'basic-application' : {},
183     'dbus-launch' : {},
184     'appinfo-test' : {},
185   }
186
187   if not glib_have_cocoa
188     test_extra_programs += {
189       'apps' : {},
190     }
191     gio_tests += {
192       'mimeapps' : {},
193     }
194   endif
195
196   #  Test programs that need to bring up a session bus (requires dbus-daemon)
197   have_dbus_daemon = find_program('dbus-daemon', required : false).found()
198   if have_dbus_daemon
199     annotate_args = [
200       '--annotate', 'org.project.Bar', 'Key1', 'Value1',
201       '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
202       '--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
203       '--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
204       '--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
205       '--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
206       '--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
207       '--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
208     ]
209     # Generate gdbus-test-codegen-generated.{c,h}
210     gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
211         input :   ['test-codegen.xml'],
212         output :  ['gdbus-test-codegen-generated.h',
213                    'gdbus-test-codegen-generated.c'],
214         depend_files : gdbus_codegen_built_files,
215         command : [python, gdbus_codegen,
216                    '--interface-prefix', 'org.project.',
217                    '--output-directory', '@OUTDIR@',
218                    '--generate-c-code', 'gdbus-test-codegen-generated',
219                    '--c-generate-object-manager',
220                    '--c-generate-autocleanup', 'all',
221                    '--c-namespace', 'Foo_iGen',
222                    '--generate-docbook', 'gdbus-test-codegen-generated-doc',
223                    annotate_args,
224                    '@INPUT@'])
225
226     gdbus_test_codegen_generated_interface_info = [
227       custom_target('gdbus-test-codegen-generated-interface-info-h',
228           input :   ['test-codegen.xml'],
229           output :  ['gdbus-test-codegen-generated-interface-info.h'],
230           depend_files : gdbus_codegen_built_files,
231           command : [python, gdbus_codegen,
232                      '--interface-info-header',
233                      annotate_args,
234                      '--output', '@OUTPUT@',
235                      '@INPUT@']),
236       custom_target('gdbus-test-codegen-generated-interface-info-c',
237           input :   ['test-codegen.xml'],
238           output :  ['gdbus-test-codegen-generated-interface-info.c'],
239           depend_files : gdbus_codegen_built_files,
240           command : [python, gdbus_codegen,
241                      '--interface-info-body',
242                      annotate_args,
243                      '--output', '@OUTPUT@',
244                      '@INPUT@']),
245     ]
246
247     extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
248
249     gio_tests += {
250       'actions' : {
251         'extra_sources' : extra_sources,
252         'suite' : ['slow'],
253       },
254       'gdbus-auth' : {'extra_sources' : extra_sources},
255       'gdbus-bz627724' : {'extra_sources' : extra_sources},
256       'gdbus-close-pending' : {'extra_sources' : extra_sources},
257       'gdbus-connection' : {'extra_sources' : extra_sources},
258       'gdbus-connection-loss' : {'extra_sources' : extra_sources},
259       'gdbus-connection-slow' : {'extra_sources' : extra_sources},
260       'gdbus-error' : {'extra_sources' : extra_sources},
261       'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
262       'gdbus-export' : {
263         'extra_sources' : extra_sources,
264         'suite' : ['slow'],
265       },
266       'gdbus-introspection' : {'extra_sources' : extra_sources},
267       'gdbus-names' : {'extra_sources' : extra_sources},
268       'gdbus-proxy' : {'extra_sources' : extra_sources},
269       'gdbus-proxy-threads' : {
270         'extra_sources' : extra_sources,
271         'dependencies' : [dbus1_dep],
272       },
273       'gdbus-proxy-unique-name' : {'extra_sources' : extra_sources},
274       'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
275       'gdbus-test-codegen' : {
276         'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
277       },
278       'gdbus-threading' : {
279         'extra_sources' : extra_sources,
280         'suite' : ['slow', 'flaky'],
281       },
282       'gmenumodel' : {
283         'extra_sources' : extra_sources,
284         'suite' : ['slow'],
285       },
286       'gnotification' : {
287         'extra_sources' : [extra_sources, 'gnotification-server.c'],
288       },
289       'gdbus-test-codegen-old' : {
290         'source' : 'gdbus-test-codegen.c',
291         'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
292         'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
293                     '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
294       },
295       'gapplication' : {'extra_sources' : extra_sources},
296     }
297
298     if not glib_have_cocoa
299       gio_tests += {
300         'dbus-appinfo' : {
301           'extra_sources' : extra_sources,
302         },
303       }
304     endif
305   endif # have_dbus_daemon
306
307   # This test is currently unreliable
308   executable('gdbus-overflow', 'gdbus-overflow.c',
309       c_args : test_c_args,
310       dependencies : common_gio_tests_deps,
311       install_dir : installed_tests_execdir,
312       install : installed_tests_enabled)
313
314   gio_tests += {
315     'gdbus-connection-flush' : {
316       'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
317     },
318     'gdbus-non-socket' : {
319       'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
320     },
321   }
322
323   # Generate test.mo from de.po using msgfmt
324   msgfmt = find_program('msgfmt', required : false)
325   if msgfmt.found()
326     subdir('de/LC_MESSAGES')
327     gio_tests += {
328       'gsettings' : {
329         'extra_sources' : [test_mo],
330         'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
331                     '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
332         'install' : false,
333       },
334     }
335   endif
336 endif # unix
337
338 #  Test programs buildable on Windows only
339 if host_machine.system() == 'windows'
340   gio_tests += {'win32-streams' : {}}
341 endif
342
343 if cc.get_id() != 'msvc'
344   gio_tests += {
345     'autoptr-gio' : {
346       'source' : 'autoptr.c',
347     },
348   }
349 endif
350
351 test_extra_programs += {
352   'gio-du' : {'install' : false},
353   'echo-server' : {'install' : false},
354   'filter-cat' : {'install' : false},
355   'gapplication-example-actions' : {'install' : false},
356   'gapplication-example-cmdline' : {'install' : false},
357   'gapplication-example-cmdline2' : {'install' : false},
358   'gapplication-example-cmdline3' : {'install' : false},
359   'gapplication-example-cmdline4' : {'install' : false},
360   'gapplication-example-dbushooks' : {'install' : false},
361   'gapplication-example-open' : {'install' : false},
362   'gdbus-daemon' : {
363     'extra_sources' : gdbus_daemon_sources,
364     'install' : false,
365   },
366   'gdbus-example-export' : {'install' : false},
367   'gdbus-example-own-name' : {'install' : false},
368   'gdbus-example-peer' : {'install' : false},
369   'gdbus-example-proxy-subclass' : {'install' : false},
370   'gdbus-example-server' : {'install' : false},
371   'gdbus-example-subtree' : {'install' : false},
372   'gdbus-example-watch-name' : {'install' : false},
373   'gdbus-example-watch-proxy' : {'install' : false},
374   'httpd' : {'install' : false},
375   'proxy' : {'install' : false},
376   'resolver' : {'install' : false},
377   'send-data' : {'install' : false},
378   'socket-server' : {'install' : false},
379   'socket-client' : {
380     'extra_sources' : ['gtlsconsoleinteraction.c'],
381     'install' : false,
382   },
383 }
384
385 if cc.get_id() != 'msvc'
386   test_extra_programs += {
387     # These three are manual-run tests because they need a session bus but don't bring one up themselves
388     # FIXME: these build but don't seem to work!
389     'gdbus-example-objectmanager-client' : {
390       'dependencies' : [libgdbus_example_objectmanager_dep],
391       'install' : false,
392     },
393     'gdbus-example-objectmanager-server' : {
394       'dependencies' : [libgdbus_example_objectmanager_dep],
395       'install' : false,
396     },
397     'gdbus-test-fixture' : {
398       'dependencies' : [libgdbus_example_objectmanager_dep],
399       'install' : false,
400     },
401   }
402 endif
403
404 if host_machine.system() != 'windows'
405   test_extra_programs += {
406     'gdbus-example-unix-fd-client' : {
407       'install' : false,
408     },
409   }
410 endif
411
412 appinfo_test_desktop_files = [
413   'appinfo-test-gnome.desktop',
414   'appinfo-test-notgnome.desktop',
415   'appinfo-test.desktop',
416   'appinfo-test2.desktop',
417 ]
418
419 cdata = configuration_data()
420 if installed_tests_enabled
421   cdata.set('installed_tests_dir', installed_tests_execdir)
422 else
423   cdata.set('installed_tests_dir', meson.current_build_dir())
424 endif
425
426 foreach appinfo_test_desktop_file : appinfo_test_desktop_files
427   configure_file(
428     input: appinfo_test_desktop_file + '.in',
429     output: appinfo_test_desktop_file,
430     install_dir: installed_tests_execdir,
431     install: installed_tests_enabled,
432     configuration: cdata,
433   )
434 endforeach
435
436 if installed_tests_enabled
437   install_data(
438     'contexts.c',
439     'g-icon.c',
440     'appinfo-test-actions.desktop',
441     'appinfo-test-static.desktop',
442     'file.c',
443     'org.gtk.test.dbusappinfo.desktop',
444     'test1.overlay',
445     install_dir : installed_tests_execdir,
446   )
447   install_subdir('x-content', install_dir : installed_tests_execdir)
448   install_subdir('desktop-files', install_dir : installed_tests_execdir)
449   install_subdir('thumbnails', install_dir : installed_tests_execdir)
450   install_subdir('cert-tests', install_dir : installed_tests_execdir)
451
452   cdata = configuration_data()
453   cdata.set('installed_tests_dir', installed_tests_execdir)
454   cdata.set('program', 'static-link.py ' + glib_pkgconfigreldir)
455   configure_file(
456     input: installed_tests_template,
457     output: 'static-link.test',
458     install_dir: installed_tests_metadir,
459     configuration: cdata
460   )
461   install_subdir('static-link', install_dir : installed_tests_execdir)
462   install_data('static-link.py', install_dir : installed_tests_execdir)
463 endif
464
465 if not meson.is_cross_build() or meson.has_exe_wrapper()
466
467   plugin_resources_c = custom_target('plugin-resources.c',
468     input : 'test4.gresource.xml',
469     output : 'plugin-resources.c',
470     command : [glib_compile_resources,
471                '--target=@OUTPUT@',
472                '--sourcedir=' + meson.current_source_dir(),
473                '--generate-source',
474                '--c-name', '_g_plugin',
475                '@INPUT@'])
476
477   shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
478     link_args : export_dynamic_ldflags,
479     dependencies : common_gio_tests_deps,
480     install_dir : installed_tests_execdir,
481     install : installed_tests_enabled
482   )
483
484   # referenced by test2.gresource.xml
485   big_test_resource = custom_target(
486     'gresource-big-test.txt',
487     input : ['gen-big-test-resource.py'],
488     output : ['gresource-big-test.txt'],
489     command : [python, '@INPUT0@', '@OUTPUT@'])
490
491   test_gresource = custom_target('test.gresource',
492     input : 'test.gresource.xml',
493     output : 'test.gresource',
494     command : [glib_compile_resources,
495                '--target=@OUTPUT@',
496                '--sourcedir=' + meson.current_source_dir(),
497                '--sourcedir=' + meson.current_build_dir(),
498                '@INPUT@'],
499     install_dir : installed_tests_execdir,
500     install : installed_tests_enabled)
501
502   test_resources2_c = custom_target('test_resources2.c',
503     input : 'test3.gresource.xml',
504     output : 'test_resources2.c',
505     command : [glib_compile_resources,
506                '--target=@OUTPUT@',
507                '--sourcedir=' + meson.current_source_dir(),
508                '--generate',
509                '--c-name', '_g_test2',
510                '--manual-register',
511                '@INPUT@'])
512
513   test_resources2_h = custom_target('test_resources2.h',
514     input : 'test3.gresource.xml',
515     output : 'test_resources2.h',
516     command : [glib_compile_resources,
517                '--target=@OUTPUT@',
518                '--sourcedir=' + meson.current_source_dir(),
519                '--generate',
520                '--c-name', '_g_test2',
521                '--manual-register',
522                '@INPUT@'])
523
524   test_resources_c = custom_target('test_resources.c',
525     input : 'test2.gresource.xml',
526     depends : big_test_resource,
527     output : 'test_resources.c',
528     command : [glib_compile_resources,
529                '--target=@OUTPUT@',
530                '--sourcedir=' + meson.current_source_dir(),
531                '--sourcedir=' + meson.current_build_dir(),
532                '--generate-source',
533                '--c-name', '_g_test1',
534                '@INPUT@'])
535
536   digit_test_resources_c = custom_target('digit_test_resources.c',
537     input : '111_digit_test.gresource.xml',
538     output : 'digit_test_resources.c',
539     command : [glib_compile_resources,
540                '--target=@OUTPUT@',
541                '--sourcedir=' + meson.current_source_dir(),
542                '--sourcedir=' + meson.current_build_dir(),
543                '--generate-source',
544                '--manual-register',
545                '@INPUT@'])
546
547   digit_test_resources_h = custom_target('digit_test_resources.h',
548     input : '111_digit_test.gresource.xml',
549     output : 'digit_test_resources.h',
550     command : [glib_compile_resources,
551                '--target=@OUTPUT@',
552                '--sourcedir=' + meson.current_source_dir(),
553                '--generate',
554                '--manual-register',
555                '@INPUT@'])
556
557   # referenced by test.gresource.xml
558   test_generated_txt = configure_file(input : 'test1.txt',
559     output : 'test-generated.txt',
560     copy : true,
561     install : false)
562
563   resources_extra_sources = [
564     test_gresource,
565     test_resources_c,
566     test_resources2_c,
567     test_resources2_h,
568     digit_test_resources_c,
569     digit_test_resources_h,
570   ]
571
572   # Create object file containing resource data for testing the --external-data
573   # option. Currently only GNU ld and GNU objcopy support the right options.
574   # Support for --add-symbol was added to LLVM objcopy in 2019
575   # (https://reviews.llvm.org/D58234). FIXME: This test could be enabled for
576   # LLVM once that support is in a stable release.
577   if build_machine.system() == 'linux' and cc.get_id() == 'gcc'
578     test_gresource_binary = custom_target('test5.gresource',
579       input : 'test5.gresource.xml',
580       output : 'test5.gresource',
581       command : [glib_compile_resources,
582                  '--target=@OUTPUT@',
583                  '--sourcedir=' + meson.current_source_dir(),
584                  '--sourcedir=' + meson.current_build_dir(),
585                  '@INPUT@'],
586       install_dir : installed_tests_execdir,
587       install : installed_tests_enabled)
588
589     # Create resource data file
590     test_resources_binary_c = custom_target('test_resources_binary.c',
591       input : 'test5.gresource.xml',
592       output : 'test_resources_binary.c',
593       command : [glib_compile_resources,
594                  '--target=@OUTPUT@',
595                  '--sourcedir=' + meson.current_source_dir(),
596                  '--sourcedir=' + meson.current_build_dir(),
597                  '--generate-source',
598                  '--external-data',
599                  '--c-name', '_g_binary_test1',
600                  '@INPUT@'])
601
602     # Create object file containing resource data
603     test_resources_binary = custom_target('test_resources.o',
604       input : test_gresource_binary,
605       output : 'test_resources.o',
606       command : ['ld',
607                  '-r',
608                  '-b','binary',
609                  '@INPUT@',
610                  '-o','@OUTPUT@'])
611
612     # Rename symbol to match the one in the C file
613     test_resources_binary2 = custom_target('test_resources2.o',
614       input : test_resources_binary,
615       output : 'test_resources2.o',
616       command : ['objcopy',
617                  '--add-symbol','_g_binary_test1_resource_data=.data:0',
618                  '@INPUT@',
619                  '@OUTPUT@'])
620
621     resources_extra_sources += [
622       test_resources_binary_c,
623       test_resources_binary2,
624     ]
625   endif
626
627   gio_tests += {
628     'resources' : {
629       'extra_sources' : resources_extra_sources,
630     },
631   }
632 endif
633
634 foreach test_name, extra_args : gio_tests
635   source = extra_args.get('source', test_name + '.c')
636   extra_sources = extra_args.get('extra_sources', [])
637   install = installed_tests_enabled and extra_args.get('install', true)
638   installed_tests_env = extra_args.get('installed_tests_env', {})
639
640   if install
641     test_conf = configuration_data()
642     test_conf.set('installed_tests_dir', installed_tests_execdir)
643     test_conf.set('program', test_name)
644     test_env_override = ''
645     if installed_tests_env != {}
646       envs = []
647       foreach var, value : installed_tests_env
648          envs += '@0@=@1@'.format(var, value)
649       endforeach
650       test_env_override = '@0@ @1@ '.format(env_program.path(), ' '.join(envs))
651     endif
652     test_conf.set('env', test_env_override)
653     configure_file(
654       input: installed_tests_template_tap,
655       output: test_name + '.test',
656       install_dir: installed_tests_metadir,
657       configuration: test_conf
658     )
659   endif
660
661   exe = executable(test_name, [source, extra_sources],
662     c_args : test_c_args + extra_args.get('c_args', []),
663     dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
664     install_rpath : extra_args.get('install_rpath', ''),
665     install_dir: installed_tests_execdir,
666     install: install,
667   )
668
669   suite = ['gio'] + extra_args.get('suite', [])
670   timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
671   local_test_env = test_env
672
673   foreach var, value : extra_args.get('env', {})
674     local_test_env.append(var, value)
675   endforeach
676
677   test(test_name, exe,
678     env : local_test_env,
679     timeout : timeout,
680     suite : suite,
681     is_parallel : extra_args.get('is_parallel', true),
682     depends : extra_args.get('depends', []),
683   )
684 endforeach
685
686 foreach program_name, extra_args : test_extra_programs
687   source = extra_args.get('source', program_name + '.c')
688   extra_sources = extra_args.get('extra_sources', [])
689   install = installed_tests_enabled and extra_args.get('install', true)
690   executable(program_name, [source, extra_sources],
691       c_args : test_c_args,
692       dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
693       install_dir : installed_tests_execdir,
694       install : install,
695   )
696 endforeach
697
698 # FIXME: subdir('services')
699 subdir('modules')