genmarshal Only wrap body prototypes in C++ guards
[glib.git] / glib / tests / meson.build
bloba78d9c05741d6ba6ce9c2caaaa2fb1651e64feeb
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   # overflow-fallback handled separately below
43   'pattern',
44   'private',
45   'protocol',
46   'queue',
47   'rand',
48   'rec-mutex',
49   'regex',
50   'rwlock',
51   'scannerapi',
52   'search-utils',
53   'sequence',
54   'shell',
55   'slice',
56   'slist',
57   'sort',
58   'spawn-multithreaded',
59   'spawn-singlethread',
60   'strfuncs',
61   'string',
62   'testing',
63   'test-printf',
64   'thread',
65   'timeout',
66   'timer',
67   'tree',
68   'utf8-performance',
69   'utf8-pointer',
70   'utf8-validate',
71   'utf8-misc',
72   'utils',
73   'unicode',
74   'uri',
75   '1bit-mutex',
76   '642026',
79 if host_machine.system() != 'windows'
80   glib_tests += [ 'unix', 'include' ]
81 endif
83 if cc.get_id() != 'msvc'
84   glib_tests += [ 'autoptr' ]
85 endif
87 # FIXME: use new environment() object
88 # Not entirely random of course, but at least it changes over time
89 random_number = minor_version + meson.version().split('.').get(1).to_int()
91 test_env = [
92   'G_TEST_SRCDIR=' + meson.current_source_dir(),
93   'G_TEST_BUILDDIR=' + meson.current_build_dir(),
94   'G_DEBUG=gc-friendly',
95   'MALLOC_CHECK_=2',
96   'MALLOC_PERTURB_=@0@'.format(random_number % 256),
99 test_cargs = ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"']
101 foreach test_name : glib_tests
102   deps = [libm, thread_dep, libglib_dep]
103   if test_name == 'regex'
104     deps += [pcre]
105   endif
106   exe = executable(test_name, '@0@.c'.format(test_name),
107     c_args : ['-DPCRE_STATIC'] + test_cargs,
108     dependencies : deps,
109     install : false,
110   )
111   test(test_name, exe, env : test_env)
112 endforeach
114 c_args_atomic = []
115 if cc.get_id() == 'gcc'
116   c_args_atomic += ['-Wstrict-aliasing=2']
117 endif
119 deps = [libm, thread_dep, libglib_dep]
121 exe = executable('atomic', 'atomic.c',
122   c_args : test_cargs + c_args_atomic,
123   dependencies : deps,
125 test('atomic', exe, env : test_env)
127 # FIXME: consolidate all of these into the array
128 exe = executable('overflow-fallback', 'overflow.c',
129   c_args : test_cargs + ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
130   dependencies : deps,
131   install : false,
133 test('overflow-fallback', exe, env : test_env)
135 exe = executable('642026-ec', '642026.c',
136   c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'],
137   dependencies : deps,
138   install : false,
140 test('642026-ec', exe, env : test_env)
142 exe = executable('1bit-emufutex', '1bit-mutex.c',
143   c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'],
144   dependencies : deps,
145   install : false,
147 test('1bit-emufutex', exe, env : test_env)
149 exe = executable('gwakeup', 'gwakeuptest.c', '../gwakeup.c',
150   c_args : test_cargs,
151   dependencies : deps,
152   install : false)
153 test('gwakeup', exe, env : test_env)
155 if glib_conf.has('HAVE_EVENTFD')
156   exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
157     c_args : test_cargs + ['-DTEST_EVENTFD_FALLBACK'],
158     dependencies : deps,
159     install : false,
160   )
161   test('gwakeup-fallback', exe, env : test_env)
162 endif
164 # test-spawn-echo helper binary required by the spawn tests above
165 executable('test-spawn-echo', 'test-spawn-echo.c',
166   c_args : test_cargs,
167   dependencies : deps,
168   install : false,
171 # some testing of gtester functionality
172 if not meson.is_cross_build() and host_system != 'windows'
173   xmllint = find_program('xmllint', required: false)
174   if xmllint.found()
175     tmpsample_xml = custom_target('tmpsample.xml',
176       output : 'tmpsample.xml',
177       build_by_default : true, # hack around meson bug, see PR #1335
178       command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
179                   '--test-arg=--gtester-selftest', gtester])
181     test('gtester-xmllint-check', xmllint,
182       args : ['--noout', tmpsample_xml],
183       env : test_env)
184   endif
185 endif