[glib: 2/6] build: Add installed-tests support for mkenums.py



commit e3171ee08cafa815402a0cd0aefd4ea5bf3c0efa
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Jun 7 18:03:10 2019 +0100

    build: Add installed-tests support for mkenums.py
    
    This makes the Meson build code for it a little more generic, and adds
    support for installed tests.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gobject/tests/meson.build | 47 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 40 insertions(+), 7 deletions(-)
---
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
index 7c3e5cd9d..0a2e7de03 100644
--- a/gobject/tests/meson.build
+++ b/gobject/tests/meson.build
@@ -56,6 +56,10 @@ if cc.get_id() != 'msvc'
   gobject_tests += {'autoptr' : {}}
 endif
 
+python_tests = [
+  'mkenums.py',
+]
+
 # FIXME: put common bits of test environment() in one location
 # Not entirely random of course, but at least it changes over time
 random_number = minor_version + meson.version().split('.').get(1).to_int()
@@ -106,10 +110,39 @@ foreach test_name, extra_args : gobject_tests
   test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
 endforeach
 
-test(
-  'mkenums.py',
-  python,
-  args: files('mkenums.py'),
-  env: test_env,
-  suite: ['gobject'],
-)
+foreach test_name : python_tests
+  test(
+    test_name,
+    python,
+    args: files(test_name),
+    env: test_env,
+    suite: ['gobject'],
+  )
+
+  if installed_tests_enabled
+    install_data(
+      files(test_name),
+      install_dir: installed_tests_execdir,
+      install_mode: 'rwxr-xr-x',
+    )
+
+    test_conf = configuration_data()
+    test_conf.set('installed_tests_dir', installed_tests_execdir)
+    test_conf.set('program', test_name)
+    test_conf.set('env', '')
+    configure_file(
+      input: installed_tests_template_tap,
+      output: test_name + '.test',
+      install_dir: installed_tests_metadir,
+      configuration: test_conf,
+    )
+  endif
+endforeach
+
+# TAP test runner for Python tests
+if installed_tests_enabled
+  install_data(
+    files('taptestrunner.py'),
+    install_dir: installed_tests_execdir,
+  )
+endif


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