build: Restructure the tests to use dictionaries

Instead of an array of arrays, let's use an array of dictionaries; it's
easier to add optional keys without requiring to remember where to put
empty arrays.
This commit is contained in:
Emmanuele Bassi 2020-07-10 16:32:15 +01:00
parent ad04da84c9
commit 0578422612

View File

@ -7,76 +7,119 @@ if cc.get_id() != 'msvc'
gtk_tests_export_dynamic_ldflag = ['-Wl,--export-dynamic'] gtk_tests_export_dynamic_ldflag = ['-Wl,--export-dynamic']
endif endif
# Available keys for each test:
#
# - 'name': the test name; used for the test and to determine the base
# source file for the test (MANDATORY)
# - 'sources': (array): additional sources needed by the test
# - 'c_args': (array): additional compiler arguments
# - 'link_args': (array): additional linker arguments
# - 'suites': (array): additional test suites
tests = [ tests = [
['accel'], { 'name': 'accel' },
['accessible'], { 'name': 'accessible' },
['action'], { 'name': 'action' },
['adjustment'], { 'name': 'adjustment' },
['bitset'], { 'name': 'bitset' },
['bitmask', ['../../gtk/gtkallocatedbitmask.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], {
['builder', [], [], gtk_tests_export_dynamic_ldflag], 'name': 'bitmask',
['builderparser'], 'sources': ['../../gtk/gtkallocatedbitmask.c'],
['cellarea'], 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'],
['check-icon-names'], },
['constraint-solver', [ {
'name': 'builder',
'link_args': gtk_tests_export_dynamic_ldflag,
},
{ 'name': 'builderparser' },
{ 'name': 'cellarea' },
{ 'name': 'check-icon-names' },
{
'name': 'constraint-solver',
'sources': [
'../../gtk/gtkconstraintsolver.c', '../../gtk/gtkconstraintsolver.c',
'../../gtk/gtkconstraintexpression.c', '../../gtk/gtkconstraintexpression.c',
], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'] ],
], 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'],
['cssprovider'], },
['rbtree-crash', ['../../gtk/gtkrbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], { 'name': 'cssprovider' },
['defaultvalue'], {
['entry'], 'name': 'rbtree-crash',
['expression'], 'sources': ['../../gtk/gtkrbtree.c'],
['filter'], 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'],
['filterlistmodel'], },
['filterlistmodel-exhaustive', [], [], [], ['slow']], { 'name': 'defaultvalue' },
['flattenlistmodel'], { 'name': 'entry' },
['floating'], { 'name': 'expression' },
['flowbox'], { 'name': 'filter' },
#['gestures'], { 'name': 'filterlistmodel' },
['grid'], {
['grid-layout'], 'name': 'filterlistmodel-exhaustive',
['icontheme'], 'suites': ['slow'],
['listbox'], },
['main'], { 'name': 'flattenlistmodel' },
['maplistmodel'], { 'name': 'floating' },
['multiselection'], { 'name': 'flowbox' },
['notify'], #{ 'name': 'gestures' },
['no-gtk-init'], { 'name': 'grid' },
['object'], { 'name': 'grid-layout' },
['objects-finalize'], { 'name': 'icontheme' },
['papersize'], { 'name': 'listbox' },
#['popover'], { 'name': 'main' },
['propertylookuplistmodel', ['../../gtk/gtkpropertylookuplistmodel.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], { 'name': 'maplistmodel' },
['rbtree', ['../../gtk/gtktreerbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], { 'name': 'multiselection' },
['recentmanager'], { 'name': 'notify' },
['regression-tests'], { 'name': 'no-gtk-init' },
['scrolledwindow'], { 'name': 'object' },
['searchbar'], { 'name': 'objects-finalize' },
['shortcuts'], { 'name': 'papersize' },
['singleselection'], #{ 'name': 'popover' },
['slicelistmodel'], {
['sorter'], 'name': 'propertylookuplistmodel',
['sortlistmodel'], 'sources': ['../../gtk/gtkpropertylookuplistmodel.c'],
['spinbutton'], 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'],
['stringlist'], },
['templates'], {
['textbuffer'], 'name': 'rbtree',
['textiter'], 'sources': ['../../gtk/gtktreerbtree.c'],
['theme-validate'], 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'],
['tooltips'], },
['treelistmodel'], { 'name': 'recentmanager' },
['treemodel', ['treemodel.c', 'liststore.c', 'treestore.c', 'filtermodel.c', { 'name': 'regression-tests' },
'modelrefcount.c', 'sortmodel.c', 'gtktreemodelrefcount.c']], { 'name': 'scrolledwindow' },
['treepath'], { 'name': 'searchbar' },
['treesorter'], { 'name': 'shortcuts' },
['treeview'], { 'name': 'singleselection' },
['typename'], { 'name': 'slicelistmodel' },
['displayclose'], { 'name': 'sorter' },
['revealer-size'], { 'name': 'sortlistmodel' },
['widgetorder'], { 'name': 'spinbutton' },
['widget-refcount'], { 'name': 'stringlist' },
{ 'name': 'templates' },
{ 'name': 'textbuffer' },
{ 'name': 'textiter' },
{ 'name': 'theme-validate' },
{ 'name': 'tooltips' },
{ 'name': 'treelistmodel' },
{
'name': 'treemodel',
'sources': [
'treemodel.c',
'liststore.c',
'treestore.c',
'filtermodel.c',
'modelrefcount.c',
'sortmodel.c',
'gtktreemodelrefcount.c',
],
},
{ 'name': 'treepath' },
{ 'name': 'treesorter' },
{ 'name': 'treeview' },
{ 'name': 'typename' },
{ 'name': 'displayclose' },
{ 'name': 'revealer-size' },
{ 'name': 'widgetorder' },
{ 'name': 'widget-refcount' },
] ]
# Tests that are expected to fail # Tests that are expected to fail
@ -103,11 +146,11 @@ foreach flag: common_cflags
endforeach endforeach
foreach t : tests foreach t : tests
test_name = t.get(0) test_name = t.get('name')
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, []) test_srcs = ['@0@.c'.format(test_name)] + t.get('sources', [])
test_extra_cargs = t.get(2, []) test_extra_cargs = t.get('c_args', [])
test_extra_ldflags = t.get(3, []) test_extra_ldflags = t.get('link_args', [])
test_extra_suites = t.get(4, []) test_extra_suites = t.get('suites', [])
test_timeout = 60 test_timeout = 60
test_exe = executable(test_name, test_srcs, test_exe = executable(test_name, test_srcs,