diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-02-23 13:11:22 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-05-23 12:56:21 -0400 |
commit | f9c1b6f65bec623d593835c400d2d55d981715c8 (patch) | |
tree | 2fbcc56bc165ba6d15268eb2e22588027e2a26d0 /tests | |
parent | 00bce5569b5e7fd0f6e373857a89996e07bf0725 (diff) | |
download | gobject-introspection-f9c1b6f65bec623d593835c400d2d55d981715c8.tar.gz |
Make test suite work with cross-related options
Because of skepticism I received in #224, I made this PR which keeps the
testsuite and CI improvements but doesn't add any new build options. I
hope this would be less controversial:
- no new knobs
- tests for those using existing build options
- CI tests `build_introspection_data = false`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/meson.build | 36 | ||||
-rw-r--r-- | tests/offsets/meson.build | 5 | ||||
-rw-r--r-- | tests/scanner/meson.build | 40 |
3 files changed, 40 insertions, 41 deletions
diff --git a/tests/meson.build b/tests/meson.build index b240749e..d5b76342 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -45,13 +45,17 @@ test_install_dir = join_paths(get_option('datadir'), 'gobject-introspection-1.0' install_data(installed_sources, install_dir: test_install_dir) +# Will be overridden to newly built one in common-case regular, non-cross +# build. +test_girscanner = find_program('g-ir-scanner', native: true, required : false) +test_gircompiler = find_program('g-ir-compiler', native: false, required : false) + # Generate everything.h and everything.c: test_everything_files = custom_target('everything', output: ['everything.h', 'everything.c'], depends: typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--generate-typelib-tests=Everything,@OUTPUT0@,@OUTPUT1@', '--function-decoration=_GI_TEST_EXTERN', @@ -103,14 +107,15 @@ test_typelibs = [] # 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', +if (glib_dep.type_name() == 'pkgconfig' and + test_girscanner.found() and + get_option('build_introspection_data') == true) + 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, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -128,15 +133,14 @@ if glib_dep.type_name() == 'pkgconfig' extra_giscanner_args, '@INPUT@', ] - ) + )] - test_gir_files += custom_target('gir-gimarshallingtests', + 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, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -155,14 +159,14 @@ if glib_dep.type_name() == 'pkgconfig' extra_giscanner_args, '@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@', + command: [test_gircompiler, '-o', '@OUTPUT@', '@INPUT@', '--includedir', join_paths(build_root, 'gir'), '--includedir', meson.current_build_dir() ], @@ -183,6 +187,10 @@ if glib_dep.type_name() == 'pkgconfig' endif subdir('offsets') -subdir('warn') +if get_option('build_introspection_data') == true + subdir('warn') +endif subdir('scanner') -subdir('repository') +if get_option('build_introspection_data') == true + subdir('repository') +endif diff --git a/tests/offsets/meson.build b/tests/offsets/meson.build index f6a497f6..970e54cf 100644 --- a/tests/offsets/meson.build +++ b/tests/offsets/meson.build @@ -18,8 +18,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Offsets-1.0.gir', depends: [test_offsets_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -45,7 +44,7 @@ if glib_dep.type_name() == 'pkgconfig' input: test_offsets_gir, output: '@BASENAME@.typelib', depends: [gobject_gir, ], - command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@', + command: [test_gircompiler, '-o', '@OUTPUT@', '@INPUT@', '--includedir', join_paths(build_root, 'gir'), '--includedir', meson.current_build_dir() ], diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build index fa7f7eca..5176b957 100644 --- a/tests/scanner/meson.build +++ b/tests/scanner/meson.build @@ -105,19 +105,19 @@ 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@', + test_gircompiler, '-o', '@OUTPUT@', '@INPUT@', '--includedir', join_paths(build_root, 'gir'), '--includedir', meson.current_build_dir(), ] -if glib_dep.type_name() == 'pkgconfig' +if (glib_dep.type_name() == 'pkgconfig' and + get_option('build_introspection_data') == true) typedef_gir = custom_target('gir-typedef', input: ['typedefs.c', 'typedefs.h'], output: 'Typedefs-1.0.gir', depends: [typedef_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -156,8 +156,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Bar-1.0.gir', depends: [barapp_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -195,8 +194,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'SLetter-1.0.gir', depends: [sletter_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -233,8 +231,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'WarnLib-1.0.gir', depends: [warnlib_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -269,8 +266,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Utility-1.0.gir', depends: [utility_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -307,8 +303,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'GtkFrob-1.0.gir', depends: [gtkfrob_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -346,8 +341,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'GetType-1.0.gir', depends: [gettype_lib] + typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -384,8 +378,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Symbolfilter-1.0.gir', depends: typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -412,8 +405,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Identfilter-1.0.gir', depends: typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -441,8 +433,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Headeronly-1.0.gir', depends: typelibs, command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -477,8 +468,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Regress-1.0.gir', depends: [regress_lib] + typelibs + [utility_gir], command: [ - python, - girscanner, + test_girscanner, '--quiet', '--output=@OUTPUT@', '--no-libtool', @@ -514,6 +504,8 @@ if glib_dep.type_name() == 'pkgconfig' command: gircompiler_command, ) test_typelibs += regress_typelib +else + regress_gir = disabler() endif gi_tester = files(join_paths('..', 'gi-tester')) |