meson: Improve the libnm-core test build file

All variables used in every test have been moved to the start of the
build file.

Generated enum sources variable has been renamed to `enum_sources`
to clearly specify what it is holding.
This commit is contained in:
Iñigo Martínez 2019-09-09 23:04:31 +02:00 committed by Thomas Haller
parent f427f4771e
commit 1cd615288e

View file

@ -9,7 +9,7 @@
enum_types = 'nm-core-tests-enum-types' enum_types = 'nm-core-tests-enum-types'
enum = gnome.mkenums( enum_sources = gnome.mkenums(
enum_types, enum_types,
sources: 'test-general-enums.h', sources: 'test-general-enums.h',
identifier_prefix: nm_id_prefix, identifier_prefix: nm_id_prefix,
@ -17,6 +17,18 @@ enum = gnome.mkenums(
h_template: enum_types + '.h.template', h_template: enum_types + '.h.template',
) )
deps = [
libnm_core_dep,
libnm_core_nm_default_dep,
]
c_flags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
]
test_cert_dir = join_paths(meson.current_source_dir(), 'certs')
test_units = [ test_units = [
'test-compare', 'test-compare',
'test-crypto', 'test-crypto',
@ -27,24 +39,15 @@ test_units = [
'test-settings-defaults', 'test-settings-defaults',
] ]
test_cert_dir = join_paths(meson.current_source_dir(), 'certs')
deps = [
libnm_core_dep,
libnm_core_nm_default_dep,
]
foreach test_unit: test_units foreach test_unit: test_units
exe = executable( exe = executable(
'libnm-core-' + test_unit, 'libnm-core-' + test_unit,
[test_unit + '.c'] + enum, [test_unit + '.c'] + enum_sources,
dependencies: deps, dependencies: deps,
c_args: [ c_args: c_flags,
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
],
link_with: libnm_systemd_logging_stub, link_with: libnm_systemd_logging_stub,
) )
test( test(
'libnm-core/' + test_unit, 'libnm-core/' + test_unit,
test_script, test_script,