From 1cd615288e2add0f129ccf9c9de8fb47585d5dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Mon, 9 Sep 2019 23:04:31 +0200 Subject: [PATCH] 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. --- libnm-core/tests/meson.build | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 01aad44506..f91fb6ab11 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -9,7 +9,7 @@ enum_types = 'nm-core-tests-enum-types' -enum = gnome.mkenums( +enum_sources = gnome.mkenums( enum_types, sources: 'test-general-enums.h', identifier_prefix: nm_id_prefix, @@ -17,6 +17,18 @@ enum = gnome.mkenums( 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-compare', 'test-crypto', @@ -27,24 +39,15 @@ test_units = [ '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 exe = executable( 'libnm-core-' + test_unit, - [test_unit + '.c'] + enum, + [test_unit + '.c'] + enum_sources, dependencies: deps, - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', - ], + c_args: c_flags, link_with: libnm_systemd_logging_stub, ) + test( 'libnm-core/' + test_unit, test_script,