mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
Add Meson support for installed tests
This is the last remaining feature necessary to achieve parity with the Autotools build. A few changes were made to the install locations of the tests, in order to better acomodate them in Meson: * Tests are now installed under a versioned folder (e.g. /usr/share/installed-tests/mutter-4) * The mutter-cogl.test file is now generated from an .in file, instead of a series of $(echo)s from within Makefile. Notice that those tests need very controlled environments to run correctly. Mutter installed tests, for example, will failed when running under a regular session due to D-Bus failing to acquire the ScreenCast and/or RemoteScreen names.
This commit is contained in:
parent
dcb525397c
commit
ebb6c56f67
@ -69,6 +69,20 @@ cogl_test_conformance_includes = [
|
||||
cogl_test_fixtures_includepath,
|
||||
]
|
||||
|
||||
if have_installed_tests
|
||||
cogl_installed_tests_cdata = configuration_data()
|
||||
cogl_installed_tests_cdata.set('libexecdir', libexecdir)
|
||||
cogl_installed_tests_cdata.set('apiversion', libmutter_api_version)
|
||||
|
||||
configure_file(
|
||||
input: 'mutter-cogl.test.in',
|
||||
output: 'mutter-cogl.test',
|
||||
configuration: cogl_installed_tests_cdata,
|
||||
install: true,
|
||||
install_dir: mutter_installed_tests_datadir,
|
||||
)
|
||||
endif
|
||||
|
||||
libmutter_cogl_test_conformance = executable('test-conformance',
|
||||
sources: cogl_test_conformance_sources,
|
||||
c_args: cogl_debug_c_args + [
|
||||
@ -84,7 +98,9 @@ libmutter_cogl_test_conformance = executable('test-conformance',
|
||||
libmutter_cogl_path_dep,
|
||||
libmutter_cogl_test_fixtures_dep,
|
||||
],
|
||||
install: false,
|
||||
install: have_installed_tests,
|
||||
install_dir: cogl_installed_tests_libexecdir,
|
||||
install_rpath: pkglibdir,
|
||||
)
|
||||
|
||||
find_unit_tests = find_program('meson/find-conform-unit-tests.sh')
|
||||
@ -92,7 +108,8 @@ cogl_conform_unit_tests = custom_target('cogl-tests-conform-unit-tests',
|
||||
output: 'unit-tests',
|
||||
input: 'test-conform-main.c',
|
||||
command: [find_unit_tests, '@INPUT@', '@OUTPUT@'],
|
||||
install: false,
|
||||
install: have_installed_tests,
|
||||
install_dir: cogl_installed_tests_libexecdir,
|
||||
)
|
||||
|
||||
test('cogl/conform', cogl_run_tests,
|
||||
|
4
cogl/tests/conform/mutter-cogl.test.in
Normal file
4
cogl/tests/conform/mutter-cogl.test.in
Normal file
@ -0,0 +1,4 @@
|
||||
[Test]
|
||||
Type=session
|
||||
TestEnvironment=COGL_TEST_VERBOSE=1
|
||||
Exec=sh -c "cd @libexecdir@/installed-tests/mutter-@apiversion@/cogl/conform; ./run-tests.sh ./config.env ./test-conformance ./unit-tests"
|
@ -4,10 +4,20 @@ cdata = configuration_data()
|
||||
cdata.set('HAVE_GL', have_gl.to_int())
|
||||
cdata.set('HAVE_GLES2', have_gles2.to_int())
|
||||
|
||||
cogl_installed_tests_libexecdir = join_paths(
|
||||
mutter_installed_tests_libexecdir, 'cogl', 'conform')
|
||||
|
||||
if have_installed_tests
|
||||
install_data('run-tests.sh', install_dir: cogl_installed_tests_libexecdir)
|
||||
endif
|
||||
|
||||
cogl_config_env = configure_file(
|
||||
input: 'config.env.in',
|
||||
output: 'config.env',
|
||||
configuration: cdata)
|
||||
configuration: cdata,
|
||||
install: have_installed_tests,
|
||||
install_dir: cogl_installed_tests_libexecdir,
|
||||
)
|
||||
|
||||
subdir('conform')
|
||||
subdir('unit')
|
||||
|
@ -73,6 +73,12 @@ builddir = meson.current_build_dir()
|
||||
|
||||
libmutter_name = 'mutter-' + libmutter_api_version
|
||||
|
||||
mutter_installed_tests_datadir = join_paths(
|
||||
datadir, 'installed-tests', libmutter_name)
|
||||
|
||||
mutter_installed_tests_libexecdir = join_paths(
|
||||
libexecdir, 'installed-tests', libmutter_name)
|
||||
|
||||
m_dep = cc.find_library('m', required: true)
|
||||
x11_dep = dependency('x11')
|
||||
gtk3_dep = dependency('gtk+-3.0', version: gtk3_req)
|
||||
@ -239,6 +245,7 @@ endif
|
||||
|
||||
have_cogl_tests = get_option('cogl_tests')
|
||||
have_clutter_tests = get_option('clutter_tests')
|
||||
have_installed_tests = get_option('installed_tests')
|
||||
|
||||
have_tests = get_option('tests')
|
||||
if have_tests
|
||||
|
@ -123,6 +123,12 @@ option('tests',
|
||||
description: 'Enable mutter tests'
|
||||
)
|
||||
|
||||
option('installed_tests',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Enable mutter installed tests'
|
||||
)
|
||||
|
||||
option('verbose',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
|
@ -10,6 +10,24 @@ tests_deps = [
|
||||
libmutter_clutter_dep,
|
||||
]
|
||||
|
||||
if have_installed_tests
|
||||
stacking_files_datadir = join_paths(pkgdatadir, 'tests')
|
||||
|
||||
installed_tests_cdata = configuration_data()
|
||||
installed_tests_cdata.set('libexecdir', libexecdir)
|
||||
installed_tests_cdata.set('apiversion', libmutter_api_version)
|
||||
|
||||
configure_file(
|
||||
input: 'mutter-all.test.in',
|
||||
output: 'mutter-all.test',
|
||||
configuration: installed_tests_cdata,
|
||||
install: true,
|
||||
install_dir: mutter_installed_tests_datadir,
|
||||
)
|
||||
|
||||
install_subdir('stacking', install_dir: stacking_files_datadir)
|
||||
endif
|
||||
|
||||
test_env = environment()
|
||||
test_env.set('G_TEST_SRCDIR', join_paths(top_srcdir, 'src'))
|
||||
test_env.set('G_TEST_BUILDDIR', builddir)
|
||||
@ -24,7 +42,8 @@ test_client = executable('mutter-test-client',
|
||||
gio_unix_dep,
|
||||
xext_dep,
|
||||
],
|
||||
install: false,
|
||||
install: have_installed_tests,
|
||||
install_dir: mutter_installed_tests_libexecdir,
|
||||
)
|
||||
|
||||
test_runner = executable('mutter-test-runner',
|
||||
@ -36,7 +55,8 @@ test_runner = executable('mutter-test-runner',
|
||||
include_directories: tests_includepath,
|
||||
c_args: tests_c_args,
|
||||
dependencies: [tests_deps],
|
||||
install: false,
|
||||
install: have_installed_tests,
|
||||
install_dir: mutter_installed_tests_libexecdir,
|
||||
)
|
||||
|
||||
unit_tests = executable('mutter-test-unit-tests',
|
||||
@ -62,7 +82,8 @@ unit_tests = executable('mutter-test-unit-tests',
|
||||
include_directories: tests_includepath,
|
||||
c_args: tests_c_args,
|
||||
dependencies: [tests_deps],
|
||||
install: false,
|
||||
install: have_installed_tests,
|
||||
install_dir: mutter_installed_tests_libexecdir,
|
||||
)
|
||||
|
||||
headless_start_test = executable('mutter-headless-start-test',
|
||||
@ -78,7 +99,8 @@ headless_start_test = executable('mutter-headless-start-test',
|
||||
include_directories: tests_includepath,
|
||||
c_args: tests_c_args,
|
||||
dependencies: [tests_deps],
|
||||
install: false,
|
||||
install: have_installed_tests,
|
||||
install_dir: mutter_installed_tests_libexecdir,
|
||||
)
|
||||
|
||||
stacking_tests = files([
|
||||
|
@ -1,5 +1,5 @@
|
||||
[Test]
|
||||
Description=All Mutter tests
|
||||
Exec=@libexecdir@/installed-tests/mutter/mutter-test-runner --all
|
||||
Exec=@libexecdir@/installed-tests/mutter-@apiversion@/mutter-test-runner --all
|
||||
Type=session
|
||||
Output=TAP
|
||||
|
Loading…
Reference in New Issue
Block a user