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 ],
protocol: 'tap',
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_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'a11y',
)
@ -89,13 +83,9 @@ foreach t: a11y_tests
args: [ '--tap', '-k', ],
protocol: 'tap',
timeout: 120,
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'a11y')
endforeach

View File

@ -12,11 +12,7 @@ test_change = executable(
test('change', test_change,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_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,
args: ['--tap', '-k' ],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_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,
args: ['--tap', '-k' ],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
@ -59,8 +51,7 @@ if false and get_option ('profiler')
'--name', 'performance-adwaita',
'--output', join_paths(meson.current_build_dir(), 'output'),
join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Adwaita',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
env: [ 'GTK_THEME=Adwaita' ],
suite: [ 'css' ])
test('performance-empty', test_performance,
@ -68,8 +59,7 @@ if false and get_option ('profiler')
'--name', 'performance-empty',
'--output', join_paths(meson.current_build_dir(), 'output'),
join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Empty',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
env: [ 'GTK_THEME=Empty' ],
suite: [ 'css' ])
endif

View File

@ -9,11 +9,7 @@ test_nodes = executable('test-css-nodes', 'test-css-nodes.c',
test('nodes', test_nodes,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_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),
],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'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')
endif

View File

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

View File

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

View File

@ -111,16 +111,11 @@ foreach t : tests
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'NO_AT_BRIDGE=1',
'GSK_RENDERER=cairo',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'gtk',
should_fail: expect_fail,
@ -138,14 +133,9 @@ if add_languages('cpp', required: false)
test('c++ keywords', test_exe,
args: [ '--tap', '-k' ],
#protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'gtk')
if get_option('install-tests')
@ -192,12 +182,7 @@ foreach test : focus_chain_tests
test(test[0] + ' ' + test[1], focus_chain,
args: [ join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.ui'),
join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]) ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_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,
args: [ '--mark', 'size allocation', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Empty',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
env: [ 'GTK_THEME=Empty' ],
suite: [ 'gtk' ])
test('performance-snapshot', test_performance,
args: [ '--mark', 'widget snapshot', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
env: [ 'GTK_THEME=Empty',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
env: [ 'GTK_THEME=Empty' ],
suite: [ 'gtk' ])
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
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',
is_default: true,
env: ['GDK_BACKEND=x11',
'TEST_OUTPUT_SUBDIR=x11' ])
env: common_env + [
'GDK_BACKEND=x11',
'TEST_OUTPUT_SUBDIR=x11',
])
add_test_setup ('wayland',
env: ['GDK_BACKEND=wayland',
'TEST_OUTPUT_SUBDIR=wayland' ])
env: common_env + [
'GDK_BACKEND=wayland',
'TEST_OUTPUT_SUBDIR=wayland',
])
add_test_setup ('broadway',
env: ['GDK_BACKEND=broadway',
'TEST_OUTPUT_SUBDIR=broadway' ])
env: common_env + [
'GDK_BACKEND=broadway',
'TEST_OUTPUT_SUBDIR=broadway',
])
subdir('performance')
subdir('gdk')

View File

@ -438,16 +438,11 @@ foreach testname : testdata
join_paths(meson.current_source_dir(), testname),
],
protocol: 'tap',
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
'GTK_CSD=1',
'GDK_DEBUG=default-settings',
'G_ENABLE_DIAGNOSTIC=0',
env: [
'GSK_RENDERER=opengl',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_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',
should_fail: xfails.contains(testname))

View File

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