summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@src.gnome.org>2019-06-05 08:25:34 +0200
committerDaiki Ueno <dueno@src.gnome.org>2019-06-05 08:25:34 +0200
commit2b5bead4ed5e3b17e411c70234c5afd7aa22b568 (patch)
treeb8c8901c34c0ae51ac0edb3d5b1022d2ac14a378
parent529758c153a85467ccd4ebaf4b469f7d0c8d49d1 (diff)
downloadlibsecret-wip/dueno/meson-test.tar.gz
meson: Run js/py testswip/dueno/meson-test
-rw-r--r--libsecret/meson.build56
-rw-r--r--meson.build4
2 files changed, 60 insertions, 0 deletions
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())