[mutter/gbsneto/burn-autotools-with-fire: 5/10] Add Meson support for installed tests
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/burn-autotools-with-fire: 5/10] Add Meson support for installed tests
- Date: Thu, 20 Dec 2018 14:46:57 +0000 (UTC)
commit 3881d5a1a21673ab6154c2b171a2a26b29c5d1c7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Dec 17 13:26:07 2018 -0200
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.
cogl/tests/conform/meson.build | 24 ++++++++++++++++++++++--
cogl/tests/conform/mutter-cogl.test.in | 4 ++++
cogl/tests/meson.build | 12 +++++++++++-
meson.build | 1 +
meson_options.txt | 6 ++++++
src/tests/meson.build | 33 +++++++++++++++++++++++++++++----
src/tests/mutter-all.test.in | 2 +-
7 files changed, 74 insertions(+), 8 deletions(-)
---
diff --git a/cogl/tests/conform/meson.build b/cogl/tests/conform/meson.build
index 4427851b7..83da152a4 100644
--- a/cogl/tests/conform/meson.build
+++ b/cogl/tests/conform/meson.build
@@ -69,6 +69,23 @@ cogl_test_conformance_includes = [
cogl_test_fixtures_includepath,
]
+if have_installed_tests
+ cogl_installed_tests_datadir = join_paths(
+ datadir, 'installed-tests', libmutter_name)
+
+ 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: cogl_installed_tests_datadir,
+ )
+endif
+
libmutter_cogl_test_conformance = executable('test-conformance',
sources: cogl_test_conformance_sources,
c_args: cogl_debug_c_args + [
@@ -84,7 +101,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_dir,
+ install_rpath: pkglibdir,
)
find_unit_tests = find_program('meson/find-conform-unit-tests.sh')
@@ -92,7 +111,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_dir,
)
test('cogl/conform', cogl_run_tests,
diff --git a/cogl/tests/conform/mutter-cogl.test.in b/cogl/tests/conform/mutter-cogl.test.in
new file mode 100644
index 000000000..d7c85ede2
--- /dev/null
+++ b/cogl/tests/conform/mutter-cogl.test.in
@@ -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"
diff --git a/cogl/tests/meson.build b/cogl/tests/meson.build
index e5b85bbfc..c800aa802 100644
--- a/cogl/tests/meson.build
+++ b/cogl/tests/meson.build
@@ -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_dir = join_paths(
+ libexecdir, 'installed-tests', libmutter_name, 'cogl', 'conform')
+
+if have_installed_tests
+ install_data('run-tests.sh', install_dir: cogl_installed_tests_dir)
+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_dir,
+)
subdir('conform')
subdir('unit')
diff --git a/meson.build b/meson.build
index 9c6350c6b..c88423622 100644
--- a/meson.build
+++ b/meson.build
@@ -239,6 +239,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
diff --git a/meson_options.txt b/meson_options.txt
index a0924faf1..7626661d1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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,
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 90620ab4a..af59723e7 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -10,6 +10,27 @@ tests_deps = [
libmutter_clutter_dep,
]
+installed_tests_bindir = join_paths(libexecdir, 'installed-tests', libmutter_name)
+
+if have_installed_tests
+ installed_tests_datadir = join_paths(datadir, 'installed-tests', libmutter_name)
+ 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: 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 +45,8 @@ test_client = executable('mutter-test-client',
gio_unix_dep,
xext_dep,
],
- install: false,
+ install: have_installed_tests,
+ install_dir: installed_tests_bindir,
)
test_runner = executable('mutter-test-runner',
@@ -36,7 +58,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: installed_tests_bindir,
)
unit_tests = executable('mutter-test-unit-tests',
@@ -62,7 +85,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: installed_tests_bindir,
)
headless_start_test = executable('mutter-headless-start-test',
@@ -78,7 +102,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: installed_tests_bindir,
)
stacking_tests = files([
diff --git a/src/tests/mutter-all.test.in b/src/tests/mutter-all.test.in
index 679468a6e..3078ff67e 100644
--- a/src/tests/mutter-all.test.in
+++ b/src/tests/mutter-all.test.in
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]