Classify the tests

Meson has the ability to classify tests according to "suites", a list of
tags. This is especially useful when we want to run specific sets of
tests — e.g. only GLib's tests — instead of the whole test suite. It
also allows us to classify special tests, like "slow" ones, so that we
can only run them when needed.
This commit is contained in:
Emmanuele Bassi 2018-06-10 15:33:06 +01:00
parent e22bffb522
commit 16d1a3d28c
5 changed files with 27 additions and 23 deletions

View File

@ -106,7 +106,7 @@ if dbus1_dep.found()
install : false, install : false,
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps + [dbus1_dep]) dependencies : common_gio_tests_deps + [dbus1_dep])
test('gdbus-serialization', exe, env : test_env) test('gdbus-serialization', exe, env : test_env, suite : ['gio'])
endif endif
# Test programs buildable on UNIX only # Test programs buildable on UNIX only
@ -208,7 +208,7 @@ if host_machine.system() != 'windows'
install : false, install : false,
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps + extra_deps) dependencies : common_gio_tests_deps + extra_deps)
test(test_name, exe, env : test_env) test(test_name, exe, env : test_env, suite : ['gio'])
endforeach endforeach
exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c', exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c',
@ -216,7 +216,7 @@ if host_machine.system() != 'windows'
install : false, install : false,
c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'], c_args : test_c_args + ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
test('gdbus-test-codegen-old', exe, env : test_env) test('gdbus-test-codegen-old', exe, env : test_env, suite : ['gio'])
# There is already a gapplication exe target in gio so need to use a # There is already a gapplication exe target in gio so need to use a
# different name for the unit test executable, since we can't have two # different name for the unit test executable, since we can't have two
@ -229,7 +229,7 @@ if host_machine.system() != 'windows'
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
endif endif
test('gapplication', exe, env : test_env) test('gapplication', exe, env : test_env, suite : ['gio'])
gio_tests += ['gdbus-unix-addresses'] gio_tests += ['gdbus-unix-addresses']
endif # have_dbus_daemon endif # have_dbus_daemon
@ -245,14 +245,14 @@ if host_machine.system() != 'windows'
install : false, install : false,
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
test('gdbus-connection-flush', exe, env : test_env) test('gdbus-connection-flush', exe, env : test_env, suite : ['gio'])
exe = executable('gdbus-non-socket', 'gdbus-non-socket.c', exe = executable('gdbus-non-socket', 'gdbus-non-socket.c',
'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c', 'gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c',
install : false, install : false,
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
test('gdbus-non-socket', exe, env : test_env) test('gdbus-non-socket', exe, env : test_env, suite : ['gio'])
# Generate test.mo from de.po using msgfmt # Generate test.mo from de.po using msgfmt
msgfmt = find_program('msgfmt', required : false) msgfmt = find_program('msgfmt', required : false)
@ -266,7 +266,7 @@ if host_machine.system() != 'windows'
'-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir), '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir),
], ],
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
test('gsettings', exe, env : test_env) test('gsettings', exe, env : test_env, suite : ['gio'])
endif endif
endif # unix endif # unix
@ -297,9 +297,9 @@ foreach test_name : gio_tests
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps + extra_deps) dependencies : common_gio_tests_deps + extra_deps)
if test_name == 'testfilemonitor' if test_name == 'testfilemonitor'
test(test_name, exe, env : test_env, timeout : 45) test(test_name, exe, env : test_env, timeout : 45, suite : ['gio', 'slow'])
else else
test(test_name, exe, env : test_env) test(test_name, exe, env : test_env, suite : ['gio'])
endif endif
endforeach endforeach
@ -431,7 +431,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
install : false, install : false,
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
test('resources', exe, env : test_env) test('resources', exe, env : test_env, suite : ['gio'])
endif endif
# FIXME: subdir('services') # FIXME: subdir('services')

View File

