[gobject-introspection: 1/3] meson: Port offsets tests



commit 62820b1af83758134cff51f4ad4eec1db90ddf62
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Mon Dec 10 00:00:00 2018 +0000

    meson: Port offsets tests

 tests/meson.build         |  1 +
 tests/offsets/meson.build | 79 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
---
diff --git a/tests/meson.build b/tests/meson.build
index ffc83855..e9d7fef4 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -137,6 +137,7 @@ if glib_dep.type_name() == 'pkgconfig'
 endif
 
 ### TODO: actually test
+subdir('offsets')
 subdir('warn')
 subdir('repository')
 subdir('scanner')
diff --git a/tests/offsets/meson.build b/tests/offsets/meson.build
new file mode 100644
index 00000000..acf81451
--- /dev/null
+++ b/tests/offsets/meson.build
@@ -0,0 +1,79 @@
+test_offsets_sources = files('offsets.c')
+test_offsets_headers = files('offsets.h')
+
+test_offsets_inc = include_directories('.', '..')
+
+test_offsets_lib = shared_library('offsets-1.0',
+  sources: test_offsets_sources,
+  include_directories : [configinc, test_offsets_inc],
+  c_args: gi_hidden_visibility_cflags,
+  dependencies: [glib_dep, gobject_dep],
+  version: '1.0.0',
+)
+
+# FIXME: See tests/meson.build
+# FIXME: gitestoffsets.exe fails with STATUS_DLL_NOT_FOUND
+if host_system != 'windows'
+
+  test_offsets_gir = custom_target('gir-offsets',
+    input: test_offsets_sources + test_offsets_headers,
+    output: 'Offsets-1.0.gir',
+    depends: [test_offsets_lib] + typelibs,
+    command: [
+      python,
+      girscanner,
+      '--output=@OUTPUT@',
+      '--no-libtool',
+      '--reparse-validate',
+      '--add-include-path', join_paths(meson.source_root(), 'gir'),
+      '--add-include-path', join_paths(meson.build_root(), 'gir'),
+      '--warn-all',
+      '--warn-error',
+      '--namespace=Offsets',
+      '--nsversion=1.0',
+      '--include=GObject-2.0',
+      '--library=offsets-1.0',
+      '-L', meson.current_build_dir(),
+      '-I', meson.current_source_dir(),
+      '-I', join_paths(meson.source_root(), 'tests'),
+      '@INPUT@',
+    ]
+  )
+
+  test_offsets_typelib = custom_target(
+    'generate-typelib-offsets',
+    input: test_offsets_gir,
+    output: '@BASENAME@.typelib',
+    depends: [gobject_gir, ],
+    command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
+              '--includedir', join_paths(meson.build_root(), 'gir'),
+              '--includedir', meson.current_build_dir()
+    ],
+  )
+
+  gitestoffsets_sources = custom_target(
+    'generate-gitestoffsets.c',
+    output: ['gitestoffsets.c'],
+    command: [python] + files('gen-gitestoffsets', 'offsets.h'),
+    capture: true,
+  )
+
+  executable('gitestoffsets',
+    gitestoffsets_sources, 
+    include_directories : test_offsets_inc,
+    dependencies: [girepo_dep],
+  )
+
+  test_offsets_env = environment()
+  test_offsets_env.set('top_builddir', join_paths(meson.build_root(), 'gir'))
+  test_offsets_env.set('builddir', meson.current_build_dir())
+  
+  test('test_offsets.py',
+    python, 
+    args: files('test_offsets.py'),
+    env: test_offsets_env,
+    depends: test_offsets_typelib,
+  )
+
+endif
+


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