diff --git a/.gitignore b/.gitignore index bb3f82b514..5b752e7b1a 100644 --- a/.gitignore +++ b/.gitignore @@ -63,9 +63,11 @@ test-*.trs /clients/cli/nmcli /clients/common/settings-docs.h +/clients/common/tests/test-general +/clients/common/tests/test-libnm-core-aux +/clients/nm-online /clients/tui/newt/libnmt-newt.a /clients/tui/nmtui -/clients/nm-online /data/NetworkManager.service /data/NetworkManager-wait-online.service @@ -146,8 +148,8 @@ test-*.trs /examples/C/qt/list-connections /examples/C/qt/change-ipv4-addresses -/shared/nm-version-macros.h /shared/nm-utils/tests/test-shared-general +/shared/nm-version-macros.h /introspection/org.freedesktop.NetworkManager*.[ch] @@ -278,8 +280,6 @@ test-*.trs /src/tests/test-utils /src/tests/test-wired-defname -/clients/common/tests/test-general - /vapi/*.vapi # The following names are no longer present on this branch, diff --git a/Makefile.am b/Makefile.am index b950f8fafa..1bba093e25 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4103,6 +4103,8 @@ clients_common_tests_test_general_LDADD = \ $(clients_common_tests_test_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +############################################################################### + EXTRA_DIST += \ clients/common/tests/wg-test0.conf \ clients/common/tests/wg-test1.conf \ @@ -4110,6 +4112,40 @@ EXTRA_DIST += \ clients/common/tests/wg-test3.conf \ $(NULL) +############################################################################### + +check_programs += clients/common/tests/test-libnm-core-aux + +clients_common_tests_test_libnm_core_aux_CPPFLAGS = \ + $(dflt_cppflags) \ + -I$(builddir)/shared \ + -I$(srcdir)/shared \ + -I$(builddir)/libnm-core \ + -I$(srcdir)/libnm-core \ + -I$(builddir)/libnm \ + -I$(srcdir)/libnm \ + -DNETWORKMANAGER_COMPILATION_TEST \ + -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ + $(CODE_COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + $(NULL) + +clients_common_tests_test_libnm_core_aux_LDFLAGS = \ + $(CODE_COVERAGE_LDFLAGS) \ + $(SANITIZER_EXEC_LDFLAGS) \ + $(NULL) + +clients_common_tests_test_libnm_core_aux_LDADD = \ + shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm/libnm.la \ + shared/nm-glib-aux/libnm-glib-aux.la \ + $(GLIB_LIBS) \ + $(NULL) + +$(clients_common_tests_test_libnm_core_aux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(clients_common_tests_test_libnm_core_aux_OBJECTS): $(libnm_lib_h_pub_mkenums) + ############################################################################### # clients/cli ############################################################################### diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 3eb32a4726..88996f3a3c 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -1,23 +1,42 @@ -test_unit = 'test-general' - -deps = [ - libnm_dep, - libnmc_dep, - libnmc_base_dep, - libnm_core_dep, -] exe = executable( - 'clients-' + test_unit, - test_unit + '.c', - dependencies: deps, + 'clients-test-general', + 'test-general.c', + dependencies: [ + libnm_dep, + libnmc_dep, + libnmc_base_dep, + libnm_core_dep, + ], c_args: clients_cflags + [ '-DNETWORKMANAGER_COMPILATION_TEST', ], ) test( - 'clients/' + test_unit, + 'clients/common/tests/test-general', test_script, args: test_args + [exe.full_path()], ) + +############################################################################### + +exe = executable( + 'test-libnm-core-aux', + [ 'test-libnm-core-aux.c', ], + c_args: [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], + dependencies: [ + libnm_dep, + shared_nm_libnm_core_aux_dep, + shared_nm_libnm_core_intern_dep, + ], +) + +test( + 'clients/common/tests/test-libnm-core-aux', + test_script, + args: test_args + [exe.full_path()] +) diff --git a/clients/common/tests/test-libnm-core-aux.c b/clients/common/tests/test-libnm-core-aux.c new file mode 100644 index 0000000000..cc016a5a8a --- /dev/null +++ b/clients/common/tests/test-libnm-core-aux.c @@ -0,0 +1,35 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2019 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-libnm-core-aux/nm-libnm-core-aux.h" + +#include "nm-utils/nm-test-utils.h" + +/*****************************************************************************/ + +NMTST_DEFINE (); + +int main (int argc, char **argv) +{ + nmtst_init (&argc, &argv, TRUE); + + return g_test_run (); +} diff --git a/shared/meson.build b/shared/meson.build index 380758f00f..ba4c28c3fd 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -287,18 +287,21 @@ libnm_systemd_shared_no_logging_dep = declare_dependency( ############################################################################### -test_shared_general = executable( - 'nm-utils/tests/test-shared-general', - [ 'nm-utils/tests/test-shared-general.c', ], - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', +exe = executable( + 'nm-utils/tests/test-shared-general', + [ 'nm-utils/tests/test-shared-general.c' ], + c_args: [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', + ], + dependencies: [ + shared_nm_glib_aux_dep, + shared_c_siphash_dep, ], - dependencies: shared_nm_glib_aux_dep, - link_with: shared_c_siphash, ) + test( - 'shared/nm-utils/test-shared-general', - test_script, - args: test_args + [test_shared_general.full_path()] + 'shared/nm-utils/tests/test-shared-general', + test_script, + args: test_args + [exe.full_path()] ) diff --git a/shared/nm-utils/tests/test-shared-general.c b/shared/nm-utils/tests/test-shared-general.c index 83cffd7f3d..ddf1ef7823 100644 --- a/shared/nm-utils/tests/test-shared-general.c +++ b/shared/nm-utils/tests/test-shared-general.c @@ -461,4 +461,3 @@ int main (int argc, char **argv) return g_test_run (); } -