@ -121,9 +121,9 @@ foreach test_name : glib_tests
) )
# These tests may take more than 30 seconds to run on the CI infrastructure # These tests may take more than 30 seconds to run on the CI infrastructure
if slow_tests.contains(test_name) if slow_tests.contains(test_name)
test(test_name, exe, env : test_env, timeout : 120) test(test_name, exe, env : test_env, timeout : 120, suite : ['glib', 'slow'])
else else
test(test_name, exe, env : test_env) test(test_name, exe, env : test_env, suite : ['glib'])
endif endif
endforeach endforeach
@ -138,7 +138,7 @@ exe = executable('atomic', 'atomic.c',
c_args : test_cargs + c_args_atomic, c_args : test_cargs + c_args_atomic,
dependencies : deps, dependencies : deps,
) )
test('atomic', exe, env : test_env) test('atomic', exe, env : test_env, suite : ['glib'])
# FIXME: consolidate all of these into the array # FIXME: consolidate all of these into the array
exe = executable('overflow-fallback', 'overflow.c', exe = executable('overflow-fallback', 'overflow.c',
@ -146,27 +146,27 @@ exe = executable('overflow-fallback', 'overflow.c',
dependencies : deps, dependencies : deps,
install : false, install : false,
) )
test('overflow-fallback', exe, env : test_env) test('overflow-fallback', exe, env : test_env, suite : ['glib'])
exe = executable('642026-ec', '642026.c', exe = executable('642026-ec', '642026.c',
c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'], c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'],
dependencies : deps, dependencies : deps,
install : false, install : false,
) )
test('642026-ec', exe, env : test_env, timeout : 90) test('642026-ec', exe, env : test_env, timeout : 90, suite : ['glib', 'slow'])
exe = executable('1bit-emufutex', '1bit-mutex.c', exe = executable('1bit-emufutex', '1bit-mutex.c',
c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'], c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'],
dependencies : deps, dependencies : deps,
install : false, install : false,
) )
test('1bit-emufutex', exe, env : test_env) test('1bit-emufutex', exe, env : test_env, suite : ['glib'])
exe = executable('gwakeup', 'gwakeuptest.c', '../gwakeup.c', exe = executable('gwakeup', 'gwakeuptest.c', '../gwakeup.c',
c_args : test_cargs, c_args : test_cargs,
dependencies : deps, dependencies : deps,
install : false) install : false)
test('gwakeup', exe, env : test_env) test('gwakeup', exe, env : test_env, suite : ['glib'])
if glib_conf.has('HAVE_EVENTFD') if glib_conf.has('HAVE_EVENTFD')
exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c', exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
@ -174,7 +174,7 @@ if glib_conf.has('HAVE_EVENTFD')
dependencies : deps, dependencies : deps,
install : false, install : false,
) )
test('gwakeup-fallback', exe, env : test_env) test('gwakeup-fallback', exe, env : test_env, suite : ['glib'])
endif endif
# test-spawn-echo helper binary required by the spawn tests above # test-spawn-echo helper binary required by the spawn tests above
@ -196,6 +196,8 @@ if not meson.is_cross_build() and host_system != 'windows'
test('gtester-xmllint-check', xmllint, test('gtester-xmllint-check', xmllint,
args : ['--noout', tmpsample_xml], args : ['--noout', tmpsample_xml],
env : test_env) env : test_env,
suite : ['glib'],
)
endif endif
endif endif

View File

@ -41,7 +41,7 @@ foreach test_name : gobject_tests
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"'], c_args : ['-DG_LOG_DOMAIN="GLib-GObject"'],
dependencies : deps, dependencies : deps,
) )
test(test_name, exe, env : test_env) test(test_name, exe, env : test_env, suite : ['gobject'])
endforeach endforeach
marshalers_h = custom_target('marshalers_h', marshalers_h = custom_target('marshalers_h',
@ -77,4 +77,4 @@ exe = executable('signals',
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"'], c_args : ['-DG_LOG_DOMAIN="GLib-GObject"'],
dependencies : deps, dependencies : deps,
) )
test('signals', exe, env : test_env) test('signals', exe, env : test_env, suite : ['gobject'])

View File

@ -48,6 +48,7 @@ foreach t : gobject_tests
test_src = t.get(1, test_name + '.c') test_src = t.get(1, test_name + '.c')
test_extra_cargs = t.get(2, []) test_extra_cargs = t.get(2, [])
test_timeout = t.get(3, 30) test_timeout = t.get(3, 30)
test_suite = test_timeout == 30 ? ['gobject'] : ['gobject', 'slow']
# FIXME? $(GLIB_DEBUG_FLAGS) # FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name + '-gobject', test_src, exe = executable(test_name + '-gobject', test_src,
@ -56,7 +57,7 @@ foreach t : gobject_tests
install : false, install : false,
) )
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : test_timeout) test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite)
endforeach endforeach
# Don't install these ones, and keep them out of 'make check' because they take too long... # Don't install these ones, and keep them out of 'make check' because they take too long...

View File

@ -17,6 +17,7 @@ foreach t : refcount_tests
test_src = t.get(1) test_src = t.get(1)
test_extra_cargs = t.get(2) test_extra_cargs = t.get(2)
test_timeout = t.get(3, 30) test_timeout = t.get(3, 30)
test_suite = test_timeout == 30 ? ['refcount'] : ['refcount', 'slow']
# FIXME? $(GLIB_DEBUG_FLAGS) # FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name + '-test', test_src, exe = executable(test_name + '-test', test_src,
@ -25,5 +26,5 @@ foreach t : refcount_tests
install : false, install : false,
) )
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : test_timeout) test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite)
endforeach endforeach