summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-12-10 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2018-12-10 22:56:01 +0100
commit62820b1af83758134cff51f4ad4eec1db90ddf62 (patch)
treef08d0b78877a3b87fc86f63ae5ed10b46800278c
parentdce0e88435cbdec6b253b9c5e46dc96d94f87bc0 (diff)
downloadgobject-introspection-62820b1af83758134cff51f4ad4eec1db90ddf62.tar.gz
meson: Port offsets tests
-rw-r--r--tests/meson.build1
-rw-r--r--tests/offsets/meson.build79
2 files changed, 80 insertions, 0 deletions
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
+