summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-12-10 19:52:17 +0000
committerChristoph Reiter <reiter.christoph@gmail.com>2018-12-10 19:52:17 +0000
commitdce0e88435cbdec6b253b9c5e46dc96d94f87bc0 (patch)
treec6e0ed4dc895e5ee6271ce2a37c988d7a3d1bea7
parent79f83ff0c28861c11fc02f0827df4271fa414e71 (diff)
parent65e302262ae3ec0f8236d8ee7b8a9e1d6a5b1e58 (diff)
downloadgobject-introspection-dce0e88435cbdec6b253b9c5e46dc96d94f87bc0.tar.gz
Merge branch 'meson-repository' into 'master'
meson: Port repository tests See merge request GNOME/gobject-introspection!94
-rw-r--r--gir/meson.build3
-rw-r--r--tests/meson.build120
-rw-r--r--tests/repository/meson.build22
-rw-r--r--tests/warn/meson.build4
4 files changed, 146 insertions, 3 deletions
diff --git a/gir/meson.build b/gir/meson.build
index f613b0ef..3de41840 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -416,8 +416,9 @@ gir_files += custom_target('gir-girepository',
]
)
+typelibs = []
foreach gir : gir_files
- custom_target('generate-typelib-@0@'.format(gir).underscorify(),
+ typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(),
input: gir,
output: '@BASENAME@.typelib',
depends: [gobject_gir, ],
diff --git a/tests/meson.build b/tests/meson.build
index 18cc0807..ffc83855 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -17,6 +17,126 @@ installed_sources = [
install_data(installed_sources, install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0', 'tests'))
+# Generate everything.h and everything.c:
+test_everything_files = custom_target('everything',
+ output: ['everything.h', 'everything.c'],
+ depends: typelibs,
+ command: [
+ python,
+ girscanner,
+ '--generate-typelib-tests=Everything,@OUTPUT0@,@OUTPUT1@',
+ '--function-decoration=_GI_TEST_EXTERN',
+ '--include-first-in-src=config.h',
+ '--include-last-in-header=gitestmacros.h',
+ ]
+)
+
+test_everything_headers = [test_everything_files[0]]
+test_everything_sources = [test_everything_files[1]]
+
+everything_lib = shared_library('everything-1.0',
+ sources: test_everything_sources,
+ include_directories : configinc,
+ c_args: gi_hidden_visibility_cflags,
+ dependencies: [glib_dep, gobject_dep],
+ version: '1.0.0',
+)
+
+gimarshallingtests_lib = shared_library('gimarshallingtests-1.0',
+ sources: test_marshalling_sources,
+ include_directories : configinc,
+ c_args: gi_hidden_visibility_cflags,
+ dependencies: [glib_dep, gobject_dep],
+ version: '1.0.0',
+)
+
+test_gir_files = []
+test_typelibs = []
+
+# FIXME: When using glib as a subproject g-ir-scanner will not discover build
+# flag of dependencies through pkg-config, instead they have to be specified
+# manually like for example in gir/meson.build. This remain to be done here as
+# well. Though, this could work differently altogether. Instead one could
+# generate appropriate pkg-config files and point PKG_CONFIG_PATH to them,
+# leaving all invocations of g-ir-scanner as is.
+if glib_dep.type_name() == 'pkgconfig'
+ test_gir_files += custom_target('gir-everything',
+ input: test_everything_sources + test_everything_headers,
+ output: 'Everything-1.0.gir',
+ depends: [everything_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=Everything',
+ '--nsversion=1.0',
+ '--include=Gio-2.0',
+ '--library=everything-1.0',
+ '-L', meson.current_build_dir(),
+ '-I', meson.current_source_dir(),
+ '@INPUT@',
+ ]
+ )
+
+ test_gir_files += custom_target('gir-gimarshallingtests',
+ input: test_marshalling_sources + test_marshalling_headers,
+ output: 'GIMarshallingTests-1.0.gir',
+ depends: [gimarshallingtests_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=GIMarshallingTests',
+ '--symbol-prefix=gi_marshalling_tests',
+ '--nsversion=1.0',
+ '--include=Gio-2.0',
+ '--library=gimarshallingtests-1.0',
+ '-L' + meson.current_build_dir(),
+ '--c-include="tests/gimarshallingtests.h"',
+ '@INPUT@',
+ ]
+ )
+
+ foreach gir : test_gir_files
+ test_typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(),
+ input: gir,
+ output: '@BASENAME@.typelib',
+ depends: [gobject_gir, ],
+ command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
+ '--includedir', join_paths(meson.build_root(), 'gir'),
+ '--includedir', meson.current_build_dir()
+ ],
+ install: true,
+ install_dir: typelibdir,
+ )
+ endforeach
+
+ # FIXME: Remove? Those tests doesn't actually do anything for typelibs ...
+ foreach typelib : test_typelibs
+ gi_tester = files('gi-tester')
+ typelib_name = typelib.full_path().split('/')[-1]
+ test(
+ 'gi-tester' + typelib_name,
+ python,
+ args: [gi_tester, typelib]
+ )
+ endforeach
+
+endif
+
### TODO: actually test
subdir('warn')
+subdir('repository')
subdir('scanner')
diff --git a/tests/repository/meson.build b/tests/repository/meson.build
new file mode 100644
index 00000000..1281427e
--- /dev/null
+++ b/tests/repository/meson.build
@@ -0,0 +1,22 @@
+repository_tests = [
+ 'gitestrepo',
+ 'giteststructinfo',
+ 'gitestthrows',
+ # FIXME: Requires Regress typelib which is not yet ported to meson.
+ # 'gitypelibtest',
+]
+
+repository_test_env = environment()
+repository_test_env.append(
+ 'GI_TYPELIB_PATH',
+ join_paths(meson.build_root(), 'gir'),
+ join_paths(meson.build_root(), 'tests')
+)
+
+if glib_dep.type_name() == 'pkgconfig'
+ foreach test_name : repository_tests
+ source = files(test_name + '.c')
+ exe = executable(test_name, source, dependencies: [girepo_dep])
+ test(test_name, exe, env: repository_test_env)
+ endforeach
+endif
diff --git a/tests/warn/meson.build b/tests/warn/meson.build
index f14590ca..1f144e70 100644
--- a/tests/warn/meson.build
+++ b/tests/warn/meson.build
@@ -28,8 +28,8 @@ warn_test_env.set(
meson.build_root(),
join_paths(meson.build_root(), 'giscanner'))
-# FIXME: Windows
-if host_system != 'windows'
+# FIXME: Glib as a subproject (used on Windows mostly).
+if glib_dep.type_name() == 'pkgconfig'
foreach warn_fn : warn_tests
test(
'warn-' + warn_fn.split('.')[0], python,