tests: add headless_tests support

Run tests using Xvfb so that we can run them in CI
This commit is contained in:
Marco Trevisan (Treviño) 2018-11-14 02:19:09 -06:00
parent dec20d13e1
commit 0503ecaf84
6 changed files with 94 additions and 5 deletions

View File

@ -82,4 +82,13 @@ foreach test : clutter_conform_tests
suite: ['clutter', 'clutter/conform'],
env: test_env
)
if have_headless_tests
test(test, xvfb,
args: test_executable,
suite: ['clutter-headless', 'clutter-headless/conform', 'headless'],
env: test_env,
is_parallel: false,
)
endif
endforeach

View File

@ -105,3 +105,17 @@ test('conform', cogl_run_tests,
is_parallel: false,
timeout: 60,
)
if have_headless_tests
test('conform', xvfb,
suite: ['cogl-headless', 'headless'],
args: [
cogl_run_tests.path(),
cogl_config_env,
libmutter_cogl_test_conformance,
cogl_conform_unit_tests
],
is_parallel: false,
timeout: 500,
)
endif

View File

@ -32,12 +32,22 @@ cogl_unit_unit_tests = custom_target('cogl-tests-unit-unit-tests',
install: false,
)
cogl_unit_test_args = [
cogl_config_env,
libmutter_cogl_test_unit,
cogl_unit_unit_tests
]
test('unit', cogl_run_tests,
suite: ['cogl'],
args: [
cogl_config_env,
libmutter_cogl_test_unit,
cogl_unit_unit_tests
],
args: cogl_unit_test_args,
is_parallel: false,
)
if have_headless_tests
test('unit', xvfb,
suite: ['cogl-headless', 'headless'],
args: [ cogl_run_tests.path() ] + cogl_unit_test_args,
is_parallel: false,
timeout: 90,
)
endif

View File

@ -245,6 +245,26 @@ if have_tests
endif
endif
headless_tests_option = get_option('headless_tests')
have_headless_tests = not headless_tests_option.disabled()
if have_headless_tests
if not have_tests and not have_cogl_tests and not have_clutter_tests
have_headless_tests = false
if headless_tests_option.enabled()
error('Headless tests are enabled, but no other test suite is')
endif
endif
if have_headless_tests
xvfb = find_program('xvfb-run', required: headless_tests_option.enabled())
have_headless_tests = xvfb.found()
endif
endif
if have_headless_tests
headless_tests_suite = ['headless']
else
headless_tests_suite = []
endif
required_functions = [
'ffs',
'clz',

View File

@ -123,6 +123,12 @@ option('tests',
description: 'Enable mutter tests'
)
option('headless_tests',
type: 'feature',
value: 'auto',
description: 'Enable mutter headless tests'
)
option('verbose',
type: 'boolean',
value: true,

View File

@ -107,6 +107,18 @@ foreach stacking_test: stacking_tests
is_parallel: false,
timeout: 60,
)
if have_headless_tests
test(stacking_test, xvfb,
suite: ['mutter-headless', 'mutter-headless/stacking', 'headless'],
env: test_env,
args: [
test_runner,
files(join_paths('stacking', stacking_test + '.metatest')),
],
is_parallel: false,
timeout: 60,
)
endif
endforeach
test('normal', unit_tests,
@ -122,3 +134,21 @@ test('headless-start', headless_start_test,
is_parallel: false,
timeout: 60,
)
if have_headless_tests
test('normal', xvfb,
args: unit_tests,
suite: ['mutter-headless', 'mutter-headless/unit', 'headless'],
env: test_env,
is_parallel: false,
timeout: 60,
)
test('headless-start', xvfb,
args: headless_start_test,
suite: ['mutter-headless', 'mutter-headless/unit', 'headless'],
env: test_env,
is_parallel: false,
timeout: 60,
)
endif