summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-12-11 08:31:41 +0000
committerChristoph Reiter <reiter.christoph@gmail.com>2018-12-11 08:31:41 +0000
commit5f5a3ed26814e547ac32b2b0fe83a5a1602074f0 (patch)
treea8609b3ad1097b2e35b262183b1d540e25833bcc
parentdce0e88435cbdec6b253b9c5e46dc96d94f87bc0 (diff)
parent9b20583cb459fcb8276df6059cfa58a1dbe96091 (diff)
downloadgobject-introspection-5f5a3ed26814e547ac32b2b0fe83a5a1602074f0.tar.gz
Merge branch 'meson-offsets' into 'master'
meson: Port offsets tests See merge request GNOME/gobject-introspection!95
-rw-r--r--tests/meson.build3
-rw-r--r--tests/offsets/meson.build79
2 files changed, 80 insertions, 2 deletions
diff --git a/tests/meson.build b/tests/meson.build
index ffc83855..bfa8f8bb 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -118,8 +118,6 @@ if glib_dep.type_name() == 'pkgconfig'
'--includedir', join_paths(meson.build_root(), 'gir'),
'--includedir', meson.current_build_dir()
],
- install: true,
- install_dir: typelibdir,
)
endforeach
@@ -137,6 +135,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
+