diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-01-01 19:11:02 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-01-01 19:21:07 +0100 |
commit | 3788335b40e9fb1b43a6ff981ab859d4e8787d85 (patch) | |
tree | f8d0ba78e903e518c3f43425ff2784f96e773435 | |
parent | 295dcbd57c40d530abbc791cb5c1da15dea45d82 (diff) | |
download | gobject-introspection-3788335b40e9fb1b43a6ff981ab859d4e8787d85.tar.gz |
meson: port more typelib tests
-rw-r--r-- | gir/meson.build | 4 | ||||
-rw-r--r-- | tests/meson.build | 3 | ||||
-rw-r--r-- | tests/repository/meson.build | 44 | ||||
-rw-r--r-- | tests/scanner/meson.build | 121 |
4 files changed, 141 insertions, 31 deletions
diff --git a/gir/meson.build b/gir/meson.build index 0c50fc86..227af4f8 100644 --- a/gir/meson.build +++ b/gir/meson.build @@ -365,7 +365,7 @@ endif # out of date. gio_files += files('gio-2.0.c') -gir_files += custom_target('gir-gio', +gio_gir = custom_target('gir-gio', input: gio_files, output: 'Gio-2.0.gir', depends: [gobject_gir, giscanner_pymod], @@ -382,6 +382,8 @@ gir_files += custom_target('gir-gio', ] ) +gir_files += gio_gir + # GIRepository girepository_command = scanner_command + [ diff --git a/tests/meson.build b/tests/meson.build index 23c0e919..7e01595c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -170,8 +170,7 @@ if glib_dep.type_name() == 'pkgconfig' endif -### TODO: actually test subdir('offsets') subdir('warn') -subdir('repository') subdir('scanner') +subdir('repository') diff --git a/tests/repository/meson.build b/tests/repository/meson.build index 3a51a0e3..e1858b66 100644 --- a/tests/repository/meson.build +++ b/tests/repository/meson.build @@ -1,27 +1,33 @@ -repository_tests = [ - 'gitestrepo', - 'giteststructinfo', - 'gitestthrows', - # FIXME: Requires Regress typelib which is not yet ported to meson. - # 'gitypelibtest', -] +if glib_dep.type_name() == 'pkgconfig' -repository_test_env = environment() -repository_test_env.append( - 'GI_TYPELIB_PATH', - join_paths(meson.build_root(), 'gir'), - join_paths(meson.build_root(), 'tests') -) + repository_tests = { + 'gitestrepo': typelibs, + 'giteststructinfo': typelibs, + 'gitestthrows': typelibs, + 'gitypelibtest': [regress_typelib], + } -custom_c_args = cc.get_supported_arguments([ - '-Wno-unused-parameter', -]) -if glib_dep.type_name() == 'pkgconfig' - foreach test_name : repository_tests + repository_test_env = environment() + repository_test_env.prepend( + 'GI_TYPELIB_PATH', + join_paths(meson.build_root(), 'gir'), + join_paths(meson.build_root(), 'tests'), + join_paths(meson.build_root(), 'tests', 'scanner'), + ) + if host_system == 'windows' + repository_test_env.prepend( + 'PATH', join_paths(meson.build_root(), 'tests', 'scanner')) + endif + + custom_c_args = cc.get_supported_arguments([ + '-Wno-unused-parameter', + ]) + + foreach test_name, depends : repository_tests source = files(test_name + '.c') exe = executable(test_name, source, dependencies: [girepo_dep], c_args: custom_c_args) - test(test_name, exe, env: repository_test_env) + test(test_name, exe, env: repository_test_env, depends: depends) endforeach endif diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build index a01b46eb..08e2f116 100644 --- a/tests/scanner/meson.build +++ b/tests/scanner/meson.build @@ -19,6 +19,7 @@ foreach f : scanner_test_files endforeach test_girs = [] +test_typelibs = [] custom_c_args = cc.get_supported_arguments([ '-Wno-unused-parameter', @@ -96,8 +97,14 @@ regress_lib = shared_library('regress-1.0', python_path = run_command(python, ['-c', 'import sys; sys.stdout.write(sys.executable)']).stdout() +gircompiler_command = [ + gircompiler, '-o', '@OUTPUT@', '@INPUT@', + '--includedir', join_paths(meson.build_root(), 'gir'), + '--includedir', meson.current_build_dir(), +] + if glib_dep.type_name() == 'pkgconfig' - test_girs += custom_target('gir-typedef', + typedef_gir = custom_target('gir-typedef', input: ['typedefs.c', 'typedefs.h'], output: 'Typedefs-1.0.gir', depends: [typedef_lib] + typelibs, @@ -125,10 +132,19 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += typedef_gir + + test_typelibs += custom_target( + 'generate-typelib-typedef', + input: typedef_gir, + output: '@BASENAME@.typelib', + depends: [gobject_gir], + command: gircompiler_command, + ) # FIXME: Bar-1.0.gir - test_girs += custom_target('gir-sletter', + sletter_gir = custom_target('gir-sletter', input: ['sletter.c', 'sletter.h'], output: 'SLetter-1.0.gir', depends: [sletter_lib] + typelibs, @@ -154,8 +170,17 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += sletter_gir - test_girs += custom_target('gir-warnlib', + test_typelibs += custom_target( + 'generate-typelib-sletter', + input: sletter_gir, + output: '@BASENAME@.typelib', + depends: [gio_gir], + command: gircompiler_command, + ) + + warnlib_gir = custom_target('gir-warnlib', input: ['warnlib.c', 'warnlib.h'], output: 'WarnLib-1.0.gir', depends: [warnlib_lib] + typelibs, @@ -179,6 +204,15 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += warnlib_gir + + test_typelibs += custom_target( + 'generate-typelib-warnlib', + input: warnlib_gir, + output: '@BASENAME@.typelib', + depends: [gio_gir], + command: gircompiler_command, + ) utility_gir = custom_target('gir-utility', input: ['utility.c', 'utility.h'], @@ -208,7 +242,15 @@ if glib_dep.type_name() == 'pkgconfig' ) test_girs += utility_gir - test_girs += custom_target('gir-gtkfrob', + test_typelibs += custom_target( + 'generate-typelib-utility', + input: utility_gir, + output: '@BASENAME@.typelib', + depends: [gobject_gir], + command: gircompiler_command, + ) + + gtkfrob_gir = custom_target('gir-gtkfrob', input: ['gtkfrob.c', 'gtkfrob.h'], output: 'GtkFrob-1.0.gir', depends: [gtkfrob_lib] + typelibs, @@ -235,8 +277,17 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += gtkfrob_gir - test_girs += custom_target('gir-gettype', + test_typelibs += custom_target( + 'generate-typelib-gtkfrob', + input: gtkfrob_gir, + output: '@BASENAME@.typelib', + depends: [gobject_gir], + command: gircompiler_command, + ) + + gettype_gir = custom_target('gir-gettype', input: ['gettype.c', 'gettype.h'], output: 'GetType-1.0.gir', depends: [gettype_lib] + typelibs, @@ -262,8 +313,17 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += gettype_gir + + test_typelibs += custom_target( + 'generate-typelib-gettype', + input: gettype_gir, + output: '@BASENAME@.typelib', + depends: [gobject_gir], + command: gircompiler_command, + ) - test_girs += custom_target('gir-symbolfilter', + symbolfilter_gir = custom_target('gir-symbolfilter', input: ['symbolfilter.h'], output: 'Symbolfilter-1.0.gir', depends: typelibs, @@ -280,8 +340,16 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += symbolfilter_gir - test_girs += custom_target('gir-identfilter', + test_typelibs += custom_target( + 'generate-typelib-symbolfilter', + input: symbolfilter_gir, + output: '@BASENAME@.typelib', + command: gircompiler_command, + ) + + identfilter_gir = custom_target('gir-identfilter', input: ['identfilter.h'], output: 'Identfilter-1.0.gir', depends: typelibs, @@ -299,8 +367,16 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += identfilter_gir + + test_typelibs += custom_target( + 'generate-typelib-identfilter', + input: identfilter_gir, + output: '@BASENAME@.typelib', + command: gircompiler_command, + ) - test_girs += custom_target('gir-headeronly', + headeronly_gir = custom_target('gir-headeronly', input: ['headeronly.h'], output: 'Headeronly-1.0.gir', depends: typelibs, @@ -318,6 +394,14 @@ if glib_dep.type_name() == 'pkgconfig' '@INPUT@', ] ) + test_girs += headeronly_gir + + test_typelibs += custom_target( + 'generate-typelib-headeronly', + input: headeronly_gir, + output: '@BASENAME@.typelib', + command: gircompiler_command, + ) if with_cairo regress_scanner_cairo_args = ['--include=cairo-1.0'] @@ -358,10 +442,19 @@ if glib_dep.type_name() == 'pkgconfig' if with_cairo test_girs += regress_gir endif + + regress_typelib = custom_target( + 'generate-typelib-regress', + input: regress_gir, + output: '@BASENAME@.typelib', + command: gircompiler_command, + ) + test_typelibs += regress_typelib endif +gi_tester = files(join_paths('..', 'gi-tester')) + foreach gir : test_girs - gi_tester = files(join_paths('..', 'gi-tester')) gir_name = gir.full_path().split('/')[-1] test( 'gi-tester-' + gir_name, @@ -375,4 +468,14 @@ foreach gir : test_girs ) endforeach +foreach typelib : test_typelibs + typelib_name = typelib.full_path().split('/')[-1] + test( + 'gi-tester-' + typelib_name, + python, + args: [gi_tester, typelib.full_path()], + depends: [typelib], + ) +endforeach + subdir('annotationparser') |