Imported Upstream version 2.61.2
[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     # 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' and cc.get_id() != 'clang-cl'
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   if installed_tests_enabled
428     configure_file(
429       input: appinfo_test_desktop_file + '.in',
430       output: appinfo_test_desktop_file,
431       install_dir: installed_tests_execdir,
432       configuration: cdata,
433     )
434   else
435     configure_file(
436       input: appinfo_test_desktop_file + '.in',
437       output: appinfo_test_desktop_file,
438       configuration: cdata,
439     )
440   endif
441 endforeach
442
443 if installed_tests_enabled
444   install_data(
445     'contexts.c',
446     'g-icon.c',
447     'appinfo-test-actions.desktop',
448     'appinfo-test-static.desktop',
449     'file.c',
450     'org.gtk.test.dbusappinfo.desktop',
451     'test1.overlay',
452     install_dir : installed_tests_execdir,
453   )
454   install_subdir('x-content', install_dir : installed_tests_execdir)
455   install_subdir('desktop-files', install_dir : installed_tests_execdir)
456   install_subdir('thumbnails', install_dir : installed_tests_execdir)
457   install_subdir('cert-tests', install_dir : installed_tests_execdir)
458
459   cdata = configuration_data()
460   cdata.set('installed_tests_dir', installed_tests_execdir)
461   cdata.set('program', 'static-link.py ' + glib_pkgconfigreldir)
462   configure_file(
463     input: installed_tests_template,
464     output: 'static-link.test',
465     install_dir: installed_tests_metadir,
466     configuration: cdata
467   )
468   install_subdir('static-link', install_dir : installed_tests_execdir)
469   install_data('static-link.py', install_dir : installed_tests_execdir)
470 endif
471
472 if not meson.is_cross_build() or meson.has_exe_wrapper()
473
474   plugin_resources_c = custom_target('plugin-resources.c',
475     input : 'test4.gresource.xml',
476     output : 'plugin-resources.c',
477     command : [glib_compile_resources,
478                '--target=@OUTPUT@',
479                '--sourcedir=' + meson.current_source_dir(),
480                '--generate-source',
481                '--c-name', '_g_plugin',
482                '@INPUT@'])
483
484   shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
485     link_args : export_dynamic_ldflags,
486     dependencies : common_gio_tests_deps,
487     install_dir : installed_tests_execdir,
488     install : installed_tests_enabled
489   )
490
491   # referenced by test2.gresource.xml
492   big_test_resource = custom_target(
493     'gresource-big-test.txt',
494     input : ['gen-big-test-resource.py'],
495     output : ['gresource-big-test.txt'],
496     command : [python, '@INPUT0@', '@OUTPUT@'])
497
498   test_gresource = custom_target('test.gresource',
499     input : 'test.gresource.xml',
500     output : 'test.gresource',
501     command : [glib_compile_resources,
502                '--target=@OUTPUT@',
503                '--sourcedir=' + meson.current_source_dir(),
504                '--sourcedir=' + meson.current_build_dir(),
505                '@INPUT@'],
506     install_dir : installed_tests_execdir,
507     install : installed_tests_enabled)
508
509   test_resources2_c = custom_target('test_resources2.c',
510     input : 'test3.gresource.xml',
511     output : 'test_resources2.c',
512     command : [glib_compile_resources,
513                '--target=@OUTPUT@',
514                '--sourcedir=' + meson.current_source_dir(),
515                '--generate',
516                '--c-name', '_g_test2',
517                '--manual-register',
518                '@INPUT@'])
519
520   test_resources2_h = custom_target('test_resources2.h',
521     input : 'test3.gresource.xml',
522     output : 'test_resources2.h',
523     command : [glib_compile_resources,
524                '--target=@OUTPUT@',
525                '--sourcedir=' + meson.current_source_dir(),
526                '--generate',
527                '--c-name', '_g_test2',
528                '--manual-register',
529                '@INPUT@'])
530
531   test_resources_c = custom_target('test_resources.c',
532     input : 'test2.gresource.xml',
533     depends : big_test_resource,
534     output : 'test_resources.c',
535     command : [glib_compile_resources,
536                '--target=@OUTPUT@',
537                '--sourcedir=' + meson.current_source_dir(),
538                '--sourcedir=' + meson.current_build_dir(),
539                '--generate-source',
540                '--c-name', '_g_test1',
541                '@INPUT@'])
542
543   digit_test_resources_c = custom_target('digit_test_resources.c',
544     input : '111_digit_test.gresource.xml',
545     output : 'digit_test_resources.c',
546     command : [glib_compile_resources,
547                '--target=@OUTPUT@',
548                '--sourcedir=' + meson.current_source_dir(),
549                '--sourcedir=' + meson.current_build_dir(),
550                '--generate-source',
551                '--manual-register',
552                '@INPUT@'])
553
554   digit_test_resources_h = custom_target('digit_test_resources.h',
555     input : '111_digit_test.gresource.xml',
556     output : 'digit_test_resources.h',
557     command : [glib_compile_resources,
558                '--target=@OUTPUT@',
559                '--sourcedir=' + meson.current_source_dir(),
560                '--generate',
561                '--manual-register',
562                '@INPUT@'])
563
564   # referenced by test.gresource.xml
565   test_generated_txt = configure_file(input : 'test1.txt',
566     output : 'test-generated.txt',
567     copy : true,
568   )
569
570   resources_extra_sources = [
571     test_gresource,
572     test_resources_c,
573     test_resources2_c,
574     test_resources2_h,
575     digit_test_resources_c,
576     digit_test_resources_h,
577   ]
578
579   # Create object file containing resource data for testing the --external-data
580   # option. Currently only GNU ld and GNU objcopy support the right options.
581   # Support for --add-symbol was added to LLVM objcopy in 2019
582   # (https://reviews.llvm.org/D58234). FIXME: This test could be enabled for
583   # LLVM once that support is in a stable release.
584   if build_machine.system() == 'linux' and cc.get_id() == 'gcc'
585     test_gresource_binary = custom_target('test5.gresource',
586       input : 'test5.gresource.xml',
587       output : 'test5.gresource',
588       command : [glib_compile_resources,
589                  '--target=@OUTPUT@',
590                  '--sourcedir=' + meson.current_source_dir(),
591                  '--sourcedir=' + meson.current_build_dir(),
592                  '@INPUT@'],
593       install_dir : installed_tests_execdir,
594       install : installed_tests_enabled)
595
596     # Create resource data file
597     test_resources_binary_c = custom_target('test_resources_binary.c',
598       input : 'test5.gresource.xml',
599       output : 'test_resources_binary.c',
600       command : [glib_compile_resources,
601                  '--target=@OUTPUT@',
602                  '--sourcedir=' + meson.current_source_dir(),
603                  '--sourcedir=' + meson.current_build_dir(),
604                  '--generate-source',
605                  '--external-data',
606                  '--c-name', '_g_binary_test1',
607                  '@INPUT@'])
608
609     # Create object file containing resource data
610     test_resources_binary = custom_target('test_resources.o',
611       input : test_gresource_binary,
612       output : 'test_resources.o',
613       command : ['ld',
614                  '-r',
615                  '-b','binary',
616                  '@INPUT@',
617                  '-o','@OUTPUT@'])
618
619     # Rename symbol to match the one in the C file
620     test_resources_binary2 = custom_target('test_resources2.o',
621       input : test_resources_binary,
622       output : 'test_resources2.o',
623       command : ['objcopy',
624                  '--add-symbol','_g_binary_test1_resource_data=.data:0',
625                  '@INPUT@',
626                  '@OUTPUT@'])
627
628     resources_extra_sources += [
629       test_resources_binary_c,
630       test_resources_binary2,
631     ]
632   endif
633
634   gio_tests += {
635     'resources' : {
636       'extra_sources' : resources_extra_sources,
637     },
638   }
639 endif
640
641 foreach test_name, extra_args : gio_tests
642   source = extra_args.get('source', test_name + '.c')
643   extra_sources = extra_args.get('extra_sources', [])
644   install = installed_tests_enabled and extra_args.get('install', true)
645   installed_tests_env = extra_args.get('installed_tests_env', {})
646
647   if install
648     test_conf = configuration_data()
649     test_conf.set('installed_tests_dir', installed_tests_execdir)
650     test_conf.set('program', test_name)
651     test_env_override = ''
652     if installed_tests_env != {}
653       envs = []
654       foreach var, value : installed_tests_env
655          envs += '@0@=@1@'.format(var, value)
656       endforeach
657       test_env_override = '@0@ @1@ '.format(env_program.path(), ' '.join(envs))
658     endif
659     test_conf.set('env', test_env_override)
660     configure_file(
661       input: installed_tests_template_tap,
662       output: test_name + '.test',
663       install_dir: installed_tests_metadir,
664       configuration: test_conf
665     )
666   endif
667
668   exe = executable(test_name, [source, extra_sources],
669     c_args : test_c_args + extra_args.get('c_args', []),
670     dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
671     install_rpath : extra_args.get('install_rpath', ''),
672     install_dir: installed_tests_execdir,
673     install: install,
674   )
675
676   suite = ['gio'] + extra_args.get('suite', [])
677   timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
678   local_test_env = test_env
679
680   foreach var, value : extra_args.get('env', {})
681     local_test_env.append(var, value)
682   endforeach
683
684   test(test_name, exe,
685     env : local_test_env,
686     timeout : timeout,
687     suite : suite,
688     is_parallel : extra_args.get('is_parallel', true),
689     depends : extra_args.get('depends', []),
690   )
691 endforeach
692
693 foreach program_name, extra_args : test_extra_programs
694   source = extra_args.get('source', program_name + '.c')
695   extra_sources = extra_args.get('extra_sources', [])
696   install = installed_tests_enabled and extra_args.get('install', true)
697   executable(program_name, [source, extra_sources],
698       c_args : test_c_args,
699       dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
700       install_dir : installed_tests_execdir,
701       install : install,
702   )
703 endforeach
704
705 # FIXME: subdir('services')
706 subdir('modules')