tests: Centralize our test setup a bit

Put all of the constant environment into the
toplevel meson.build file, to reduce repetition
and copy-paste errors.
This commit is contained in:
Matthias Clasen 2020-05-15 12:57:49 -04:00
parent ff4552c842
commit 509db01319
12 changed files with 49 additions and 113 deletions

View File

@ -54,14 +54,8 @@ foreach t: a11y_state_tests
args: [ '--tap', '-k', ui_path ], args: [ '--tap', '-k', ui_path ],
protocol: 'tap', protocol: 'tap',
env: [ env: [
'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
], ],
suite: 'a11y', suite: 'a11y',
) )
@ -89,13 +83,9 @@ foreach t: a11y_tests
args: [ '--tap', '-k', ], args: [ '--tap', '-k', ],
protocol: 'tap', protocol: 'tap',
timeout: 120, timeout: 120,
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
], ],
suite: 'a11y') suite: 'a11y')
endforeach endforeach

View File

@ -12,11 +12,7 @@ test_change = executable(
test('change', test_change, test('change', test_change,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],

View File

@ -14,11 +14,7 @@ test_api = executable('api', 'api.c',
test('api', test_api, test('api', test_api,
args: ['--tap', '-k' ], args: ['--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],
@ -33,11 +29,7 @@ test_data = executable('data', ['data.c', '../../gtk/css/gtkcssdataurl.c'],
test('data', test_data, test('data', test_data,
args: ['--tap', '-k' ], args: ['--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],
@ -59,8 +51,7 @@ if false and get_option ('profiler')
'--name', 'performance-adwaita', '--name', 'performance-adwaita',
'--output', join_paths(meson.current_build_dir(), 'output'), '--output', join_paths(meson.current_build_dir(), 'output'),
join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ], join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Adwaita', env: [ 'GTK_THEME=Adwaita' ],
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
suite: [ 'css' ]) suite: [ 'css' ])
test('performance-empty', test_performance, test('performance-empty', test_performance,
@ -68,8 +59,7 @@ if false and get_option ('profiler')
'--name', 'performance-empty', '--name', 'performance-empty',
'--output', join_paths(meson.current_build_dir(), 'output'), '--output', join_paths(meson.current_build_dir(), 'output'),
join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ], join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Empty', env: [ 'GTK_THEME=Empty' ],
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
suite: [ 'css' ]) suite: [ 'css' ])
endif endif

View File

@ -9,11 +9,7 @@ test_nodes = executable('test-css-nodes', 'test-css-nodes.c',
test('nodes', test_nodes, test('nodes', test_nodes,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],

View File

@ -463,13 +463,9 @@ foreach testname : test_data
join_paths(meson.current_source_dir(), testname), join_paths(meson.current_source_dir(), testname),
], ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],
suite: 'css') suite: 'css')
endif endif

View File

@ -19,11 +19,7 @@ test_style = executable(
test('style', test_style, test('style', test_style,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],

View File

@ -22,11 +22,7 @@ foreach t : tests
test(t, test_exe, test(t, test_exe,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],

View File

@ -90,14 +90,10 @@ foreach renderer : renderers
args: ['--output', join_paths(meson.current_build_dir(), 'compare', renderer[0]), args: ['--output', join_paths(meson.current_build_dir(), 'compare', renderer[0]),
join_paths(meson.current_source_dir(), 'compare', test + '.node'), join_paths(meson.current_source_dir(), 'compare', test + '.node'),
join_paths(meson.current_source_dir(), 'compare', test + '.png')], join_paths(meson.current_source_dir(), 'compare', test + '.png')],
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory', 'GSK_RENDERER=' + renderer[0],
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
'GSK_RENDERER=' + renderer[0]
], ],
suite: [ 'gsk', 'gsk-compare', 'gsk-' + renderer[0], 'gsk-compare-' + renderer[0] ]) suite: [ 'gsk', 'gsk-compare', 'gsk-' + renderer[0], 'gsk-compare-' + renderer[0] ])
endif endif
@ -171,14 +167,10 @@ foreach test : node_parser_tests
test('parser ' + test, node_parser, test('parser ' + test, node_parser,
args: [ join_paths(meson.current_source_dir(), 'nodeparser', test) args: [ join_paths(meson.current_source_dir(), 'nodeparser', test)
], ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory', 'GSK_RENDERER=opengl',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
'GSK_RENDERER=opengl'
], ],
suite: 'gsk') suite: 'gsk')
endif endif
@ -207,15 +199,10 @@ foreach t : tests
test(test_name, test_exe, test(test_name, test_exe,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSK_RENDERER=cairo', 'GSK_RENDERER=cairo',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
], ],
suite: 'gsk') suite: 'gsk')
endforeach endforeach

