mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 12:41:50 +01:00
meson: Add tests for generated pkg-config files
Ensure things are generated as we expect and avoid we regress on that.
This commit is contained in:
parent
fcad56e313
commit
ade79bcb50
@ -1096,4 +1096,72 @@ if installed_tests_enabled
|
||||
)
|
||||
endif
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
prefix = get_option('prefix')
|
||||
if prefix.endswith(':/')
|
||||
prefix += '/'
|
||||
endif
|
||||
|
||||
pkg_config_tests = [
|
||||
'pkg-config --validate gio-2.0',
|
||||
'test "$(pkg-config --modversion gio-2.0)" = "@0@"'.format(glib_version),
|
||||
'test "$(pkg-config --variable=prefix gio-2.0)" = "@0@"'.format(
|
||||
get_option('prefix')),
|
||||
'test "$(pkg-config --variable=datadir gio-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir')),
|
||||
'test "$(pkg-config --variable=schemasdir gio-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir') / schemas_subdir),
|
||||
'test "$(pkg-config --variable=giomoduledir gio-2.0)" = "@0@"'.format(
|
||||
get_option('gio_module_dir') != '' ?
|
||||
prefix / get_option('gio_module_dir') :
|
||||
prefix / get_option('libdir') / 'gio' / 'modules'),
|
||||
]
|
||||
|
||||
gio_binaries = [
|
||||
'gio',
|
||||
'gio-querymodules',
|
||||
'glib-compile-schemas',
|
||||
'glib-compile-resources',
|
||||
'gdbus',
|
||||
'gdbus-codegen',
|
||||
'gresource',
|
||||
'gsettings',
|
||||
]
|
||||
|
||||
foreach binary: gio_binaries
|
||||
pkg_config_tests += [
|
||||
'test "$(pkg-config --variable=@0@ gio-2.0)" = "@1@"'.format(
|
||||
binary.underscorify(),
|
||||
prefix / get_option('bindir') / binary)
|
||||
]
|
||||
endforeach
|
||||
|
||||
test('gio-2.0-pkg-config',
|
||||
bash,
|
||||
args: [ '-xe', '-c', '\n'.join(pkg_config_tests) ],
|
||||
suite: ['gio', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
|
||||
platform_module = host_system == 'windows' ? 'gio-windows-2.0' : 'gio-unix-2.0'
|
||||
pkg_config_tests = [
|
||||
'pkg-config --validate ' + platform_module,
|
||||
'test "$(pkg-config --modversion @0@)" = "@1@"'.format(platform_module,
|
||||
glib_version),
|
||||
'test "$(pkg-config --variable=prefix @0@)" = "@1@"'.format(platform_module,
|
||||
get_option('prefix')),
|
||||
]
|
||||
|
||||
test(platform_module + '-pkg-config',
|
||||
bash,
|
||||
args: [ '-xe', '-c', '\n'.join(pkg_config_tests) ],
|
||||
suite: ['gio', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endif
|
||||
|
||||
subdir('services')
|
||||
|
@ -490,3 +490,34 @@ if not meson.is_cross_build() and host_system != 'windows'
|
||||
endif
|
||||
endif
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
prefix = get_option('prefix')
|
||||
if prefix.endswith(':/')
|
||||
prefix += '/'
|
||||
endif
|
||||
test('glib-2.0-pkg-config',
|
||||
bash,
|
||||
args: [
|
||||
'-xe', '-c',
|
||||
'\n'.join([
|
||||
'pkg-config --validate glib-2.0',
|
||||
'test "$(pkg-config --modversion glib-2.0)" = "@0@"'.format(glib_version),
|
||||
'test "$(pkg-config --variable=prefix glib-2.0)" = "@0@"'.format(
|
||||
get_option('prefix')),
|
||||
'test "$(pkg-config --variable=datadir glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir')),
|
||||
'test "$(pkg-config --variable=gobject_query glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('bindir') / 'gobject-query'),
|
||||
'test "$(pkg-config --variable=glib_mkenums glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('bindir') / 'glib-mkenums'),
|
||||
'test "$(pkg-config --variable=glib_valgrind_suppressions glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir') /
|
||||
valgrind_suppression_file_install_subdir / fs.name(valgrind_suppression_file)),
|
||||
]),
|
||||
],
|
||||
suite: ['glib', 'core', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endif
|
||||
|
@ -124,3 +124,31 @@ foreach test_name, extra_args : gmodule_tests
|
||||
suite : suite,
|
||||
)
|
||||
endforeach
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
modules = [
|
||||
'gmodule-no-export-2.0',
|
||||
'gmodule-export-2.0',
|
||||
'gmodule-2.0',
|
||||
]
|
||||
|
||||
foreach module: modules
|
||||
test(module + '-pkg-config',
|
||||
bash,
|
||||
args: [
|
||||
'-xe', '-c',
|
||||
'\n'.join([
|
||||
'pkg-config --validate ' + module,
|
||||
'test "$(pkg-config --modversion @0@)" = "@1@"'.format(
|
||||
module, glib_version),
|
||||
'test "$(pkg-config --variable=prefix @0@)" = "@1@"'.format(
|
||||
module, get_option('prefix')),
|
||||
]),
|
||||
],
|
||||
suite: ['gmodule', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
@ -52,3 +52,22 @@ foreach test_name, extra_args : gthread_tests
|
||||
suite : suite,
|
||||
)
|
||||
endforeach
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
test('gthread-2.0-pkg-config',
|
||||
bash,
|
||||
args: [
|
||||
'-xe', '-c',
|
||||
'\n'.join([
|
||||
'pkg-config --validate gthread-2.0',
|
||||
'test "$(pkg-config --modversion gthread-2.0)" = "@0@"'.format(glib_version),
|
||||
'test "$(pkg-config --variable=prefix gthread-2.0)" = "@0@"'.format(
|
||||
get_option('prefix')),
|
||||
]),
|
||||
],
|
||||
suite: ['gthread', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endif
|
||||
|
@ -2287,9 +2287,11 @@ if not python_version.version_compare(python_version_req)
|
||||
endif
|
||||
|
||||
# Determine which user environment-dependent files that we want to install
|
||||
have_bash = find_program('bash', required : false).found() # For completion scripts
|
||||
bash = find_program('bash', required : false)
|
||||
have_bash = bash.found() # For completion scripts
|
||||
bash_comp_dep = dependency('bash-completion', version: '>=2.0', required: false)
|
||||
have_sh = find_program('sh', required : false).found() # For glib-gettextize
|
||||
have_pkg_config = find_program('pkg-config', required: false).found()
|
||||
|
||||
# Some installed tests require a custom environment
|
||||
env_program = find_program('env', required: installed_tests_enabled)
|
||||
|
Loading…
Reference in New Issue
Block a user