mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-13 21:06:17 +01:00
Meson: Group all glib tests into a single dict
This commit is contained in:
parent
5f3db543f8
commit
a84cbf1434
@ -1,94 +1,130 @@
|
|||||||
glib_tests = [
|
glib_tests = {
|
||||||
'array-test',
|
'array-test' : {},
|
||||||
'asyncqueue',
|
'asyncqueue' : {},
|
||||||
'base64',
|
'atomic' : {
|
||||||
'bitlock',
|
'c_args' : cc.get_id() == 'gcc' ? ['-Wstrict-aliasing=2'] : [],
|
||||||
'bookmarkfile',
|
},
|
||||||
'bytes',
|
'autoptr' : {
|
||||||
'cache',
|
'skip' : cc.get_id() == 'msvc',
|
||||||
'charset',
|
},
|
||||||
'checksum',
|
'base64' : {},
|
||||||
'collate',
|
'bitlock' : {},
|
||||||
'cond',
|
'bookmarkfile' : {},
|
||||||
'convert',
|
'bytes' : {},
|
||||||
'dataset',
|
'cache' : {},
|
||||||
'date',
|
'charset' : {},
|
||||||
'dir',
|
'checksum' : {},
|
||||||
'environment',
|
'collate' : {},
|
||||||
'error',
|
'cond' : {},
|
||||||
'fileutils',
|
'convert' : {},
|
||||||
'gdatetime',
|
'dataset' : {},
|
||||||
'guuid',
|
'date' : {},
|
||||||
'gvariant',
|
'dir' : {},
|
||||||
'hash',
|
'environment' : {},
|
||||||
'hmac',
|
'error' : {},
|
||||||
'hook',
|
'fileutils' : {},
|
||||||
'hostutils',
|
'gdatetime' : {},
|
||||||
'keyfile',
|
'guuid' : {},
|
||||||
'list',
|
'gvariant' : {
|
||||||
'logging',
|
'suite' : ['slow'],
|
||||||
'mainloop',
|
},
|
||||||
'mappedfile',
|
'gwakeup' : {
|
||||||
'markup',
|
'source' : ['gwakeuptest.c', '../gwakeup.c'],
|
||||||
'markup-parse',
|
},
|
||||||
'markup-collect',
|
'gwakeup-fallback' : {
|
||||||
'markup-escape',
|
'skip' : not glib_conf.has('HAVE_EVENTFD'),
|
||||||
'markup-subparser',
|
'source' : ['gwakeuptest.c', '../gwakeup.c'],
|
||||||
'mem-overflow',
|
'c_args' : ['-DTEST_EVENTFD_FALLBACK'],
|
||||||
'mutex',
|
},
|
||||||
'node',
|
'hash' : {},
|
||||||
'once',
|
'hmac' : {},
|
||||||
'option-context',
|
'hook' : {},
|
||||||
'option-argv0',
|
'hostutils' : {},
|
||||||
'overflow',
|
'include' : {
|
||||||
# overflow-fallback handled separately below
|
'skip' : host_machine.system() == 'windows',
|
||||||
'pattern',
|
},
|
||||||
'private',
|
'keyfile' : {},
|
||||||
'protocol',
|
'list' : {},
|
||||||
'queue',
|
'logging' : {},
|
||||||
'rand',
|
'mainloop' : {},
|
||||||
'rcbox',
|
'mappedfile' : {},
|
||||||
'rec-mutex',
|
'markup' : {},
|
||||||
'refcount',
|
'markup-parse' : {},
|
||||||
'refcount-macro',
|
'markup-collect' : {},
|
||||||
'refstring',
|
'markup-escape' : {},
|
||||||
'regex',
|
'markup-subparser' : {},
|
||||||
'rwlock',
|
'mem-overflow' : {},
|
||||||
'scannerapi',
|
'mutex' : {},
|
||||||
'search-utils',
|
'node' : {},
|
||||||
'sequence',
|
'once' : {},
|
||||||
'shell',
|
'option-context' : {},
|
||||||
'slice',
|
'option-argv0' : {},
|
||||||
'slist',
|
'overflow' : {},
|
||||||
'sort',
|
'overflow-fallback' : {
|
||||||
'spawn-multithreaded',
|
'source' : 'overflow.c',
|
||||||
'spawn-singlethread',
|
'c_args' : ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
|
||||||
'strfuncs',
|
},
|
||||||
'string',
|
'pattern' : {},
|
||||||
'testing',
|
'private' : {},
|
||||||
'test-printf',
|
'protocol' : {},
|
||||||
'thread',
|
'queue' : {},
|
||||||
'timeout',
|
'rand' : {},
|
||||||
'timer',
|
'rcbox' : {},
|
||||||
'tree',
|
'rec-mutex' : {},
|
||||||
'utf8-performance',
|
'refcount' : {},
|
||||||
'utf8-pointer',
|
'refcount-macro' : {
|
||||||
'utf8-validate',
|
'source' : 'refcount.c',
|
||||||
'utf8-misc',
|
'c_args' : ['-DG_DISABLE_CHECKS'],
|
||||||
'utils',
|
},
|
||||||
'unicode',
|
'refstring' : {},
|
||||||
'uri',
|
'regex' : {
|
||||||
'1bit-mutex',
|
'dependencies' : [pcre],
|
||||||
'642026',
|
'c_args' : use_pcre_static_flag ? ['-DPCRE_STATIC'] : [],
|
||||||
]
|
},
|
||||||
|
'rwlock' : {},
|
||||||
if host_machine.system() != 'windows'
|
'scannerapi' : {},
|
||||||
glib_tests += [ 'unix', 'include' ]
|
'search-utils' : {},
|
||||||
endif
|
'sequence' : {
|
||||||
|
'suite' : ['slow'],
|
||||||
if cc.get_id() != 'msvc'
|
},
|
||||||
glib_tests += [ 'autoptr' ]
|
'shell' : {},
|
||||||
endif
|
'slice' : {},
|
||||||
|
'slist' : {},
|
||||||
|
'sort' : {},
|
||||||
|
'spawn-multithreaded' : {},
|
||||||
|
'spawn-singlethread' : {},
|
||||||
|
'strfuncs' : {},
|
||||||
|
'string' : {},
|
||||||
|
'testing' : {},
|
||||||
|
'test-printf' : {},
|
||||||
|
'thread' : {},
|
||||||
|
'timeout' : {},
|
||||||
|
'timer' : {},
|
||||||
|
'tree' : {},
|
||||||
|
'utf8-performance' : {},
|
||||||
|
'utf8-pointer' : {},
|
||||||
|
'utf8-validate' : {},
|
||||||
|
'utf8-misc' : {},
|
||||||
|
'utils' : {},
|
||||||
|
'unicode' : {},
|
||||||
|
'unix' : {
|
||||||
|
'skip' : host_machine.system() == 'windows',
|
||||||
|
},
|
||||||
|
'uri' : {},
|
||||||
|
'1bit-mutex' : {},
|
||||||
|
'1bit-emufutex' : {
|
||||||
|
'source' : '1bit-mutex.c',
|
||||||
|
'c_args' : ['-DTEST_EMULATED_FUTEX'],
|
||||||
|
},
|
||||||
|
'642026' : {
|
||||||
|
'suite' : ['slow'],
|
||||||
|
},
|
||||||
|
'642026-ec' : {
|
||||||
|
'source' : '642026.c',
|
||||||
|
'c_args' : ['-DG_ERRORCHECK_MUTEXES'],
|
||||||
|
'suite' : ['slow'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
# Not entirely random of course, but at least it changes over time
|
# Not entirely random of course, but at least it changes over time
|
||||||
random_number = minor_version + meson.version().split('.').get(1).to_int()
|
random_number = minor_version + meson.version().split('.').get(1).to_int()
|
||||||
@ -100,99 +136,32 @@ test_env.set('G_DEBUG', 'gc-friendly')
|
|||||||
test_env.set('MALLOC_CHECK_', '2')
|
test_env.set('MALLOC_CHECK_', '2')
|
||||||
test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
|
test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
|
||||||
|
|
||||||
|
test_deps = [libm, thread_dep, libglib_dep]
|
||||||
test_cargs = ['-DG_LOG_DOMAIN="GLib"']
|
test_cargs = ['-DG_LOG_DOMAIN="GLib"']
|
||||||
|
|
||||||
# Tests that consistently time out on the CI infrastructure
|
foreach test_name, extra_args : glib_tests
|
||||||
slow_tests = [
|
# FIXME: This condition is ugly, meson should either have 'continue'
|
||||||
'gvariant',
|
# keyword (https://github.com/mesonbuild/meson/issues/3601), or support
|
||||||
'sequence',
|
# mutable to dictionaries (https://github.com/mesonbuild/meson/pull/3820).
|
||||||
'642026',
|
if not extra_args.get('skip', false)
|
||||||
]
|
source = extra_args.get('source', test_name + '.c')
|
||||||
|
|
||||||
foreach test_name : glib_tests
|
exe = executable(test_name, source,
|
||||||
deps = [libm, thread_dep, libglib_dep]
|
c_args : test_cargs + extra_args.get('c_args', []),
|
||||||
source = test_name + '.c'
|
dependencies : test_deps + extra_args.get('dependencies', []),
|
||||||
c_args = test_cargs + ['-DPCRE_STATIC']
|
install: false,
|
||||||
if test_name == 'regex'
|
)
|
||||||
deps += [pcre]
|
|
||||||
endif
|
suite = ['glib'] + extra_args.get('suite', [])
|
||||||
if test_name == 'gdatetime'
|
timeout = suite.contains('slow') ? 120 : 30
|
||||||
deps += [libintl]
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
endif
|
|
||||||
# We build the refcount test twice: one to test the function-based API,
|
|
||||||
# and the other to test the macro-based API that is used when disabling
|
|
||||||
# checks
|
|
||||||
if test_name == 'refcount-macro'
|
|
||||||
source = 'refcount.c'
|
|
||||||
c_args += ['-DG_DISABLE_CHECKS']
|
|
||||||
endif
|
|
||||||
exe = executable(test_name, source,
|
|
||||||
c_args : c_args,
|
|
||||||
dependencies : deps,
|
|
||||||
install : false,
|
|
||||||
)
|
|
||||||
# These tests may take more than 30 seconds to run on the CI infrastructure
|
|
||||||
if slow_tests.contains(test_name)
|
|
||||||
test(test_name, exe, env : test_env, timeout : 120, suite : ['glib', 'slow'])
|
|
||||||
else
|
|
||||||
test(test_name, exe, env : test_env, suite : ['glib'])
|
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
c_args_atomic = []
|
|
||||||
if cc.get_id() == 'gcc'
|
|
||||||
c_args_atomic += ['-Wstrict-aliasing=2']
|
|
||||||
endif
|
|
||||||
|
|
||||||
deps = [libm, thread_dep, libglib_dep]
|
|
||||||
|
|
||||||
exe = executable('atomic', 'atomic.c',
|
|
||||||
c_args : test_cargs + c_args_atomic,
|
|
||||||
dependencies : deps,
|
|
||||||
)
|
|
||||||
test('atomic', exe, env : test_env, suite : ['glib'])
|
|
||||||
|
|
||||||
# FIXME: consolidate all of these into the array
|
|
||||||
exe = executable('overflow-fallback', 'overflow.c',
|
|
||||||
c_args : test_cargs + ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
|
|
||||||
dependencies : deps,
|
|
||||||
install : false,
|
|
||||||
)
|
|
||||||
test('overflow-fallback', exe, env : test_env, suite : ['glib'])
|
|
||||||
|
|
||||||
exe = executable('642026-ec', '642026.c',
|
|
||||||
c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'],
|
|
||||||
dependencies : deps,
|
|
||||||
install : false,
|
|
||||||
)
|
|
||||||
test('642026-ec', exe, env : test_env, timeout : 90, suite : ['glib', 'slow'])
|
|
||||||
|
|
||||||
exe = executable('1bit-emufutex', '1bit-mutex.c',
|
|
||||||
c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'],
|
|
||||||
dependencies : deps,
|
|
||||||
install : false,
|
|
||||||
)
|
|
||||||
test('1bit-emufutex', exe, env : test_env, suite : ['glib'])
|
|
||||||
|
|
||||||
exe = executable('gwakeup', 'gwakeuptest.c', '../gwakeup.c',
|
|
||||||
c_args : test_cargs,
|
|
||||||
dependencies : deps,
|
|
||||||
install : false)
|
|
||||||
test('gwakeup', exe, env : test_env, suite : ['glib'])
|
|
||||||
|
|
||||||
if glib_conf.has('HAVE_EVENTFD')
|
|
||||||
exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
|
|
||||||
c_args : test_cargs + ['-DTEST_EVENTFD_FALLBACK'],
|
|
||||||
dependencies : deps,
|
|
||||||
install : false,
|
|
||||||
)
|
|
||||||
test('gwakeup-fallback', exe, env : test_env, suite : ['glib'])
|
|
||||||
endif
|
|
||||||
|
|
||||||
# test-spawn-echo helper binary required by the spawn tests above
|
# test-spawn-echo helper binary required by the spawn tests above
|
||||||
executable('test-spawn-echo', 'test-spawn-echo.c',
|
executable('test-spawn-echo', 'test-spawn-echo.c',
|
||||||
c_args : test_cargs,
|
c_args : test_cargs,
|
||||||
dependencies : deps,
|
dependencies : test_deps,
|
||||||
install : false,
|
install : false,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user