From 057842261237d27549b5f80f757d8873b0b0b09e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 10 Jul 2020 16:32:15 +0100 Subject: [PATCH] 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. --- testsuite/gtk/meson.build | 187 +++++++++++++++++++++++--------------- 1 file changed, 115 insertions(+), 72 deletions(-) diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index fb6c387fbf..8f1828aa0c 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -7,76 +7,119 @@ if cc.get_id() != 'msvc' gtk_tests_export_dynamic_ldflag = ['-Wl,--export-dynamic'] 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 = [ - ['accel'], - ['accessible'], - ['action'], - ['adjustment'], - ['bitset'], - ['bitmask', ['../../gtk/gtkallocatedbitmask.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], - ['builder', [], [], gtk_tests_export_dynamic_ldflag], - ['builderparser'], - ['cellarea'], - ['check-icon-names'], - ['constraint-solver', [ + { 'name': 'accel' }, + { 'name': 'accessible' }, + { 'name': 'action' }, + { 'name': 'adjustment' }, + { 'name': 'bitset' }, + { + 'name': 'bitmask', + 'sources': ['../../gtk/gtkallocatedbitmask.c'], + 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'], + }, + { + '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/gtkconstraintexpression.c', - ], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'] - ], - ['cssprovider'], - ['rbtree-crash', ['../../gtk/gtkrbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], - ['defaultvalue'], - ['entry'], - ['expression'], - ['filter'], - ['filterlistmodel'], - ['filterlistmodel-exhaustive', [], [], [], ['slow']], - ['flattenlistmodel'], - ['floating'], - ['flowbox'], - #['gestures'], - ['grid'], - ['grid-layout'], - ['icontheme'], - ['listbox'], - ['main'], - ['maplistmodel'], - ['multiselection'], - ['notify'], - ['no-gtk-init'], - ['object'], - ['objects-finalize'], - ['papersize'], - #['popover'], - ['propertylookuplistmodel', ['../../gtk/gtkpropertylookuplistmodel.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], - ['rbtree', ['../../gtk/gtktreerbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']], - ['recentmanager'], - ['regression-tests'], - ['scrolledwindow'], - ['searchbar'], - ['shortcuts'], - ['singleselection'], - ['slicelistmodel'], - ['sorter'], - ['sortlistmodel'], - ['spinbutton'], - ['stringlist'], - ['templates'], - ['textbuffer'], - ['textiter'], - ['theme-validate'], - ['tooltips'], - ['treelistmodel'], - ['treemodel', ['treemodel.c', 'liststore.c', 'treestore.c', 'filtermodel.c', - 'modelrefcount.c', 'sortmodel.c', 'gtktreemodelrefcount.c']], - ['treepath'], - ['treesorter'], - ['treeview'], - ['typename'], - ['displayclose'], - ['revealer-size'], - ['widgetorder'], - ['widget-refcount'], + ], + 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'], + }, + { 'name': 'cssprovider' }, + { + 'name': 'rbtree-crash', + 'sources': ['../../gtk/gtkrbtree.c'], + 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'], + }, + { 'name': 'defaultvalue' }, + { 'name': 'entry' }, + { 'name': 'expression' }, + { 'name': 'filter' }, + { 'name': 'filterlistmodel' }, + { + 'name': 'filterlistmodel-exhaustive', + 'suites': ['slow'], + }, + { 'name': 'flattenlistmodel' }, + { 'name': 'floating' }, + { 'name': 'flowbox' }, + #{ 'name': 'gestures' }, + { 'name': 'grid' }, + { 'name': 'grid-layout' }, + { 'name': 'icontheme' }, + { 'name': 'listbox' }, + { 'name': 'main' }, + { 'name': 'maplistmodel' }, + { 'name': 'multiselection' }, + { 'name': 'notify' }, + { 'name': 'no-gtk-init' }, + { 'name': 'object' }, + { 'name': 'objects-finalize' }, + { 'name': 'papersize' }, + #{ 'name': 'popover' }, + { + 'name': 'propertylookuplistmodel', + 'sources': ['../../gtk/gtkpropertylookuplistmodel.c'], + 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'], + }, + { + 'name': 'rbtree', + 'sources': ['../../gtk/gtktreerbtree.c'], + 'c_args': ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG'], + }, + { 'name': 'recentmanager' }, + { 'name': 'regression-tests' }, + { 'name': 'scrolledwindow' }, + { 'name': 'searchbar' }, + { 'name': 'shortcuts' }, + { 'name': 'singleselection' }, + { 'name': 'slicelistmodel' }, + { 'name': 'sorter' }, + { 'name': 'sortlistmodel' }, + { 'name': 'spinbutton' }, + { '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 @@ -103,11 +146,11 @@ foreach flag: common_cflags endforeach foreach t : tests - test_name = t.get(0) - test_srcs = ['@0@.c'.format(test_name)] + t.get(1, []) - test_extra_cargs = t.get(2, []) - test_extra_ldflags = t.get(3, []) - test_extra_suites = t.get(4, []) + test_name = t.get('name') + test_srcs = ['@0@.c'.format(test_name)] + t.get('sources', []) + test_extra_cargs = t.get('c_args', []) + test_extra_ldflags = t.get('link_args', []) + test_extra_suites = t.get('suites', []) test_timeout = 60 test_exe = executable(test_name, test_srcs,