[gnome-boxes] meson: Support Installed tests



commit 8c948eaf920db06b215e5f2fa680b96c7429ad5a
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Sun Dec 10 02:49:34 2017 +0100

    meson: Support Installed tests
    
    Although Boxes has support for Installed tests, this support is
    limited only to autotools, and meson lacks this feature.
    
    This patch adds support for Installed tests on meson.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791421

 meson.build            |    4 ++++
 meson_options.txt      |    5 +++++
 tests/meson.build      |   38 ++++++++++++++++++++++++++++++++++++++
 tests/template.test.in |    3 +++
 4 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/meson.build b/meson.build
index ee18a05..7e7b1bd 100644
--- a/meson.build
+++ b/meson.build
@@ -85,3 +85,7 @@ subdir ('data')
 subdir ('help')
 subdir ('po')
 subdir ('src')
+
+if get_option ('installed_tests')
+  subdir ('tests')
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 97c1aad..3030bd1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,3 +11,8 @@ option ('distributor_version',
 option ('ovirt',
         type: 'boolean',
         value: true)
+
+option ('installed_tests',
+        type: 'boolean',
+        value: false,
+        description: 'enable installed unit tests')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..3db607b
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,38 @@
+tests_names = [
+  'express-install.feature',
+  'general.feature',
+  'import-vms.feature',
+  'livecd.feature',
+  'multi-windows.feature',
+  'snapshots.feature',
+  'spice.feature',
+  'system-broker.feature',
+  'vnc.feature'
+]
+
+tests_execdir = join_paths (get_option('prefix'), get_option ('libexecdir'), meson.project_name (), 
'installed-tests')
+tests_metadir = join_paths (get_option ('datadir'), 'installed-tests', meson.project_name ())
+
+foreach test_name: tests_names
+  tests_conf = configuration_data ()
+  tests_conf.set ('TESTS_PATH', tests_execdir)
+  tests_conf.set ('TEST_NAME', test_name)
+  tests_conf.set ('TEST_TYPE', 'session-exclusive')
+
+  configure_file (
+    input: 'template.test.in',
+    output: test_name + '.test',
+    install: true,
+    install_dir: tests_metadir,
+    configuration: tests_conf
+  )
+endforeach
+
+tests_files = tests_names + [
+  'common_steps.py',
+  'environment.py'
+]
+
+install_data (tests_files, install_dir: tests_execdir)
+
+install_subdir ('steps', install_dir: tests_execdir)
diff --git a/tests/template.test.in b/tests/template.test.in
new file mode 100644
index 0000000..c04ace6
--- /dev/null
+++ b/tests/template.test.in
@@ -0,0 +1,3 @@
+[Test]
+Exec=behave @TESTS_PATH@ -i @TEST_NAME@ -k -f html -o @TEST_NAME@.html -f plain
+Type=@TEST_TYPE@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]