[gtk-doc: 1/2] meson: Fix running tests



commit c11728a9483f907db304d2c3a25afb7720d8d35a
Author: Xavier Claessens <xclaesse gmail com>
Date:   Mon Dec 23 11:15:57 2019 +0000

    meson: Fix running tests

 .gitlab-ci.yml     |  1 +
 meson.build        |  8 +++++---
 tests/highlight.py |  0
 tests/meson.build  | 31 ++++++++++++++++---------------
 4 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ee5dfbf..3f84030 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -35,6 +35,7 @@ meson-build:
   script:
     - meson --prefix /usr _build .
     - ninja -C _build
+    - meson test -C _build
   except:
     - tags
 
diff --git a/meson.build b/meson.build
index f7d785f..7eeef38 100644
--- a/meson.build
+++ b/meson.build
@@ -13,8 +13,8 @@ version = meson.project_version()
 package_name = meson.project_name()
 
 # Paths
-srcdir = meson.source_root()
-builddir = meson.build_root()
+srcdir = meson.current_source_dir()
+builddir = meson.current_build_dir()
 
 prefix = get_option('prefix')
 
@@ -165,7 +165,9 @@ configure_file(
 )
 
 subdir('help')
-subdir('tests')
+if get_option('tests')
+  subdir('tests')
+endif
 
 # A dummy dependency object that to use gtkdoc as subproject fallback
 # To be used as: dependency('gtk-doc', fallback : ['gtk-doc', 'dummy_dep'])
diff --git a/tests/highlight.py b/tests/highlight.py
old mode 100644
new mode 100755
diff --git a/tests/meson.build b/tests/meson.build
index a60cf46..92add69 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,11 +8,14 @@ gtkdoc_unit_tests = [
   'scan',
 ]
 
+test_env = environment()
+test_env.append('PYTHONPATH', srcdir, builddir)
+
 foreach test_name: gtkdoc_unit_tests
   test(
     'test-unit-@0@'.format(test_name),
     python_prg,
-    env: ['PYTHONPATH=@0@'.format(builddir)],
+    env: test_env,
     args: [
       join_paths(
         srcdir,
@@ -25,20 +28,18 @@ endforeach
 
 subdir('helpers')
 
-if get_option('tests') == true
-  glib_dep = dependency('glib-2.0', version: glib_req)
-  gobject_dep = dependency('gobject-2.0', version: glib_req)
+glib_dep = dependency('glib-2.0', version: glib_req)
+gobject_dep = dependency('gobject-2.0', version: glib_req)
 
-  glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
-  glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
 
-  gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
-  gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html')
+gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
+gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html')
 
-  subdir('annotations')
-  subdir('bugs')
-  subdir('empty')
-  subdir('fail')
-  subdir('gobject')
-  subdir('program')
-endif
+subdir('annotations')
+subdir('bugs')
+subdir('empty')
+subdir('fail')
+subdir('gobject')
+subdir('program')


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