Add reference counting types
[glib.git] / glib / tests / meson.build
blobe0619c4759aaf251201514bb0c1f6feac6f37fe0
1 glib_tests = [
2   'array-test',
3   'asyncqueue',
4   'base64',
5   'bitlock',
6   'bookmarkfile',
7   'bytes',
8   'cache',
9   'charset',
10   'checksum',
11   'collate',
12   'cond',
13   'convert',
14   'dataset',
15   'date',
16   'dir',
17   'environment',
18   'error',
19   'fileutils',
20   'gdatetime',
21   'gvariant',
22   'hash',
23   'hmac',
24   'hook',
25   'hostutils',
26   'keyfile',
27   'list',
28   'logging',
29   'mainloop',
30   'mappedfile',
31   'markup',
32   'markup-parse',
33   'markup-collect',
34   'markup-escape',
35   'markup-subparser',
36   'mem-overflow',
37   'mutex',
38   'node',
39   'once',
40   'option-context',
41   'option-argv0',
42   'overflow',
43   # overflow-fallback handled separately below
44   'pattern',
45   'private',
46   'protocol',
47   'queue',
48   'rand',
49   'rec-mutex',
50   'regex',
51   'rwlock',
52   'scannerapi',
53   'search-utils',
54   'sequence',
55   'shell',
56   'slice',
57   'slist',
58   'sort',
59   'spawn-multithreaded',
60   'spawn-singlethread',
61   'strfuncs',
62   'string',
63   'testing',
64   'test-printf',
65   'thread',
66   'timeout',
67   'timer',
68   'tree',
69   'utf8-performance',
70   'utf8-pointer',
71   'utf8-validate',
72   'utf8-misc',
73   'utils',
74   'unicode',
75   'uri',
76   '1bit-mutex',
77   '642026',
80 if host_machine.system() != 'windows'
81   glib_tests += [ 'unix', 'include' ]
82 endif
84 if cc.get_id() != 'msvc'
85   glib_tests += [ 'autoptr' ]
86 endif
88 # FIXME: use new environment() object
89 # Not entirely random of course, but at least it changes over time
90 random_number = minor_version + meson.version().split('.').get(1).to_int()
92 test_env = [
93   'G_TEST_SRCDIR=' + meson.current_source_dir(),
94   'G_TEST_BUILDDIR=' + meson.current_build_dir(),
95   'G_DEBUG=gc-friendly',
96   'MALLOC_CHECK_=2',
97   'MALLOC_PERTURB_=@0@'.format(random_number % 256),
100 test_cargs = ['-DG_LOG_DOMAIN="GLib"']
102 # Tests that consistently time out on the CI infrastructure
103 slow_tests = [
104   'gvariant',
105   'sequence',
106   '642026',
109 foreach test_name : glib_tests
110   deps = [libm, thread_dep, libglib_dep]
111   if test_name == 'regex'
112     deps += [pcre]
113   endif
114   if test_name == 'gdatetime'
115     deps += [libintl]
116   endif
117   exe = executable(test_name, '@0@.c'.format(test_name),
118     c_args : ['-DPCRE_STATIC'] + test_cargs,
119     dependencies : deps,
120     install : false,
121   )
122   # These tests may take more than 30 seconds to run on the CI infrastructure
123   if slow_tests.contains(test_name)
124     test(test_name, exe, env : test_env, timeout : 120, suite : ['glib', 'slow'])
125   else
126     test(test_name, exe, env : test_env, suite : ['glib'])
127   endif
128 endforeach
130 c_args_atomic = []
131 if cc.get_id() == 'gcc'
132   c_args_atomic += ['-Wstrict-aliasing=2']
133 endif
135 deps = [libm, thread_dep, libglib_dep]
137 exe = executable('atomic', 'atomic.c',
138   c_args : test_cargs + c_args_atomic,
139   dependencies : deps,
141 test('atomic', exe, env : test_env, suite : ['glib'])
143 # FIXME: consolidate all of these into the array
144 exe = executable('overflow-fallback', 'overflow.c',
145   c_args : test_cargs + ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
146   dependencies : deps,
147   install : false,
149 test('overflow-fallback', exe, env : test_env, suite : ['glib'])
151 exe = executable('642026-ec', '642026.c',
152   c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'],
153   dependencies : deps,
154   install : false,
156 test('642026-ec', exe, env : test_env, timeout : 90, suite : ['glib', 'slow'])
158 exe = executable('1bit-emufutex', '1bit-mutex.c',
159   c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'],
160   dependencies : deps,
161   install : false,
163 test('1bit-emufutex', exe, env : test_env, suite : ['glib'])
165 exe = executable('gwakeup', 'gwakeuptest.c', '../gwakeup.c',
166   c_args : test_cargs,
167   dependencies : deps,
168   install : false)
169 test('gwakeup', exe, env : test_env, suite : ['glib'])
171 if glib_conf.has('HAVE_EVENTFD')
172   exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
173     c_args : test_cargs + ['-DTEST_EVENTFD_FALLBACK'],
174     dependencies : deps,
175     install : false,
176   )
177   test('gwakeup-fallback', exe, env : test_env, suite : ['glib'])
178 endif
180 # test-spawn-echo helper binary required by the spawn tests above
181 executable('test-spawn-echo', 'test-spawn-echo.c',
182   c_args : test_cargs,
183   dependencies : deps,
184   install : false,
187 # some testing of gtester functionality
188 if not meson.is_cross_build() and host_system != 'windows'
189   xmllint = find_program('xmllint', required: false)
190   if xmllint.found()
191     tmpsample_xml = custom_target('tmpsample.xml',
192       output : 'tmpsample.xml',
193       build_by_default : true, # hack around meson bug, see PR #1335
194       command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
195                   '--test-arg=--gtester-selftest', gtester])
197     test('gtester-xmllint-check', xmllint,
198       args : ['--noout', tmpsample_xml],
199       env : test_env,
200       suite : ['glib'],
201     )
202   endif
203 endif