meson: Fix glib, add gobject, gio, gthread, gmodule, etc
[glib.git] / gio / tests / meson.build
blob3715005c7d9ca36c8be61789b996c15099c26d3f
1 #  Test programs buildable on all platforms
2 gio_tests = [
3   'appmonitor',
4   'async-close-output-stream',
5   'async-splice-output-stream',
6   'buffered-input-stream',
7   'buffered-output-stream',
8   'cancellable',
9   'contexts',
10   'contenttype',
11   'converter-stream',
12   'credentials',
13   'data-input-stream',
14   'data-output-stream',
15   #'defaultvalue',           # FIXME: needs giotypefuncs.c generated
16   'fileattributematcher',
17   'filter-streams',
18   'giomodule',
19   'gsubprocess',
20   'g-file',
21   'g-file-info',
22   'g-icon',
23   'gdbus-addresses',
24   'gdbus-message',
25   'inet-address',
26   'io-stream',
27   'memory-input-stream',
28   'memory-output-stream',
29   'monitor',
30   'network-address',
31   'network-monitor',
32   'permission',
33   'pollable',
34   'proxy-test',
35   'readwrite',
36   'simple-async-result',
37   'simple-proxy',
38   'sleepy-stream',
39   'socket',
40   'socket-listener',
41   'socket-service',
42   'srvtarget',
43   'task',
44   'vfs',
45   'volumemonitor',
46   'glistmodel',
47   'testfilemonitor',
50 gio_tests += [
51   'thumbnail-verification',
54 #  Test programs buildable on UNIX only
56 if host_machine.system() != 'windows'
57   gio_tests += [
58     'file',
59     'gdbus-peer-object-manager',
60     'gdbus-unix-addresses',
61     'live-g-file',
62     'socket-address',
63     'stream-rw_all',
64     'unix-fd',
65     'unix-streams',
66   ]
67 endif
69 if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
70   gio_tests += [ 'autoptr' ]
71 endif
73 test_env = [
74   'G_TEST_SRCDIR=' + meson.current_source_dir(),
75   'G_TEST_BUILDDIR=' + meson.current_build_dir(),
78 test_c_args = [
79   '-DHAVE_CONFIG_H=1',
80   '-DG_LOG_DOMAIN="GLib-GIO"',
81   '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
84 foreach test_name : gio_tests
85   src_file = '@0@.c'.format(test_name)
86   # conflicts with glib/tests/autoptr, can't have two targets with same name
87   if test_name == 'autoptr'
88     test_name = 'autoptr-gio'
89   endif
90   exe = executable(test_name, src_file,
91       include_directories : inc_dirs,
92       install : false,
93       c_args : test_c_args,
94       link_with : [ libgio, libgmodule, libglib ],
95       dependencies : deps,
96   )
97   if test_name == 'testfilemonitor'
98     test(test_name, exe, env : test_env, timeout : 45)
99   else
100     test(test_name, exe, env : test_env)
101   endif
102 endforeach
104 uninstalled_test_extra_programs = [
105   'gio-du',
106   'echo-server',
107   'filter-cat',
108   'gapplication-example-actions',
109   'gapplication-example-cmdline',
110   'gapplication-example-cmdline2',
111   'gapplication-example-cmdline3',
112   'gapplication-example-dbushooks',
113   'gapplication-example-open',
114   'gdbus-example-export',
115   'gdbus-example-own-name',
116   'gdbus-example-peer',
117   'gdbus-example-proxy-subclass',
118   'gdbus-example-server',
119   'gdbus-example-subtree',
120   'gdbus-example-watch-name',
121   'gdbus-example-watch-proxy',
122   'gsubprocess-testprog',
123   'httpd',
124   'proxy',
125   'resolver',
126   'send-data',
127   'socket-server',
130 foreach extra_program : uninstalled_test_extra_programs
131   exe = executable(extra_program, '@0@.c'.format(extra_program),
132       include_directories : inc_dirs,
133       install : false,
134       c_args : test_c_args,
135       link_with : [ libgio, libgmodule, libglib ],
136       dependencies : deps,
137   )
138 endforeach
140 test_extra_programs = [
141   'gdbus-connection-flush-helper',
142   'gdbus-testserver',
145 exe = executable('tls-certificate', 'tls-certificate.c', 'gtesttlsbackend.c',
146   include_directories : inc_dirs,
147   c_args : test_c_args,
148   link_with : [ libgio, libgmodule, libglib ],
149   dependencies : deps,
151 test('tls-certificate', exe, env : test_env)
153 exe = executable('socket-client', 'socket-client.c', 'gtlsconsoleinteraction.c',
154   include_directories : inc_dirs,
155   c_args : test_c_args,
156   link_with : [ libgio, libgmodule, libglib ],
157   dependencies : deps,
160 #exe = executable('gdbus-daemon', 'gdbus-daemon.c', '../gdbusdaemon.c',
161 #  #meson.build_root() + '/gio/gdbus-daemon-generated.c', # FIXME
162 #  include_directories : inc_dirs,
163 #  c_args : test_c_args,
164 #  link_with : [ libgio, libgmodule, libglib ],
165 #  dependencies : deps,
167 #test('gdbus-daemon', exe, env : test_env)
169 foo = '''
170 c_args_atomic = [ ]
171 if cc.get_id() == 'gcc'
172   c_args_atomic += [ '-Wstrict-aliasing=2' ]
173 endif
175 # FIXME: consolidate all of these into the array
176 exe = executable('overflow-fallback', 'overflow.c',
177   include_directories : inc_dirs,
178   c_args : [ '-DHAVE_CONFIG_H=1', '-D_GLIB_TEST_OVERFLOW_FALLBACK' ],
179   link_with : libglib,
180   dependencies : deps,
182 test('overflow-fallback', exe, env : test_env)
184 exe = executable('642026-ec', '642026.c',
185   include_directories : inc_dirs,
186   c_args : [ '-DHAVE_CONFIG_H=1', '-DG_ERRORCHECK_MUTEXES' ],
187   link_with : libglib,
188   dependencies : deps,
190 test('642026-ec', exe, env : test_env)
192 exe = executable('1bit-emufutex', '1bit-mutex.c',
193   include_directories : inc_dirs,
194   c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EMULATED_FUTEX' ],
195   link_with : libglib,
196   dependencies : deps,
198 test('1bit-emufutex', exe, env : test_env)
200 if glib_conf.has('HAVE_EVENTFD')
201   exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
202     include_directories : inc_dirs,
203     c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EVENTFD_FALLBACK' ],
204     link_with : libglib,
205     dependencies : deps,
206   )
207   test('gwakeup-fallback', exe, env : test_env)
208 endif
210 # test-spawn-echo helper binary required by the spawn tests
211 executable('test-spawn-echo', 'test-spawn-echo.c',
212            include_directories : inc_dirs,
213            c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"' ],
214            link_with : libglib,
215            dependencies : deps,
219 subdir('modules')