diff options
author | Thomas Haller <thaller@redhat.com> | 2021-02-20 12:37:48 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-02-24 12:48:42 +0100 |
commit | a03a03fbe9a8e8d41713b2c01ebf7a867fc7a83b (patch) | |
tree | 857d76f461e64573100a075354b2fcbf1751b90a | |
parent | 9bba4871f3d46a3eccec84ac63e053e1dd1775b9 (diff) | |
download | NetworkManager-a03a03fbe9a8e8d41713b2c01ebf7a867fc7a83b.tar.gz |
libnm/tests: add static helper library "src/libnm-client-test/"
This helper code is already used by several of our unit tests.
Compile it as a separate library.
Previously, the source code lingered unmotivated under "shared/",
which is confusing.
-rw-r--r-- | Makefile.am | 58 | ||||
-rw-r--r-- | shared/meson.build | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/tests/meson.build | 7 | ||||
-rw-r--r-- | src/libnm-client-impl/tests/test-nm-client.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/tests/test-remote-settings-client.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/tests/test-secret-agent.c | 2 | ||||
-rw-r--r-- | src/libnm-client-test/meson.build | 20 | ||||
-rw-r--r-- | src/libnm-client-test/nm-test-libnm-utils.h (renamed from shared/nm-test-libnm-utils.h) | 0 | ||||
-rw-r--r-- | src/libnm-client-test/nm-test-utils-impl.c (renamed from shared/nm-test-utils-impl.c) | 2 | ||||
-rw-r--r-- | src/meson.build | 1 |
10 files changed, 68 insertions, 28 deletions
diff --git a/Makefile.am b/Makefile.am index 3adc16a8d8..25cc08d893 100644 --- a/Makefile.am +++ b/Makefile.am @@ -748,13 +748,51 @@ EXTRA_DIST += \ ############################################################################### +noinst_LTLIBRARIES += src/libnm-client-test/libnm-client-test.la + +src_libnm_client_test_libnm_client_test_la_CPPFLAGS = \ + $(dflt_cppflags) \ + -I$(srcdir)/shared \ + -I$(builddir)/shared \ + -I$(srcdir)/src \ + -I$(builddir)/src \ + -I$(builddir)/src/libnm-core-public \ + -I$(srcdir)/src/libnm-core-public \ + -I$(srcdir)/src/libnm-client-public \ + -I$(builddir)/src/libnm-client-public \ + $(CODE_COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + $(NULL) + +src_libnm_client_test_libnm_client_test_la_SOURCES = \ + src/libnm-client-test/nm-test-libnm-utils.h \ + src/libnm-client-test/nm-test-utils-impl.c \ + $(NULL) + +src_libnm_client_test_libnm_client_test_la_LDFLAGS = \ + $(CODE_COVERAGE_LDFLAGS) \ + $(SANITIZER_LIB_LDFLAGS) \ + $(NULL) + +src_libnm_client_test_libnm_client_test_la_LIBADD = \ + $(GLIB_LIBS) \ + $(NULL) + +$(src_libnm_client_test_libnm_client_test_la_OBJECTS): $(src_libnm_core_public_mkenums_h) +$(src_libnm_client_test_libnm_client_test_la_OBJECTS): $(src_libnm_client_public_mkenums_h) + EXTRA_DIST += \ - src/libnm-glib-aux/tests/meson.build \ - shared/README.md \ + src/libnm-client-test/meson.build \ $(NULL) ############################################################################### +EXTRA_DIST += \ + src/libnm-glib-aux/tests/meson.build \ + shared/README.md \ + $(NULL) + check_programs += src/libnm-glib-aux/tests/test-shared-general src_libnm_glib_aux_tests_test_shared_general_CPPFLAGS = \ @@ -1849,6 +1887,7 @@ src_libnm_client_impl_tests_cppflags = \ $(NULL) src_libnm_client_impl_tests_ldadd = \ + src/libnm-client-test/libnm-client-test.la \ src/libnm-client-impl/libnm-client-impl.la \ $(GLIB_LIBS) \ $(NULL) @@ -1866,21 +1905,6 @@ src_libnm_client_impl_tests_test_libnm_SOURCES = \ src/libnm-client-impl/tests/test-libnm.c \ $(NULL) -src_libnm_client_impl_tests_test_nm_client_SOURCES = \ - shared/nm-test-utils-impl.c \ - shared/nm-test-libnm-utils.h \ - src/libnm-client-impl/tests/test-nm-client.c - -src_libnm_client_impl_tests_test_remote_settings_client_SOURCES = \ - shared/nm-test-utils-impl.c \ - shared/nm-test-libnm-utils.h \ - src/libnm-client-impl/tests/test-remote-settings-client.c - -src_libnm_client_impl_tests_test_secret_agent_SOURCES = \ - shared/nm-test-utils-impl.c \ - shared/nm-test-libnm-utils.h \ - src/libnm-client-impl/tests/test-secret-agent.c - src_libnm_client_impl_tests_test_libnm_LDADD = $(src_libnm_client_impl_tests_ldadd) src_libnm_client_impl_tests_test_nm_client_LDADD = $(src_libnm_client_impl_tests_ldadd) src_libnm_client_impl_tests_test_remote_settings_client_LDADD = $(src_libnm_client_impl_tests_ldadd) diff --git a/shared/meson.build b/shared/meson.build index 27d39e299b..5ed6891d34 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -12,6 +12,4 @@ glib_nm_default_dep = declare_dependency( ], ) -nm_test_utils_impl_source = files('nm-test-utils-impl.c') - nm_vpn_plugin_utils_source = files('nm-utils/nm-vpn-plugin-utils.c') diff --git a/src/libnm-client-impl/tests/meson.build b/src/libnm-client-impl/tests/meson.build index 4a58b4b5cd..b7cc0b686b 100644 --- a/src/libnm-client-impl/tests/meson.build +++ b/src/libnm-client-impl/tests/meson.build @@ -10,11 +10,7 @@ test_units = [ foreach test_unit: test_units exe = executable( test_unit, - [ - test_unit + '.c', - nm_test_utils_impl_source, - libnm_client_public_enum_sources[1], - ], + test_unit + '.c', include_directories: [ libnm_client_public_inc, ], @@ -24,6 +20,7 @@ foreach test_unit: test_units ], link_with: [ libnm_client_impl, + libnm_client_test, libnm_base, ], ) diff --git a/src/libnm-client-impl/tests/test-nm-client.c b/src/libnm-client-impl/tests/test-nm-client.c index 6085f3c53c..c76c82a1ee 100644 --- a/src/libnm-client-impl/tests/test-nm-client.c +++ b/src/libnm-client-impl/tests/test-nm-client.c @@ -8,7 +8,7 @@ #include <sys/types.h> #include <signal.h> -#include "nm-test-libnm-utils.h" +#include "libnm-client-test/nm-test-libnm-utils.h" static struct { GMainLoop *loop; diff --git a/src/libnm-client-impl/tests/test-remote-settings-client.c b/src/libnm-client-impl/tests/test-remote-settings-client.c index a9a5ccd9aa..e5415f54c0 100644 --- a/src/libnm-client-impl/tests/test-remote-settings-client.c +++ b/src/libnm-client-impl/tests/test-remote-settings-client.c @@ -10,7 +10,7 @@ #include "libnm-glib-aux/nm-time-utils.h" -#include "nm-test-libnm-utils.h" +#include "libnm-client-test/nm-test-libnm-utils.h" static struct { NMTstcServiceInfo * sinfo; diff --git a/src/libnm-client-impl/tests/test-secret-agent.c b/src/libnm-client-impl/tests/test-secret-agent.c index d3cfe80890..8f758f3dd8 100644 --- a/src/libnm-client-impl/tests/test-secret-agent.c +++ b/src/libnm-client-impl/tests/test-secret-agent.c @@ -10,7 +10,7 @@ #include "nm-secret-agent-old.h" -#include "nm-test-libnm-utils.h" +#include "libnm-client-test/nm-test-libnm-utils.h" /*****************************************************************************/ diff --git a/src/libnm-client-test/meson.build b/src/libnm-client-test/meson.build new file mode 100644 index 0000000000..acf7c39e9e --- /dev/null +++ b/src/libnm-client-test/meson.build @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +libnm_client_test = static_library( + 'nm-client-test', + sources: files( + 'nm-test-utils-impl.c', + ), + include_directories: [ + libnm_core_public_inc, + libnm_client_public_inc, + src_inc, + top_inc, + ], + dependencies: [ + libnm_core_aux_intern_dep, + libnm_core_public_dep, + libnm_glib_aux_dep, + glib_dep, + ], +) diff --git a/shared/nm-test-libnm-utils.h b/src/libnm-client-test/nm-test-libnm-utils.h index 58909304d0..58909304d0 100644 --- a/shared/nm-test-libnm-utils.h +++ b/src/libnm-client-test/nm-test-libnm-utils.h diff --git a/shared/nm-test-utils-impl.c b/src/libnm-client-test/nm-test-utils-impl.c index 705718eb57..610232b000 100644 --- a/shared/nm-test-utils-impl.c +++ b/src/libnm-client-test/nm-test-utils-impl.c @@ -10,7 +10,7 @@ #include "NetworkManager.h" #include "libnm-std-aux/nm-dbus-compat.h" -#include "nm-test-libnm-utils.h" +#include "libnm-client-test/nm-test-libnm-utils.h" #define NMTSTC_NM_SERVICE NM_BUILD_SRCDIR "/tools/test-networkmanager-service.py" diff --git a/src/meson.build b/src/meson.build index 4e7e16a1a0..24ec30fbc2 100644 --- a/src/meson.build +++ b/src/meson.build @@ -109,6 +109,7 @@ subdir('libnm-client-aux-extern') subdir('core') if enable_tests + subdir('libnm-client-test') subdir('libnm-glib-aux/tests') subdir('libnm-platform/tests') subdir('libnm-core-impl/tests') |