View File

@ -111,16 +111,11 @@ foreach t : tests
test(test_name, test_exe, test(test_name, test_exe,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'NO_AT_BRIDGE=1', 'NO_AT_BRIDGE=1',
'GSK_RENDERER=cairo', 'GSK_RENDERER=cairo',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
], ],
suite: 'gtk', suite: 'gtk',
should_fail: expect_fail, should_fail: expect_fail,
@ -138,14 +133,9 @@ if add_languages('cpp', required: false)
test('c++ keywords', test_exe, test('c++ keywords', test_exe,
args: [ '--tap', '-k' ], args: [ '--tap', '-k' ],
#protocol: 'tap', #protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
], ],
suite: 'gtk') suite: 'gtk')
if get_option('install-tests') if get_option('install-tests')
@ -192,12 +182,7 @@ foreach test : focus_chain_tests
test(test[0] + ' ' + test[1], focus_chain, test(test[0] + ' ' + test[1], focus_chain,
args: [ join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.ui'), args: [ join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.ui'),
join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]) ], join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]) ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()) 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
], ],
@ -226,14 +211,12 @@ if false and get_option ('profiler')
test('performance-layout', test_performance, test('performance-layout', test_performance,
args: [ '--mark', 'size allocation', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ], args: [ '--mark', 'size allocation', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Empty', env: [ 'GTK_THEME=Empty' ],
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
suite: [ 'gtk' ]) suite: [ 'gtk' ])
test('performance-snapshot', test_performance, test('performance-snapshot', test_performance,
args: [ '--mark', 'widget snapshot', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ], args: [ '--mark', 'widget snapshot', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Empty', env: [ 'GTK_THEME=Empty' ],
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
suite: [ 'gtk' ]) suite: [ 'gtk' ])
endif endif

View File

@ -6,18 +6,33 @@ installed_test_datadir = join_paths(gtk_datadir, 'installed-tests', 'gtk-4.0')
# otherwise we're going to have failures down the line # otherwise we're going to have failures down the line
diff = find_program('diff', required: true) diff = find_program('diff', required: true)
common_env = [
'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings:misc',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
]
add_test_setup ('x11', add_test_setup ('x11',
is_default: true, is_default: true,
env: ['GDK_BACKEND=x11', env: common_env + [
'TEST_OUTPUT_SUBDIR=x11' ]) 'GDK_BACKEND=x11',
'TEST_OUTPUT_SUBDIR=x11',
])
add_test_setup ('wayland', add_test_setup ('wayland',
env: ['GDK_BACKEND=wayland', env: common_env + [
'TEST_OUTPUT_SUBDIR=wayland' ]) 'GDK_BACKEND=wayland',
'TEST_OUTPUT_SUBDIR=wayland',
])
add_test_setup ('broadway', add_test_setup ('broadway',
env: ['GDK_BACKEND=broadway', env: common_env + [
'TEST_OUTPUT_SUBDIR=broadway' ]) 'GDK_BACKEND=broadway',
'TEST_OUTPUT_SUBDIR=broadway',
])
subdir('performance') subdir('performance')
subdir('gdk') subdir('gdk')

View File

@ -438,16 +438,11 @@ foreach testname : testdata
join_paths(meson.current_source_dir(), testname), join_paths(meson.current_source_dir(), testname),
], ],
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory', 'GSK_RENDERER=opengl',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
'GTK_CSD=1',
'GDK_DEBUG=default-settings',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSK_RENDERER=opengl', 'REFTEST_MODULE_DIR=@0@'.format(meson.current_build_dir())
'REFTEST_MODULE_DIR=@0@'.format(meson.current_build_dir()),
], ],
suite: 'reftest', suite: 'reftest',
should_fail: xfails.contains(testname)) should_fail: xfails.contains(testname))

View File

@ -20,11 +20,7 @@ if bash.found()
args: t, args: t,
workdir: meson.current_build_dir(), workdir: meson.current_build_dir(),
protocol: 'tap', protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix', env: [
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GTK_BUILDER_TOOL=@0@'.format(get_variable('gtk4_builder_tool').full_path()), 'GTK_BUILDER_TOOL=@0@'.format(get_variable('gtk4_builder_tool').full_path()),