5 'c_args' : cc.get_id() == 'gcc' ? ['-Wstrict-aliasing=2'] : [],
8 'skip' : cc.get_id() == 'msvc',
32 'source' : ['gwakeuptest.c', '../gwakeup.c'],
35 'gwakeup-fallback' : {
36 'skip' : not glib_conf.has('HAVE_EVENTFD'),
37 'source' : ['gwakeuptest.c', '../gwakeup.c'],
38 'c_args' : ['-DTEST_EVENTFD_FALLBACK'],
46 'skip' : host_machine.system() == 'windows',
55 'markup-collect' : {},
57 'markup-subparser' : {},
62 'option-context' : {},
65 'overflow-fallback' : {
66 'source' : 'overflow.c',
67 'c_args' : ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
78 'source' : 'refcount.c',
79 'c_args' : ['-DG_DISABLE_CHECKS'],
83 'dependencies' : [pcre],
84 'c_args' : use_pcre_static_flag ? ['-DPCRE_STATIC'] : [],
96 'spawn-multithreaded' : {},
97 'spawn-singlethread' : {},
106 'utf8-performance' : {},
108 'utf8-validate' : {},
113 'skip' : host_machine.system() == 'windows',
118 'source' : '1bit-mutex.c',
119 'c_args' : ['-DTEST_EMULATED_FUTEX'],
126 'source' : '642026.c',
127 'c_args' : ['-DG_ERRORCHECK_MUTEXES'],
132 # Not entirely random of course, but at least it changes over time
133 random_number = minor_version + meson.version().split('.').get(1).to_int()
135 test_env = environment()
136 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
137 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
138 test_env.set('G_DEBUG', 'gc-friendly')
139 test_env.set('MALLOC_CHECK_', '2')
140 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
142 test_deps = [libm, thread_dep, libglib_dep]
143 test_cargs = ['-DG_LOG_DOMAIN="GLib"']
145 foreach test_name, extra_args : glib_tests
146 # FIXME: This condition is ugly, meson should either have 'continue'
147 # keyword (https://github.com/mesonbuild/meson/issues/3601), or support
148 # mutable to dictionaries (https://github.com/mesonbuild/meson/pull/3820).
149 if not extra_args.get('skip', false)
150 source = extra_args.get('source', test_name + '.c')
151 install = installed_tests_enabled and extra_args.get('install', true)
154 test_conf = configuration_data()
155 test_conf.set('installed_tests_dir', installed_tests_execdir)
156 test_conf.set('program', test_name)
158 input: installed_tests_template,
159 output: test_name + '.test',
160 install_dir: installed_tests_metadir,
161 configuration: test_conf
165 exe = executable(test_name, source,
166 c_args : test_cargs + extra_args.get('c_args', []),
167 dependencies : test_deps + extra_args.get('dependencies', []),
168 install_dir: installed_tests_execdir,
172 suite = ['glib'] + extra_args.get('suite', [])
173 timeout = suite.contains('slow') ? 120 : 30
174 test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
178 # test-spawn-echo helper binary required by the spawn tests above
179 executable('test-spawn-echo', 'test-spawn-echo.c',
181 dependencies : test_deps,
182 install_dir: installed_tests_execdir,
183 install: installed_tests_enabled,
186 # some testing of gtester functionality
187 if not meson.is_cross_build() and host_system != 'windows'
188 xmllint = find_program('xmllint', required: false)
190 tmpsample_xml = custom_target('tmpsample.xml',
191 output : 'tmpsample.xml',
192 command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
193 '--test-arg=--gtester-selftest', gtester])
195 test('gtester-xmllint-check', xmllint,
196 args : ['--noout', tmpsample_xml],