[libsecret/wip/dueno/meson-test] meson: Run js/py tests



commit 2b5bead4ed5e3b17e411c70234c5afd7aa22b568
Author: Daiki Ueno <dueno src gnome org>
Date:   Wed Jun 5 08:25:34 2019 +0200

    meson: Run js/py tests

 libsecret/meson.build | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 meson.build           |  4 ++++
 2 files changed, 60 insertions(+)
---
diff --git a/libsecret/meson.build b/libsecret/meson.build
index 590694e..6a730c4 100644
--- a/libsecret/meson.build
+++ b/libsecret/meson.build
@@ -189,3 +189,59 @@ foreach _test : test_names
 
   test(_test, test_bin)
 endforeach
+
+libmock_service_sources = [
+  'mock-service.c',
+  'mock-service.h'
+]
+
+libmock_service = shared_library('mock-service',
+  libmock_service_sources,
+  dependencies: glib_deps,
+  c_args: mock_cflags,
+  include_directories: config_h_dir,
+)
+
+mock_service_gir = gnome.generate_gir(libmock_service,
+  sources: libmock_service_sources,
+  namespace: 'MockService',
+  nsversion: '0',
+  export_packages: 'mock-service-0',
+  includes: [ 'GObject-2.0', 'Gio-2.0' ],
+  header: 'libsecret/mock-service.h',
+  install: true
+)
+
+test_env = environment()
+test_env.set('LD_LIBRARY_PATH', meson.current_build_dir())
+test_env.set('GI_TYPELIB_PATH', meson.current_build_dir())
+
+if gjs.found()
+  js_test_names = [
+    'test-js-lookup',
+    'test-js-clear',
+    'test-js-store'
+  ]
+  foreach _test : js_test_names
+    test(_test, gjs,
+        args: [join_paths(meson.current_source_dir(),
+                          '@0@.js'.format(_test))],
+        env: test_env,
+        dependencies: mock_service_gir)
+  endforeach
+endif
+
+if python3.found()
+  py_test_names = [
+    'test-py-lookup',
+    'test-py-clear',
+    'test-py-store'
+  ]
+  foreach _test : py_test_names
+    test(_test, python3,
+        args: [join_paths(meson.current_source_dir(),
+                          '@0@.py'.format(_test))],
+        env: test_env,
+        dependencies: mock_service_gir)
+  endforeach
+endif
diff --git a/meson.build b/meson.build
index 0d59799..c7b2933 100644
--- a/meson.build
+++ b/meson.build
@@ -64,6 +64,10 @@ endif
 # Libraries
 math = meson.get_compiler('c').find_library('m')
 
+# Programs
+gjs = find_program('gjs')
+python3 = import('python').find_installation()
+
 # Configuration
 conf = configuration_data()
 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())


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