44 # overflow-fallback handled separately below
64 'spawn-multithreaded',
85 if host_machine.system() != 'windows'
86 glib_tests += [ 'unix', 'include' ]
89 if cc.get_id() != 'msvc'
90 glib_tests += [ 'autoptr' ]
93 # Not entirely random of course, but at least it changes over time
94 random_number = minor_version + meson.version().split('.').get(1).to_int()
96 test_env = environment()
97 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
98 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
99 test_env.set('G_DEBUG', 'gc-friendly')
100 test_env.set('MALLOC_CHECK_', '2')
101 test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
103 test_cargs = ['-DG_LOG_DOMAIN="GLib"']
105 # Tests that consistently time out on the CI infrastructure
112 foreach test_name : glib_tests
113 deps = [libm, thread_dep, libglib_dep]
114 source = test_name + '.c'
115 c_args = test_cargs + ['-DPCRE_STATIC']
116 if test_name == 'regex'
119 if test_name == 'gdatetime'
122 # We build the refcount test twice: one to test the function-based API,
123 # and the other to test the macro-based API that is used when disabling
125 if test_name == 'refcount-macro'
126 source = 'refcount.c'
127 c_args += ['-DG_DISABLE_CHECKS']
129 exe = executable(test_name, source,
134 # These tests may take more than 30 seconds to run on the CI infrastructure
135 if slow_tests.contains(test_name)
136 test(test_name, exe, env : test_env, timeout : 120, suite : ['glib', 'slow'])
138 test(test_name, exe, env : test_env, suite : ['glib'])
143 if cc.get_id() == 'gcc'
144 c_args_atomic += ['-Wstrict-aliasing=2']
147 deps = [libm, thread_dep, libglib_dep]
149 exe = executable('atomic', 'atomic.c',
150 c_args : test_cargs + c_args_atomic,
153 test('atomic', exe, env : test_env, suite : ['glib'])
155 # FIXME: consolidate all of these into the array
156 exe = executable('overflow-fallback', 'overflow.c',
157 c_args : test_cargs + ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
161 test('overflow-fallback', exe, env : test_env, suite : ['glib'])
163 exe = executable('642026-ec', '642026.c',
164 c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'],
168 test('642026-ec', exe, env : test_env, timeout : 90, suite : ['glib', 'slow'])
170 exe = executable('1bit-emufutex', '1bit-mutex.c',
171 c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'],
175 test('1bit-emufutex', exe, env : test_env, suite : ['glib'])
177 exe = executable('gwakeup', 'gwakeuptest.c', '../gwakeup.c',
181 test('gwakeup', exe, env : test_env, suite : ['glib'])
183 if glib_conf.has('HAVE_EVENTFD')
184 exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
185 c_args : test_cargs + ['-DTEST_EVENTFD_FALLBACK'],
189 test('gwakeup-fallback', exe, env : test_env, suite : ['glib'])
192 # test-spawn-echo helper binary required by the spawn tests above
193 executable('test-spawn-echo', 'test-spawn-echo.c',
199 # some testing of gtester functionality
200 if not meson.is_cross_build() and host_system != 'windows'
201 xmllint = find_program('xmllint', required: false)
203 tmpsample_xml = custom_target('tmpsample.xml',
204 output : 'tmpsample.xml',
205 command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
206 '--test-arg=--gtester-selftest', gtester])
208 test('gtester-xmllint-check', xmllint,
209 args : ['--noout', tmpsample_xml],