5 'c_args' : cc.get_id() == 'gcc' ? ['-Wstrict-aliasing=2'] : [],
31 'source' : ['gwakeuptest.c', '../gwakeup.c'],
45 'markup-collect' : {},
47 'markup-subparser' : {},
52 'option-context' : {},
55 'overflow-fallback' : {
56 'source' : 'overflow.c',
57 'c_args' : ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
68 'source' : 'refcount.c',
69 'c_args' : ['-DG_DISABLE_CHECKS'],
73 'dependencies' : [pcre],
74 'c_args' : use_pcre_static_flag ? ['-DPCRE_STATIC'] : [],
86 'spawn-multithreaded' : {},
87 'spawn-singlethread' : {},
96 'utf8-performance' : {},
105 'source' : '1bit-mutex.c',
106 'c_args' : ['-DTEST_EMULATED_FUTEX'],
114 'source' : '642026.c',
115 'c_args' : ['-DG_ERRORCHECK_MUTEXES'],
120 if cc.get_id() != 'msvc'
121 glib_tests += {'autoptr' : {}}
124 if glib_conf.has('HAVE_EVENTFD')
126 'gwakeup-fallback' : {
127 'source' : ['gwakeuptest.c', '../gwakeup.c'],
128 'c_args' : ['-DTEST_EVENTFD_FALLBACK'],
134 if host_machine.system() != 'windows'
141 if installed_tests_enabled
150 install_dir : installed_tests_execdir,
152 install_subdir('bookmarks', install_dir : installed_tests_execdir)
153 install_subdir('markups', install_dir : installed_tests_execdir)
156 # Not entirely random of course, but at least it changes over time
157 random_number = minor_version + meson.version().split('.').get(1).to_int()
159 test_env = environment()
160 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
161 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
162 test_env.set('G_DEBUG', 'gc-friendly')
163 test_env.set('MALLOC_CHECK_', '2')
164 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
166 test_deps = [libm, thread_dep, libglib_dep]
167 test_cargs = ['-DG_LOG_DOMAIN="GLib"']
169 foreach test_name, extra_args : glib_tests
170 source = extra_args.get('source', test_name + '.c')
171 install = installed_tests_enabled and extra_args.get('install', true)
174 test_conf = configuration_data()
175 test_conf.set('installed_tests_dir', installed_tests_execdir)
176 test_conf.set('program', test_name)
178 input: installed_tests_template_tap,
179 output: test_name + '.test',
180 install_dir: installed_tests_metadir,
181 configuration: test_conf
185 exe = executable(test_name, source,
186 c_args : test_cargs + extra_args.get('c_args', []),
187 dependencies : test_deps + extra_args.get('dependencies', []),
188 install_dir: installed_tests_execdir,
192 suite = ['glib'] + extra_args.get('suite', [])
193 timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
194 test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
198 # test-spawn-echo helper binary required by the spawn tests above
199 executable('test-spawn-echo', 'test-spawn-echo.c',
201 dependencies : test_deps,
202 install_dir: installed_tests_execdir,
203 install: installed_tests_enabled,
206 executable('testing-helper', 'testing-helper.c',
208 dependencies : test_deps,
209 install_dir: installed_tests_execdir,
210 install: installed_tests_enabled,
213 # some testing of gtester functionality
214 if not meson.is_cross_build() and host_system != 'windows'
215 xmllint = find_program('xmllint', required: false)
217 tmpsample_xml = custom_target('tmpsample.xml',
218 output : 'tmpsample.xml',
219 command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
220 '--test-arg=--gtester-selftest', gtester])
222 test('gtester-xmllint-check', xmllint,
223 args : ['--noout', tmpsample_xml],