mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 10:46:59 +00:00
shared/tests: add tests for libnm-core-aux
These tests cannot (easily) be under "shared/nm-libnm-core-aux/tests" because libnm/libnm-core requires code under shared while "nm-libnm-core-aux" requires libnm/libnm-core. With autotools that is not problem, but with meson we include sub directories in a particular order and there is no way to foward declare stuff (AFAIK). To avoid the circular dependency, add the tests to "clients/common/tests", which is always built last.
This commit is contained in:
parent
911f2dfe56
commit
7a25f67af7
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -63,9 +63,11 @@ test-*.trs
|
||||||
|
|
||||||
/clients/cli/nmcli
|
/clients/cli/nmcli
|
||||||
/clients/common/settings-docs.h
|
/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/newt/libnmt-newt.a
|
||||||
/clients/tui/nmtui
|
/clients/tui/nmtui
|
||||||
/clients/nm-online
|
|
||||||
|
|
||||||
/data/NetworkManager.service
|
/data/NetworkManager.service
|
||||||
/data/NetworkManager-wait-online.service
|
/data/NetworkManager-wait-online.service
|
||||||
|
@ -146,8 +148,8 @@ test-*.trs
|
||||||
/examples/C/qt/list-connections
|
/examples/C/qt/list-connections
|
||||||
/examples/C/qt/change-ipv4-addresses
|
/examples/C/qt/change-ipv4-addresses
|
||||||
|
|
||||||
/shared/nm-version-macros.h
|
|
||||||
/shared/nm-utils/tests/test-shared-general
|
/shared/nm-utils/tests/test-shared-general
|
||||||
|
/shared/nm-version-macros.h
|
||||||
|
|
||||||
/introspection/org.freedesktop.NetworkManager*.[ch]
|
/introspection/org.freedesktop.NetworkManager*.[ch]
|
||||||
|
|
||||||
|
@ -278,8 +280,6 @@ test-*.trs
|
||||||
/src/tests/test-utils
|
/src/tests/test-utils
|
||||||
/src/tests/test-wired-defname
|
/src/tests/test-wired-defname
|
||||||
|
|
||||||
/clients/common/tests/test-general
|
|
||||||
|
|
||||||
/vapi/*.vapi
|
/vapi/*.vapi
|
||||||
|
|
||||||
# The following names are no longer present on this branch,
|
# The following names are no longer present on this branch,
|
||||||
|
|
36
Makefile.am
36
Makefile.am
|
@ -4103,6 +4103,8 @@ clients_common_tests_test_general_LDADD = \
|
||||||
|
|
||||||
$(clients_common_tests_test_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
$(clients_common_tests_test_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
clients/common/tests/wg-test0.conf \
|
clients/common/tests/wg-test0.conf \
|
||||||
clients/common/tests/wg-test1.conf \
|
clients/common/tests/wg-test1.conf \
|
||||||
|
@ -4110,6 +4112,40 @@ EXTRA_DIST += \
|
||||||
clients/common/tests/wg-test3.conf \
|
clients/common/tests/wg-test3.conf \
|
||||||
$(NULL)
|
$(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
|
# clients/cli
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
@ -1,23 +1,42 @@
|
||||||
test_unit = 'test-general'
|
|
||||||
|
|
||||||
deps = [
|
|
||||||
libnm_dep,
|
|
||||||
libnmc_dep,
|
|
||||||
libnmc_base_dep,
|
|
||||||
libnm_core_dep,
|
|
||||||
]
|
|
||||||
|
|
||||||
exe = executable(
|
exe = executable(
|
||||||
'clients-' + test_unit,
|
'clients-test-general',
|
||||||
test_unit + '.c',
|
'test-general.c',
|
||||||
dependencies: deps,
|
dependencies: [
|
||||||
|
libnm_dep,
|
||||||
|
libnmc_dep,
|
||||||
|
libnmc_base_dep,
|
||||||
|
libnm_core_dep,
|
||||||
|
],
|
||||||
c_args: clients_cflags + [
|
c_args: clients_cflags + [
|
||||||
'-DNETWORKMANAGER_COMPILATION_TEST',
|
'-DNETWORKMANAGER_COMPILATION_TEST',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'clients/' + test_unit,
|
'clients/common/tests/test-general',
|
||||||
test_script,
|
test_script,
|
||||||
args: test_args + [exe.full_path()],
|
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()]
|
||||||
|
)
|
||||||
|
|
35
clients/common/tests/test-libnm-core-aux.c
Normal file
35
clients/common/tests/test-libnm-core-aux.c
Normal file
|
@ -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 ();
|
||||||
|
}
|
|
@ -287,18 +287,21 @@ libnm_systemd_shared_no_logging_dep = declare_dependency(
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
test_shared_general = executable(
|
exe = executable(
|
||||||
'nm-utils/tests/test-shared-general',
|
'nm-utils/tests/test-shared-general',
|
||||||
[ 'nm-utils/tests/test-shared-general.c', ],
|
[ 'nm-utils/tests/test-shared-general.c' ],
|
||||||
c_args: [
|
c_args: [
|
||||||
'-DNETWORKMANAGER_COMPILATION_TEST',
|
'-DNETWORKMANAGER_COMPILATION_TEST',
|
||||||
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
|
'-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(
|
test(
|
||||||
'shared/nm-utils/test-shared-general',
|
'shared/nm-utils/tests/test-shared-general',
|
||||||
test_script,
|
test_script,
|
||||||
args: test_args + [test_shared_general.full_path()]
|
args: test_args + [exe.full_path()]
|
||||||
)
|
)
|
||||||
|
|
|
@ -461,4 +461,3 @@ int main (int argc, char **argv)
|
||||||
|
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue