5 'c_args' : cc.get_id() == 'gcc' ? ['-Wstrict-aliasing=2'] : [],
8 'skip' : cc.get_id() == 'msvc',
32 'source' : ['gwakeuptest.c', '../gwakeup.c'],
34 'gwakeup-fallback' : {
35 'skip' : not glib_conf.has('HAVE_EVENTFD'),
36 'source' : ['gwakeuptest.c', '../gwakeup.c'],
37 'c_args' : ['-DTEST_EVENTFD_FALLBACK'],
44 'skip' : host_machine.system() == 'windows',
53 'markup-collect' : {},
55 'markup-subparser' : {},
60 'option-context' : {},
63 'overflow-fallback' : {
64 'source' : 'overflow.c',
65 'c_args' : ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
76 'source' : 'refcount.c',
77 'c_args' : ['-DG_DISABLE_CHECKS'],
81 'dependencies' : [pcre],
82 'c_args' : use_pcre_static_flag ? ['-DPCRE_STATIC'] : [],
94 'spawn-multithreaded' : {},
95 'spawn-singlethread' : {},
104 'utf8-performance' : {},
106 'utf8-validate' : {},
111 'skip' : host_machine.system() == 'windows',
116 'source' : '1bit-mutex.c',
117 'c_args' : ['-DTEST_EMULATED_FUTEX'],
123 'source' : '642026.c',
124 'c_args' : ['-DG_ERRORCHECK_MUTEXES'],
129 # Not entirely random of course, but at least it changes over time
130 random_number = minor_version + meson.version().split('.').get(1).to_int()
132 test_env = environment()
133 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
134 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
135 test_env.set('G_DEBUG', 'gc-friendly')
136 test_env.set('MALLOC_CHECK_', '2')
137 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
139 test_deps = [libm, thread_dep, libglib_dep]
140 test_cargs = ['-DG_LOG_DOMAIN="GLib"']
142 foreach test_name, extra_args : glib_tests
143 # FIXME: This condition is ugly, meson should either have 'continue'
144 # keyword (https://github.com/mesonbuild/meson/issues/3601), or support
145 # mutable to dictionaries (https://github.com/mesonbuild/meson/pull/3820).
146 if not extra_args.get('skip', false)
147 source = extra_args.get('source', test_name + '.c')
149 exe = executable(test_name, source,
150 c_args : test_cargs + extra_args.get('c_args', []),
151 dependencies : test_deps + extra_args.get('dependencies', []),
155 suite = ['glib'] + extra_args.get('suite', [])
156 timeout = suite.contains('slow') ? 120 : 30
157 test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
161 # test-spawn-echo helper binary required by the spawn tests above
162 executable('test-spawn-echo', 'test-spawn-echo.c',
164 dependencies : test_deps,
168 # some testing of gtester functionality
169 if not meson.is_cross_build() and host_system != 'windows'
170 xmllint = find_program('xmllint', required: false)
172 tmpsample_xml = custom_target('tmpsample.xml',
173 output : 'tmpsample.xml',
174 command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
175 '--test-arg=--gtester-selftest', gtester])
177 test('gtester-xmllint-check', xmllint,
178 args : ['--noout', tmpsample_xml],