gtk2/testsuite/a11y/meson.build
Simon McVittie 957dd49ef7 testsuite: Use separate setups for unstable tests instead of should_fail
There are two possible interpretations of "expected failure": either
the test *must* fail (exactly the inverse of an ordinary test, with
success becoming failure and failure becoming success), or the test
*may* fail (with success intended, but failure possible in some
environments). Autotools had the second interpretation, which seems
more useful in practice, but Meson has the first.

Instead of using should_fail, we can put the tests in one of two new
suites: "flaky" is intended for tests that succeed or fail unpredictably
according to the test environment or chance, while "failing" is for
tests that ought to succeed but currently never do as a result of a
bug or missing functionality. With a sufficiently new version of Meson,
the flaky and failing tests are not run by default, but can be requested
by running a setup that does not exclude them, with a command like:

    meson test --setup=x11_unstable --suite=flaky --suite=failing

As a bonus, now that we're setting up setups and their excluded suites
programmatically, the gsk-compare-broadway tests are also excluded by
default when running the test setup for a non-broadway backend.

When running the tests in CI, --suite=gtk overrides the default
exclude_suites, so we have to specify --no-suite=flaky and
--no-suite=failing explicitly.

This arrangement is inspired by GNOME/glib!2987, which was contributed
by Marco Trevisan.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00

87 lines
2.4 KiB
Meson

testexecdir = join_paths(installed_test_bindir, 'gtk')
testdatadir = join_paths(installed_test_datadir, 'gtk')
# 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 = [
{ 'name': 'accessible' },
{ 'name': 'button' },
{ 'name': 'checkbutton' },
{ 'name': 'dialog' },
{ 'name': 'entry' },
{ 'name': 'expander' },
{ 'name': 'flowbox' },
{ 'name': 'general' },
{ 'name': 'image' },
{ 'name': 'label' },
{ 'name': 'listbox' },
{ 'name': 'levelbar' },
{ 'name': 'passwordentry' },
{ 'name': 'progressbar' },
{ 'name': 'scrollbar' },
{ 'name': 'searchentry' },
{ 'name': 'separator' },
{ 'name': 'spinbutton' },
{ 'name': 'stack' },
{ 'name': 'switch' },
{ 'name': 'textview' },
{ 'name': 'window' },
]
is_debug = get_option('buildtype').startswith('debug')
test_cargs = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
test_cargs += flag
endif
endforeach
test_env = environment()
test_env.set('GTK_A11Y', 'test')
test_env.set('GSK_RENDERER', 'cairo')
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('GIO_USE_VFS', 'local')
test_env.set('GSETTINGS_BACKEND', 'memory')
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
foreach t : tests
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,
c_args: test_cargs + test_extra_cargs,
link_args: test_extra_ldflags,
dependencies: libgtk_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
if test_extra_suites.contains('slow')
test_timeout = 90
endif
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
timeout: test_timeout,
env: test_env,
suite: ['a11y'] + test_extra_suites,
)
endforeach