meson: Fix glib, add gobject, gio, gthread, gmodule, etc
[glib.git] / glib / tests / meson.build
blob9ef1b3d351e93472dabe576654cdee3b57b5d73c
1 glib_tests = [
2   'array-test',
3   'asyncqueue',
4   'base64',
5   'bitlock',
6   'bookmarkfile',
7   'bytes',
8   'cache',
9   'checksum',
10   'collate',
11   'cond',
12   'convert',
13   'dataset',
14   'date',
15   'dir',
16   'environment',
17   'error',
18   'fileutils',
19   'gdatetime',
20   'gvariant',
21   'hash',
22   'hmac',
23   'hook',
24   'hostutils',
25   'keyfile',
26   'list',
27   'logging',
28   'mainloop',
29   'mappedfile',
30   'markup',
31   'markup-parse',
32   'markup-collect',
33   'markup-escape',
34   'markup-subparser',
35   'mem-overflow',
36   'mutex',
37   'node',
38   'once',
39   'option-context',
40   'option-argv0',
41   'overflow',
42   'pattern',
43   'private',
44   'protocol',
45   'queue',
46   'rand',
47   'rec-mutex',
48   'regex',
49   'rwlock',
50   'scannerapi',
51   'search-utils',
52   'sequence',
53   'shell',
54   'slice',
55   'slist',
56   'sort',
57   'spawn-multithreaded',
58   'spawn-singlethread',
59   'strfuncs',
60   'string',
61   'testing',
62   'test-printf',
63   'thread',
64   'timeout',
65   'timer',
66   'tree',
67   'utf8-performance',
68   'utf8-pointer',
69   'utf8-validate',
70   'utf8-misc',
71   'utils',
72   'unicode',
73   'uri',
74   '1bit-mutex',
75   '642026',
78 if host_machine.system() != 'windows'
79   glib_tests += [ 'unix', 'include' ]
80 endif
82 if cc.get_id() == 'gcc'
83   glib_tests += [ 'autoptr' ]
84 endif
86 test_env = [
87   'G_TEST_SRCDIR=' + meson.current_source_dir(),
88   'G_TEST_BUILDDIR=' + meson.current_build_dir(),
91 foreach test_name : glib_tests
92   deps = [ libm, thread_dep ]
93   if test_name == 'regex'
94     deps += [ pcre ]
95   endif
96   exe = executable(test_name, '@0@.c'.format(test_name),
97       include_directories : inc_dirs,
98       c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"' ],
99       link_with : libglib,
100       dependencies : deps,
101       install : false,
102   )
103   test(test_name, exe, env : test_env)
104 endforeach
106 c_args_atomic = [ ]
107 if cc.get_id() == 'gcc'
108   c_args_atomic += [ '-Wstrict-aliasing=2' ]
109 endif
111 exe = executable('atomic', 'atomic.c',
112   include_directories : inc_dirs,
113   c_args : [ '-DHAVE_CONFIG_H=1' ] + c_args_atomic,
114   link_with : libglib,
115   dependencies : deps,
117 test('atomic', exe, env : test_env)
119 # FIXME: consolidate all of these into the array
120 exe = executable('overflow-fallback', 'overflow.c',
121   include_directories : inc_dirs,
122   c_args : [ '-DHAVE_CONFIG_H=1', '-D_GLIB_TEST_OVERFLOW_FALLBACK' ],
123   link_with : libglib,
124   dependencies : deps,
125   install : false,
127 test('overflow-fallback', exe, env : test_env)
129 exe = executable('642026-ec', '642026.c',
130   include_directories : inc_dirs,
131   c_args : [ '-DHAVE_CONFIG_H=1', '-DG_ERRORCHECK_MUTEXES' ],
132   link_with : libglib,
133   dependencies : deps,
134   install : false,
136 test('642026-ec', exe, env : test_env)
138 exe = executable('1bit-emufutex', '1bit-mutex.c',
139   include_directories : inc_dirs,
140   c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EMULATED_FUTEX' ],
141   link_with : libglib,
142   dependencies : deps,
143   install : false,
145 test('1bit-emufutex', exe, env : test_env)
147 if glib_conf.has('HAVE_EVENTFD')
148   exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
149     include_directories : inc_dirs,
150     c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EVENTFD_FALLBACK' ],
151     link_with : libglib,
152     dependencies : deps,
153     install : false,
154   )
155   test('gwakeup-fallback', exe, env : test_env)
156 endif
158 # test-spawn-echo helper binary required by the spawn tests
159 executable('test-spawn-echo', 'test-spawn-echo.c',
160            include_directories : inc_dirs,
161            c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"' ],
162            link_with : libglib,
163            dependencies : deps,
164            install : false,