diff options
author | Thomas Haller <thaller@redhat.com> | 2018-05-31 15:59:47 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-05-31 15:59:47 +0200 |
commit | cc472f52fb37cd653857e10dd24ecca5d68eb959 (patch) | |
tree | ebb49b490d1f7003df8b757935a8ed92596777b0 | |
parent | cdbd99c5d5b5a62c5d4bf4d5e7a49e97e307d987 (diff) | |
parent | f445128af4255cc1c195530bd888f2024a4f71f3 (diff) | |
download | NetworkManager-cc472f52fb37cd653857e10dd24ecca5d68eb959.tar.gz |
all: merge branch 'th/build-cleanup-defines'
https://github.com/NetworkManager/NetworkManager/pull/126
51 files changed, 626 insertions, 747 deletions
diff --git a/Makefile.am b/Makefile.am index 75283d47ae..79b046280d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,6 +81,8 @@ servicedir = $(datadir)/dbus-1/system-services completiondir = $(datadir)/bash-completion/completions +nmlocaledir = $(datadir)/locale + GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM @@ -104,6 +106,11 @@ endif ############################################################################### +nm_build_cflags = \ + -DNM_BUILD_SRCDIR=\"$(abs_srcdir)\" \ + -DNM_BUILD_BUILDDIR=\"$(abs_builddir)\" \ + $(NULL) + set_sanitizer_env = \ [ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \ if echo $(SANITIZER_LIB_CFLAGS) $(SANITIZER_EXEC_CFLAGS) | grep -e -fsanitize=address > /dev/null; then \ @@ -438,7 +445,6 @@ libnm_core_lib_h_priv = \ shared/nm-utils/nm-shared-utils.h \ shared/nm-utils/nm-random-utils.h \ shared/nm-utils/nm-udev-utils.h \ - shared/nm-utils/siphash24.h \ shared/nm-meta-setting.h \ libnm-core/crypto.h \ libnm-core/nm-connection-private.h \ @@ -577,7 +583,7 @@ libnm_core_libnm_core_la_CPPFLAGS = \ $(dflt_cppflags_libnm_core) \ -DG_LOG_DOMAIN=\""libnm"\" \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE \ - -DLOCALEDIR=\"$(datadir)/locale\" \ + -DNMLOCALEDIR=\"$(nmlocaledir)\" \ -DNMCONFDIR=\"$(nmconfdir)\" \ -DNMLIBDIR=\"$(nmlibdir)\" \ -DNMVPNDIR=\"$(pkglibdir)\" \ @@ -599,9 +605,11 @@ nodist_libnm_core_libnm_core_la_SOURCES = \ $(libnm_core_lib_c_mkenums) libnm_core_libnm_core_la_LIBADD = \ + shared/libcsiphash.la \ $(GLIB_LIBS) \ $(UUID_LIBS) \ - $(LIBUDEV_LIBS) + $(LIBUDEV_LIBS) \ + $(NULL) libnm_core_libnm_core_la_LDFLAGS = \ $(CODE_COVERAGE_LDFLAGS) \ @@ -665,9 +673,10 @@ libnm_core_tests_cppflags = \ $(dflt_cppflags_libnm_core) \ -I$(srcdir)/libnm-core/tests \ -I$(builddir)/libnm-core/tests \ + $(nm_build_cflags) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE \ - -DTEST_CERT_DIR=\"$(abs_srcdir)/libnm-core/tests/certs\" + $(NULL) libnm_core_tests_test_compare_CPPFLAGS = $(libnm_core_tests_cppflags) libnm_core_tests_test_crypto_CPPFLAGS = $(libnm_core_tests_cppflags) @@ -863,7 +872,7 @@ libnm_lib_cppflags = \ -I$(builddir)/libnm \ -DG_LOG_DOMAIN=\""libnm"\" \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM \ - -DNMRUNDIR=\"$(nmrundir)\" + $(NULL) libnminclude_HEADERS += \ $(libnm_lib_h_pub_real) @@ -1084,9 +1093,10 @@ libnm_tests_cppflags = \ $(dflt_cppflags_libnm_core) \ -I$(srcdir)/libnm \ -I$(builddir)/libnm \ + $(nm_build_cflags) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM \ - -DTEST_NM_SERVICE=\"$(abs_srcdir)/tools/test-networkmanager-service.py\" + $(NULL) libnm_tests_ldadd = \ libnm/libnm.la \ @@ -1192,7 +1202,7 @@ src_cppflags = \ -DRUNDIR=\"$(rundir)\" \ \ -DNMCONFDIR=\"$(nmconfdir)\" \ - -DNMLOCALEDIR=\"$(datadir)/locale\" \ + -DNMLOCALEDIR=\"$(nmlocaledir)\" \ -DNMPLUGINDIR=\"$(plugindir)\" \ -DNMRUNDIR=\"$(nmrundir)\" \ -DNMSTATEDIR=\"$(nmstatedir)\" \ @@ -1229,24 +1239,34 @@ noinst_LTLIBRARIES += \ ############################################################################### -shared_libcsiphash_la_CPPFLAGS = $(src_cppflags) +noinst_LTLIBRARIES += shared/libcsiphash.la + +shared_libcsiphash_la_CPPFLAGS = \ + $(CODE_COVERAGE_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + $(NULL) + shared_libcsiphash_la_SOURCES = \ shared/c-siphash/src/c-siphash.c \ shared/c-siphash/src/c-siphash.h +############################################################################### + +noinst_LTLIBRARIES += shared/libnacd.la + shared_libnacd_la_CFLAGS = -std=gnu99 + shared_libnacd_la_CPPFLAGS = \ - $(src_cppflags) \ - -I $(srcdir)/shared/c-list/src \ - -I $(srcdir)/shared/c-siphash/src + $(CODE_COVERAGE_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + -I$(srcdir)/shared/c-list/src \ + -I$(srcdir)/shared/c-siphash/src \ + $(NULL) + shared_libnacd_la_SOURCES = \ shared/n-acd/src/n-acd.c \ shared/n-acd/src/n-acd.h -noinst_LTLIBRARIES += \ - shared/libcsiphash.la \ - shared/libnacd.la - EXTRA_DIST += shared/c-list/src/c-list.h ############################################################################### @@ -1258,7 +1278,6 @@ src_libsystemd_nm_la_cppflags = \ -I$(builddir)/libnm-core \ -I$(srcdir)/src \ -I$(srcdir)/src/systemd/sd-adapt \ - -I$(srcdir)/shared/nm-utils \ -I$(srcdir)/src/systemd/src/systemd \ -I$(srcdir)/src/systemd/src/basic \ -I$(srcdir)/src/systemd/src/shared \ @@ -1305,6 +1324,7 @@ src_libsystemd_nm_la_SOURCES = \ src/systemd/sd-adapt/terminal-util.h \ src/systemd/sd-adapt/udev-util.h \ src/systemd/sd-adapt/udev.h \ + src/systemd/sd-adapt/unaligned.h \ src/systemd/sd-adapt/user-util.h \ src/systemd/sd-adapt/virt.h \ src/systemd/src/basic/alloc-util.c \ @@ -1352,6 +1372,7 @@ src_libsystemd_nm_la_SOURCES = \ src/systemd/src/basic/refcnt.h \ src/systemd/src/basic/set.h \ src/systemd/src/basic/signal-util.h \ + src/systemd/src/basic/siphash24.h \ src/systemd/src/basic/socket-util.c \ src/systemd/src/basic/socket-util.h \ src/systemd/src/basic/sparse-endian.h \ @@ -1679,7 +1700,6 @@ src_libNetworkManager_la_SOURCES = \ src_libNetworkManager_la_LIBADD = \ src/libNetworkManagerBase.la \ src/libsystemd-nm.la \ - shared/libcsiphash.la \ shared/libnacd.la \ $(GLIB_LIBS) \ $(LIBUDEV_LIBS) \ @@ -1813,7 +1833,8 @@ EXTRA_DIST += \ src_dhcp_tests_cppflags = \ $(src_tests_cppflags) \ - -DTESTDIR="\"$(abs_srcdir)/src/dhcp/tests\"" + $(nm_build_cflags) \ + $(NULL) src_dhcp_tests_ldadd = \ src/libNetworkManagerTest.la @@ -1914,8 +1935,8 @@ check_programs += src/settings/plugins/keyfile/tests/test-keyfile src_settings_plugins_keyfile_tests_test_keyfile_CPPFLAGS = \ $(src_tests_cppflags) \ - -DTEST_KEYFILES_DIR=\"$(abs_srcdir)/src/settings/plugins/keyfile/tests/keyfiles\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/src/settings/plugins/keyfile/tests/keyfiles\" + $(nm_build_cflags) \ + $(NULL) src_settings_plugins_keyfile_tests_test_keyfile_LDFLAGS = \ $(GLIB_LIBS) \ @@ -2025,10 +2046,10 @@ src_settings_plugins_ibft_tests_test_ibft_CPPFLAGS = \ -I$(srcdir)/libnm-core \ -I$(builddir)/libnm-core \ -I$(srcdir)/src \ + $(nm_build_cflags) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON \ - -DTEST_IBFT_DIR=\"$(abs_srcdir)/src/settings/plugins/ibft/tests\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/src/settings/plugins/ibft/tests\" + $(NULL) src_settings_plugins_ibft_tests_test_ibft_LDFLAGS = \ $(GLIB_LIBS) \ @@ -2166,8 +2187,8 @@ src_settings_plugins_ifcfg_rh_tests_test_ifcfg_rh_SOURCES = \ src_settings_plugins_ifcfg_rh_tests_test_ifcfg_rh_CPPFLAGS = \ $(src_tests_cppflags) \ - -DTEST_IFCFG_DIR=\"$(abs_srcdir)/src/settings/plugins/ifcfg-rh/tests\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/src/settings/plugins/ifcfg-rh/tests\" + $(nm_build_cflags) \ + $(NULL) src_settings_plugins_ifcfg_rh_tests_test_ifcfg_rh_LDFLAGS = \ $(GLIB_LIBS) \ @@ -2474,10 +2495,11 @@ src_settings_plugins_ifupdown_tests_test_ifupdown_CPPFLAGS = \ -I$(srcdir)/libnm-core \ -I$(builddir)/libnm-core \ -I$(srcdir)/src \ + $(GLIB_CFLAGS) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON \ - $(GLIB_CFLAGS) \ - -DTEST_ENI_DIR=\"$(abs_srcdir)/src/settings/plugins/ifupdown/tests\" + $(nm_build_cflags) \ + $(NULL) src_settings_plugins_ifupdown_tests_test_ifupdown_LDFLAGS = \ $(GLIB_LDFLAGS) \ @@ -2904,13 +2926,13 @@ check_programs += src/dnsmasq/tests/test-dnsmasq-utils src_dnsmasq_tests_test_dnsmasq_utils_CPPFLAGS = \ $(src_tests_cppflags) \ - -DTESTDIR="\"$(abs_srcdir)\"" + $(NULL) src_dnsmasq_tests_test_dnsmasq_utils_LDADD = \ src/libNetworkManagerTest.la src_dnsmasq_tests_test_dnsmasq_utils_LDFLAGS = \ - $(SANITIZER_EXEC_LDFLAGS) + $(SANITIZER_EXEC_LDFLAGS) $(src_dnsmasq_tests_test_dnsmasq_utils_OBJECTS): $(libnm_core_lib_h_pub_mkenums) @@ -3077,7 +3099,8 @@ check_programs += src/supplicant/tests/test-supplicant-config src_supplicant_tests_test_supplicant_config_CPPFLAGS = \ $(src_tests_cppflags) \ - -DTEST_CERT_DIR=\"$(abs_srcdir)/src/supplicant/tests/certs\" + $(nm_build_cflags) \ + $(NULL) src_supplicant_tests_test_supplicant_config_LDADD = \ src/libNetworkManagerTest.la @@ -3105,8 +3128,8 @@ src_tests_config_test_config_SOURCES = \ src_tests_config_test_config_CPPFLAGS = \ $(src_tests_cppflags) \ - -DSRCDIR=\""$(abs_srcdir)/src/tests/config"\" \ - -DBUILDDIR=\""$(abs_builddir)/src/tests/config"\" + $(nm_build_cflags) \ + $(NULL) src_tests_config_test_config_LDADD = \ src/libNetworkManagerTest.la @@ -3188,11 +3211,12 @@ src_tests_test_systemd_CPPFLAGS = \ $(src_libsystemd_nm_la_cppflags) \ -DNETWORKMANAGER_COMPILATION_TEST src_tests_test_systemd_SOURCES = \ - shared/nm-utils/siphash24.c \ src/tests/test-systemd.c src_tests_test_systemd_LDADD = \ src/libsystemd-nm.la \ - $(src_libsystemd_nm_la_libadd) + shared/libcsiphash.la \ + $(src_libsystemd_nm_la_libadd) \ + $(NULL) $(src_tests_test_systemd_OBJECTS): $(libnm_core_lib_h_pub_mkenums) @@ -3317,11 +3341,12 @@ dispatcher_tests_test_dispatcher_envp_CPPFLAGS = \ -I$(builddir)/libnm \ -I$(srcdir)/dispatcher \ -I$(builddir)/dispatcher \ - -DSRCDIR=\"$(abs_srcdir)/dispatcher/tests\" \ + $(nm_build_cflags) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ $(GLIB_CFLAGS) \ - $(SANITIZER_EXEC_CFLAGS) + $(SANITIZER_EXEC_CFLAGS) \ + $(NULL) dispatcher_tests_test_dispatcher_envp_LDFLAGS = \ $(SANITIZER_EXEC_LDFLAGS) @@ -3359,7 +3384,7 @@ clients_nm_online_CPPFLAGS = \ $(GLIB_CFLAGS) \ -DG_LOG_DOMAIN=\""nm-online"\" \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ - -DNMLOCALEDIR=\"$(datadir)/locale\" + -DNMLOCALEDIR=\"$(nmlocaledir)\" clients_nm_online_LDFLAGS = \ -Wl,--version-script="$(srcdir)/linker-script-binary.ver" @@ -3387,7 +3412,7 @@ clients_cppflags = \ -I$(srcdir)/clients/common \ -I$(builddir)/clients/common \ $(GLIB_CFLAGS) \ - -DNMLOCALEDIR=\"$(datadir)/locale\" \ + -DNMLOCALEDIR=\"$(nmlocaledir)\" \ $(NULL) check_ltlibraries += clients/common/libnmc-base.la @@ -3401,7 +3426,6 @@ clients_common_libnmc_base_la_SOURCES = \ shared/nm-utils/nm-random-utils.h \ shared/nm-utils/nm-shared-utils.c \ shared/nm-utils/nm-shared-utils.h \ - shared/nm-utils/siphash24.h \ \ clients/common/nm-secret-agent-simple.c \ clients/common/nm-secret-agent-simple.h \ @@ -3417,7 +3441,9 @@ clients_common_libnmc_base_la_CPPFLAGS = \ clients_common_libnmc_base_la_LIBADD = \ libnm/libnm.la \ - $(GLIB_LIBS) + shared/libcsiphash.la \ + $(GLIB_LIBS) \ + $(NULL) $(clients_common_libnmc_base_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) $(clients_common_libnmc_base_la_OBJECTS): $(libnm_lib_h_pub_mkenums) @@ -3541,7 +3567,7 @@ clients_cli_nmcli_CPPFLAGS = \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DG_LOG_DOMAIN=\""nmcli"\" \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ - -DNMCLI_LOCALEDIR=\"$(datadir)/locale\" + -DNMLOCALEDIR=\"$(nmlocaledir)\" clients_cli_nmcli_LDADD = \ libnm/libnm.la \ @@ -3747,7 +3773,7 @@ clients_tui_nmtui_CPPFLAGS = \ $(NEWT_CFLAGS) \ -DG_LOG_DOMAIN=\""nmtui"\" \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ - -DLOCALEDIR=\""$(localedir)"\" + -DNMLOCALEDIR=\""$(nmlocaledir)"\" clients_tui_nmtui_LDFLAGS = \ -Wl,--version-script="$(srcdir)/linker-script-binary.ver" \ @@ -3908,7 +3934,7 @@ libnm_util_cppflags = \ -I$(builddir)/shared \ -DG_LOG_DOMAIN=\""libnm-util"\" \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL \ - -DLOCALEDIR=\"$(datadir)/locale\" \ + -DNMLOCALEDIR=\"$(nmlocaledir)\" \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(UUID_CFLAGS) @@ -4120,11 +4146,11 @@ libnm_util_tests_cppflags = \ -I$(builddir)/libnm-util \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DBUILD_DIR=\"$(abs_builddir)/libnm-util/tests\" \ - -DTEST_CERT_DIR=\"$(abs_srcdir)/libnm-core/tests/certs\" \ + $(nm_build_cflags) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL \ - $(SANITIZER_EXEC_CFLAGS) + $(SANITIZER_EXEC_CFLAGS) \ + $(NULL) libnm_util_tests_ldadd = \ libnm-util/libnm-util.la \ @@ -4336,7 +4362,7 @@ nodist_libnm_glib_libnm_glib_la_SOURCES = \ libnm_glib_libnm_glib_la_CPPFLAGS = \ $(libnm_glib_cppflags) \ $(LIBUDEV_CFLAGS) \ - -DNMRUNDIR=\"$(nmrundir)\" + $(NULL) libnm_glib_libnm_glib_la_LDFLAGS = \ -Wl,--version-script=$(srcdir)/libnm-glib/libnm-glib.ver \ @@ -4477,11 +4503,12 @@ libnm_glib_tests_cppflags = \ -I$(srcdir)/libnm-util \ -I$(builddir)/libnm-util \ -I$(srcdir)/libnm-glib \ + $(nm_build_cflags) \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB \ - -DTEST_NM_SERVICE=\"$(abs_srcdir)/tools/test-networkmanager-service.py\" \ $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) + $(DBUS_CFLAGS) \ + $(NULL) libnm_glib_tests_programs_req_introspection = \ libnm-glib/tests/test-nm-client \ @@ -4768,8 +4795,6 @@ EXTRA_DIST += \ shared/nm-utils/nm-vpn-plugin-macros.h \ shared/nm-utils/nm-vpn-plugin-utils.c \ shared/nm-utils/nm-vpn-plugin-utils.h \ - shared/nm-utils/siphash24.c \ - shared/nm-utils/siphash24.h \ shared/nm-utils/unaligned.h \ shared/nm-version-macros.h.in \ shared/meson.build \ diff --git a/clients/cli/meson.build b/clients/cli/meson.build index b7f5e19360..9449ce63c0 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -29,7 +29,7 @@ deps = [ cflags = clients_cflags + [ '-DSYSCONFDIR="@0@"'.format(nm_sysconfdir), '-DG_LOG_DOMAIN="@0@"'.format(name), - '-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir) + '-DNMLOCALEDIR="@0@"'.format(nm_localedir) ] if enable_polkit_agent diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index 24fa37c638..e9752952d5 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -950,7 +950,7 @@ main (int argc, char *argv[]) #ifdef GETTEXT_PACKAGE /* Set i18n stuff */ - bindtextdomain (GETTEXT_PACKAGE, NMCLI_LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif diff --git a/clients/common/meson.build b/clients/common/meson.build index ea26bccfb4..f0c8160083 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -11,15 +11,13 @@ cflags = clients_cflags + [ '-DG_LOG_DOMAIN="libnmc"', ] -sources = shared_utils + files( - 'nm-client-utils.c', - 'nm-secret-agent-simple.c', - 'nm-vpn-helpers.c' -) - libnmc_base = static_library( 'nmc-base', - sources: sources, + sources: shared_files_clients_common + files( + 'nm-client-utils.c', + 'nm-secret-agent-simple.c', + 'nm-vpn-helpers.c', + ), dependencies: deps, c_args: cflags ) @@ -29,11 +27,6 @@ libnmc_base_dep = declare_dependency( link_with: libnmc_base ) -sources = shared_meta_setting + files( - 'nm-meta-setting-access.c', - 'nm-meta-setting-desc.c' -) - settings_docs = 'settings-docs.h' if enable_introspection @@ -60,11 +53,13 @@ else configuration: configuration_data() ) endif -sources += settings_docs_source libnmc = static_library( 'nmc', - sources: sources, + sources: files( + 'nm-meta-setting-access.c', + 'nm-meta-setting-desc.c' + ) + shared_nm_utils_nm_meta_setting_c + [settings_docs_source], dependencies: deps, c_args: cflags, link_with: libnmc_base, diff --git a/clients/tui/meson.build b/clients/tui/meson.build index dd472998da..40eb4b4ac7 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -7,7 +7,7 @@ deps = [ cflags = clients_cflags + [ '-DG_LOG_DOMAIN="@0@"'.format(name), - '-DLOCALEDIR="@0@"'.format(nm_localedir) + '-DNMLOCALEDIR="@0@"'.format(nm_localedir) ] subdir('newt') diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c index f6994f69fc..97c528e705 100644 --- a/clients/tui/nmtui.c +++ b/clients/tui/nmtui.c @@ -226,7 +226,7 @@ main (int argc, char **argv) int i; setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build index 1368a1f33c..6ead88bf87 100644 --- a/dispatcher/tests/meson.build +++ b/dispatcher/tests/meson.build @@ -5,18 +5,16 @@ incs = [ libnm_inc ] -cflags = [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', - '-DSRCDIR="@0@"'.format(meson.current_source_dir()), -] - exe = executable( test_unit, test_unit + '.c', include_directories: incs, dependencies: nm_core_dep, - c_args: cflags, + c_args: [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ] + + nm_build_cflags, link_with: libnm_dispatcher_core ) diff --git a/dispatcher/tests/test-dispatcher-envp.c b/dispatcher/tests/test-dispatcher-envp.c index 6316cd5706..1203c6ac04 100644 --- a/dispatcher/tests/test-dispatcher-envp.c +++ b/dispatcher/tests/test-dispatcher-envp.c @@ -29,6 +29,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_DIR NM_BUILD_SRCDIR"/dispatcher/tests" + /*****************************************************************************/ static void @@ -525,8 +527,7 @@ test_generic (const char *file, const char *override_vpn_ip_iface) gs_strfreev char **denv = NULL; char **iter; - /* Read in the test file */ - p = g_build_filename (SRCDIR, file, NULL); + p = g_build_filename (TEST_DIR, file, NULL); success = get_dispatcher_file (p, &con_dict, &con_props, diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 9d49edaeb8..7b14370650 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -131,14 +131,15 @@ deps = [ dl_dep, libudev_dep, shared_dep, - uuid_dep + uuid_dep, + shared_c_siphash_dep, ] cflags = [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', '-DLIBEXECDIR="@0@"'.format(nm_libexecdir), - '-DLOCALEDIR="@0@"'.format(nm_localedir), + '-DNMLOCALEDIR="@0@"'.format(nm_localedir), '-DNMCONFDIR="@0@"'.format(nm_pkgconfdir), '-DNMLIBDIR="@0@"'.format(nm_pkglibdir), '-DNMPLUGINDIR="@0@"'.format(nm_plugindir), @@ -150,9 +151,15 @@ if enable_json_validation deps += jansson_dep endif +libnm_core_sources_all = libnm_core_sources +libnm_core_sources_all += libnm_core_enum +libnm_core_sources_all += shared_nm_utils_nm_meta_setting_c +libnm_core_sources_all += shared_files_libnm_core +libnm_core_sources_all += [version_header] + libnm_core = static_library( 'nm-core', - sources: libnm_core_sources + libnm_core_enum + shared_sources + [version_header], + sources: libnm_core_sources_all, dependencies: deps, c_args: cflags ) @@ -160,7 +167,10 @@ libnm_core = static_library( nm_core_dep = declare_dependency( sources: libnm_core_enum[1], include_directories: libnm_core_inc, - dependencies: shared_dep + dependencies: [ + shared_dep, + shared_c_siphash_dep, + ], ) enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl') diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index c5af2e33e1..eb65f8db7d 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -249,7 +249,7 @@ _nm_utils_init (void) g_error ("libnm-util symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported"); g_module_close (self); - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); _nm_dbus_errors_init (); diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 6e8a2493d8..2eeadd8825 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -29,18 +29,16 @@ test_units = [ test_cert_dir = join_paths(meson.current_source_dir(), 'certs') -cflags = [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', - '-DTEST_CERT_DIR="@0@"'.format(test_cert_dir), -] - foreach test_unit: test_units exe = executable( 'libnm-core-' + test_unit, [test_unit + '.c'] + enum, dependencies: nm_core_dep, - c_args: cflags, + c_args: [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', + ] + + nm_build_cflags, link_with: libnm_core ) test( diff --git a/libnm-core/tests/test-crypto.c b/libnm-core/tests/test-crypto.c index 0c2ef48a51..fb99ffea72 100644 --- a/libnm-core/tests/test-crypto.c +++ b/libnm-core/tests/test-crypto.c @@ -35,6 +35,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" + #if 0 static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----"; static const char *pem_rsa_key_end = "-----END RSA PRIVATE KEY-----"; diff --git a/libnm-core/tests/test-keyfile.c b/libnm-core/tests/test-keyfile.c index efb8d9599c..672c72b63d 100644 --- a/libnm-core/tests/test-keyfile.c +++ b/libnm-core/tests/test-keyfile.c @@ -33,6 +33,7 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" #define TEST_WIRED_TLS_CA_CERT TEST_CERT_DIR"/test-ca-cert.pem" #define TEST_WIRED_TLS_PRIVKEY TEST_CERT_DIR"/test-key-and-cert.pem" diff --git a/libnm-core/tests/test-secrets.c b/libnm-core/tests/test-secrets.c index 2c9320768d..d31c43d2ce 100644 --- a/libnm-core/tests/test-secrets.c +++ b/libnm-core/tests/test-secrets.c @@ -40,7 +40,8 @@ #include "nm-utils/nm-test-utils.h" -#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" +#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem" #define TEST_NEED_SECRETS_EAP_TLS_CLIENT_CERT TEST_CERT_DIR "/test_key_and_cert.pem" #define TEST_NEED_SECRETS_EAP_TLS_PRIVATE_KEY TEST_CERT_DIR "/test_key_and_cert.pem" diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c index 7f9865c4a6..6c5c6ad97e 100644 --- a/libnm-core/tests/test-setting.c +++ b/libnm-core/tests/test-setting.c @@ -37,6 +37,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" + /*****************************************************************************/ static void diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build index 9583362b61..fabd881874 100644 --- a/libnm-glib/meson.build +++ b/libnm-glib/meson.build @@ -79,13 +79,6 @@ sources = files( glue = 'nm-vpn-plugin-glue.h' -sources += custom_target( - glue, - input: ifaces_vpn_plugin_xml, - output: glue, - command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'] -) - enum_types = 'nm-vpn-enum-types' libnm_glib_vpn_enum = gnome.mkenums( @@ -104,7 +97,18 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver') libnm_glib_vpn = shared_library( 'nm-glib-vpn', - sources: sources + libnm_glib_vpn_enum, + sources: files( + 'nm-vpn-plugin.c', + 'nm-vpn-plugin-ui-interface.c', + 'nm-vpn-plugin-utils.c', + ) + [ + custom_target( + glue, + input: ifaces_vpn_plugin_xml, + output: glue, + command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'], + ), + ] + libnm_glib_vpn_enum, version: libnm_glib_vpn_version, dependencies: deps, c_args: cflags, @@ -131,7 +135,7 @@ pkg.generate( variables: 'exec_prefix=${prefix}' ) -sources = shared_udev_utils + files( +libnm_glib_sources = shared_files_libnm_glib + files( 'nm-access-point.c', 'nm-active-connection.c', 'nm-client.c', @@ -194,12 +198,10 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver') libnm_glib = shared_library( 'nm-glib', - sources: sources + libnm_glib_enum + [nm_secret_agent_glue], + sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue], version: libnm_glib_version, dependencies: deps, - c_args: cflags + [ - '-DNMRUNDIR="@0@"'.format(nm_pkgrundir), - ], + c_args: cflags, link_whole: libdeprecated_nm_glib, link_args: [ '-Wl,--version-script,@0@'.format(linker_script), @@ -225,7 +227,7 @@ pkg.generate( ) if enable_introspection - gir_sources = sources + headers + libnm_glib_enum + gir_sources = libnm_glib_sources + headers + libnm_glib_enum deps = [ dbus_glib_dep, diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build index 029b3c20c5..3477901817 100644 --- a/libnm-glib/tests/meson.build +++ b/libnm-glib/tests/meson.build @@ -14,12 +14,13 @@ test_units = [ foreach test_unit: test_units exe = executable( test_unit, - [test_unit + '.c'] + shared_test_utils, + [test_unit + '.c'] + shared_nm_test_utils_impl_c, dependencies: deps, - c_args: common_cflags + [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')), - ], + c_args: + common_cflags + [ + '-DNETWORKMANAGER_COMPILATION_TEST', + ] + + nm_build_cflags, ) test( diff --git a/libnm-util/meson.build b/libnm-util/meson.build index b385e32b85..55df550175 100644 --- a/libnm-util/meson.build +++ b/libnm-util/meson.build @@ -55,7 +55,7 @@ libnm_utils_enum = gnome.mkenums( install_dir: nm_pkgincludedir ) -sources = shared_utils + files( +sources = files( 'crypto.c', 'crypto_' + crypto + '.c', 'nm-connection.c', @@ -90,6 +90,7 @@ sources = shared_utils + files( 'nm-utils.c', 'nm-value-transforms.c' ) +sources += shared_files_libnm_util deps = [ crypto_dep, @@ -101,7 +102,7 @@ deps = [ common_cflags = [ '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL', - '-DLOCALEDIR="@0@"'.format(nm_localedir), + '-DNMLOCALEDIR="@0@"'.format(nm_localedir), ] cflags = common_cflags + [ diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 54e0cc9a82..2af9432fee 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -232,7 +232,7 @@ nm_utils_init (GError **error) if (!initialized) { initialized = TRUE; - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!crypto_init (error)) diff --git a/libnm-util/tests/meson.build b/libnm-util/tests/meson.build index 63535033f1..cf46ad1402 100644 --- a/libnm-util/tests/meson.build +++ b/libnm-util/tests/meson.build @@ -6,10 +6,8 @@ deps = [ ] cflags = common_cflags + [ - '-DBUILD_DIR="@0@"'.format(meson.current_build_dir()), - '-DTEST_CERT_DIR="@0@"'.format(test_cert_dir), '-DNETWORKMANAGER_COMPILATION_TEST', -] +] + nm_build_cflags test = 'test-libnm-linking' diff --git a/libnm-util/tests/test-crypto.c b/libnm-util/tests/test-crypto.c index 83a183dd18..61bd977456 100644 --- a/libnm-util/tests/test-crypto.c +++ b/libnm-util/tests/test-crypto.c @@ -33,6 +33,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" + #if 0 static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----"; static const char *pem_rsa_key_end = "-----END RSA PRIVATE KEY-----"; diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 74eb7cdd9a..304797a927 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -2428,7 +2428,8 @@ test_libnm_linking (void) int status; GError *error = NULL; - g_spawn_sync (BUILD_DIR, argv, NULL, 0 /*G_SPAWN_DEFAULT*/, + g_spawn_sync (NM_BUILD_BUILDDIR"/libnm-util/tests", + argv, NULL, 0 /*G_SPAWN_DEFAULT*/, _test_libnm_linking_setup_child_process, NULL, &out, &err, &status, &error); g_assert_no_error (error); diff --git a/libnm-util/tests/test-secrets.c b/libnm-util/tests/test-secrets.c index 2631509cf3..43c206ff76 100644 --- a/libnm-util/tests/test-secrets.c +++ b/libnm-util/tests/test-secrets.c @@ -39,7 +39,8 @@ #include "nm-utils/nm-test-utils.h" -#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" +#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem" #define TEST_NEED_SECRETS_EAP_TLS_CLIENT_CERT TEST_CERT_DIR "/test_key_and_cert.pem" #define TEST_NEED_SECRETS_EAP_TLS_PRIVATE_KEY TEST_CERT_DIR "/test_key_and_cert.pem" diff --git a/libnm-util/tests/test-setting-8021x.c b/libnm-util/tests/test-setting-8021x.c index a0219639c5..373b2a757d 100644 --- a/libnm-util/tests/test-setting-8021x.c +++ b/libnm-util/tests/test-setting-8021x.c @@ -29,6 +29,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" + static void compare_blob_data (const char *test, const char *key_path, diff --git a/libnm/meson.build b/libnm/meson.build index 69d8bce076..91fe972e10 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -10,7 +10,6 @@ deps = [ cflags = [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', - '-DNMRUNDIR="@0@"'.format(nm_pkgrundir) ] if have_fake_typelibs diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index c47814b336..e2b882733d 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -1,28 +1,28 @@ test_units = [ - ['test-general', shared_utils, [libnm_utils]], - ['test-nm-client', shared_test_utils, []], - ['test-remote-settings-client', shared_test_utils, []], - ['test-secret-agent', shared_test_utils, []] -] - -deps = [ - libnm_dep, - nm_core_dep + ['test-general', [libnm_utils, libnm_core]], + ['test-nm-client', []], + ['test-remote-settings-client', []], + ['test-secret-agent', []], ] cflags = [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', - '-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')) -] +] + nm_build_cflags foreach test_unit: test_units exe = executable( 'libnm-' + test_unit[0], - [test_unit[0] + '.c'] + test_unit[1], - dependencies: deps, + [ + test_unit[0] + '.c', + shared_nm_test_utils_impl_c, + ], + dependencies: [ + libnm_dep, + nm_core_dep, + ], c_args: cflags, - link_with: test_unit[2] + link_with: test_unit[1] ) test( @@ -35,7 +35,7 @@ endforeach # just test, that we can build "nm-vpn-plugin-utils.c" libnm_vpn_plugin_utils_test = static_library( 'nm-vpn-plugin-utils-test', - sources: shared_vpn_plugin_utils + [libnm_enum[1]], + sources: shared_nm_utils_nm_vpn_plugin_utils_c + [libnm_enum[1]], include_directories: libnm_inc, dependencies: nm_core_dep, c_args: cflags diff --git a/meson.build b/meson.build index ff87b31e7d..8afe57d140 100644 --- a/meson.build +++ b/meson.build @@ -54,6 +54,11 @@ nm_pkgstatedir = join_paths(nm_localstatedir, nm_name) nm_vpndir = join_paths(nm_libdir, nm_name) nm_plugindir = join_paths(nm_libdir, nm_name, dist_version) +nm_build_cflags = [ + '-DNM_BUILD_SRCDIR="@0@"'.format(meson.source_root()), + '-DNM_BUILD_BUILDDIR="@0@"'.format(meson.build_root()), +] + libnm_name = 'libnm' current = 1 diff --git a/shared/meson.build b/shared/meson.build index a812b5882a..db6b8a40d8 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -1,70 +1,78 @@ -shared_c_list_dep = declare_dependency( - include_directories: include_directories('c-list/src') -) +shared_inc = include_directories('.') shared_c_siphash = static_library( 'c-siphash', - sources: ['c-siphash/src/c-siphash.c'] + sources: 'c-siphash/src/c-siphash.c', ) shared_c_siphash_dep = declare_dependency( - include_directories: include_directories('c-siphash/src'), - link_with: shared_c_siphash + include_directories: shared_inc, + link_with: shared_c_siphash, ) shared_n_acd = static_library( 'n-acd', - sources: ['n-acd/src/n-acd.c'], - dependencies: [ shared_c_siphash_dep, shared_c_list_dep ] + sources: 'n-acd/src/n-acd.c', + include_directories: [ + include_directories('c-siphash/src'), + include_directories('c-list/src'), + ], + dependencies: shared_c_siphash_dep, ) shared_n_acd_dep = declare_dependency( - include_directories: include_directories('.'), + include_directories: shared_inc, link_with: shared_n_acd, ) -shared_inc = include_directories('.') - version_conf = configuration_data() version_conf.set('NM_MAJOR_VERSION', nm_major_version) version_conf.set('NM_MINOR_VERSION', nm_minor_version) version_conf.set('NM_MICRO_VERSION', nm_micro_version) -version = 'nm-version-macros.h' - version_header = configure_file( - input: version + '.in', - output: version, - configuration: version_conf + input: 'nm-version-macros.h.in', + output: 'nm-version-macros.h', + configuration: version_conf, ) -shared_meta_setting = files('nm-meta-setting.c') +shared_nm_utils_nm_meta_setting_c = files('nm-meta-setting.c') -shared_test_utils = files('nm-test-utils-impl.c') +shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c') -shared_siphash = files('nm-utils/siphash24.c') +shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c') -shared_udev_utils = files('nm-utils/nm-udev-utils.c') +shared_files_libnm_core = files(''' + c-siphash/src/c-siphash.c + nm-utils/c-list-util.c + nm-utils/nm-dedup-multi.c + nm-utils/nm-enum-utils.c + nm-utils/nm-hash-utils.c + nm-utils/nm-random-utils.c + nm-utils/nm-shared-utils.c + nm-utils/nm-udev-utils.c +'''.split()) -shared_utils = files( - 'nm-utils/nm-enum-utils.c', - 'nm-utils/nm-hash-utils.c', - 'nm-utils/nm-random-utils.c', - 'nm-utils/nm-shared-utils.c' -) +shared_files_clients_common = files(''' + c-siphash/src/c-siphash.c + nm-utils/nm-enum-utils.c + nm-utils/nm-hash-utils.c + nm-utils/nm-random-utils.c + nm-utils/nm-shared-utils.c +'''.split()) -shared_vpn_plugin_utils = files('nm-utils/nm-vpn-plugin-utils.c') +shared_files_libnm_util = files(''' + nm-utils/nm-shared-utils.c +'''.split()) -shared_sources = shared_utils + shared_meta_setting + shared_udev_utils + files( - 'nm-utils/c-list-util.c', - 'nm-utils/nm-dedup-multi.c' -) +shared_files_libnm_glib = files(''' + nm-utils/nm-udev-utils.c +'''.split()) shared_dep = declare_dependency( - include_directories: [ - top_inc, - shared_inc, - include_directories('nm-utils') - ], - dependencies: glib_dep + include_directories: [ + top_inc, + shared_inc, + ], + dependencies: glib_dep, ) diff --git a/shared/nm-test-utils-impl.c b/shared/nm-test-utils-impl.c index 6d6e54c17f..3add88c792 100644 --- a/shared/nm-test-utils-impl.c +++ b/shared/nm-test-utils-impl.c @@ -28,6 +28,8 @@ #include "nm-test-libnm-utils.h" +#define NMTSTC_NM_SERVICE NM_BUILD_SRCDIR"/tools/test-networkmanager-service.py" + /*****************************************************************************/ static gboolean @@ -116,7 +118,7 @@ nmtstc_service_available (NMTstcServiceInfo *info) /* This happens, when test-networkmanager-service.py exits with 77 status * code. */ - m = g_strdup_printf ("missing dependency for running NetworkManager stub service %s", TEST_NM_SERVICE); + m = g_strdup_printf ("missing dependency for running NetworkManager stub service %s", NMTSTC_NM_SERVICE); g_test_skip (m); return NULL; } @@ -125,7 +127,7 @@ NMTstcServiceInfo * nmtstc_service_init (void) { NMTstcServiceInfo *info; - const char *args[] = { TEST_NM_PYTHON, TEST_NM_SERVICE, NULL }; + const char *args[] = { TEST_NM_PYTHON, NMTSTC_NM_SERVICE, NULL }; GError *error = NULL; info = g_malloc0 (sizeof (*info)); @@ -170,7 +172,7 @@ nmtstc_service_init (void) g_main_context_unref (context); if (had_timeout) - g_error ("test service %s did not start in time", TEST_NM_SERVICE); + g_error ("test service %s did not start in time", NMTSTC_NM_SERVICE); if (!data.name_found) { g_assert (data.exited); info->pid = NM_PID_T_INVAL; @@ -184,7 +186,7 @@ nmtstc_service_init (void) * via pygobject. */ return NULL; } - g_error ("test service %s exited with error code %d", TEST_NM_SERVICE, data.exit_code); + g_error ("test service %s exited with error code %d", NMTSTC_NM_SERVICE, data.exit_code); } } diff --git a/shared/nm-utils/nm-hash-utils.c b/shared/nm-utils/nm-hash-utils.c index 8d8c21ce55..4bc12b7c3a 100644 --- a/shared/nm-utils/nm-hash-utils.c +++ b/shared/nm-utils/nm-hash-utils.c @@ -28,8 +28,6 @@ #include "nm-shared-utils.h" #include "nm-random-utils.h" -#include "siphash24.c" - /*****************************************************************************/ #define HASH_KEY_SIZE 16u @@ -49,7 +47,7 @@ _get_hash_key_init (void) } g_arr _nm_alignas (guint64); static gsize g_lock; const guint8 *g; - struct siphash siph_state; + CSipHash siph_state; uint64_t h; guint *p; @@ -66,9 +64,9 @@ _get_hash_key_init (void) /* use siphash() of the key-size, to mangle the first guint. Otherwise, * the first guint has only the entropy that nm_utils_random_bytes() * generated for the first 4 bytes and relies on a good random generator. */ - siphash24_init (&siph_state, g_arr.v8); - siphash24_compress (g_arr.v8, sizeof (g_arr.v8), &siph_state); - h = siphash24_finalize (&siph_state); + c_siphash_init (&siph_state, g_arr.v8); + c_siphash_append (&siph_state, g_arr.v8, sizeof (g_arr.v8)); + h = c_siphash_finalize (&siph_state); p = (guint *) g_arr.v8; if (sizeof (guint) < sizeof (h)) *p = *p ^ ((guint) (h & 0xFFFFFFFFu)) ^ ((guint) (h >> 32)); @@ -97,10 +95,10 @@ guint nm_hash_static (guint static_seed) { /* note that we only xor the static_seed with the key. - * We don't use siphash24(), which would mix the bits better. + * We don't use siphash, which would mix the bits better. * Note that this doesn't matter, because static_seed is not * supposed to be a value that you are hashing (for that, use - * full siphash24()). + * full siphash). * Instead, different callers may set a different static_seed * so that nm_hash_str(NULL) != nm_hash_ptr(NULL). * @@ -121,7 +119,7 @@ nm_hash_init (NMHashState *state, guint static_seed) g = _get_hash_key (); memcpy (seed, g, HASH_KEY_SIZE); seed[0] ^= static_seed; - siphash24_init (&state->_state, (const guint8 *) seed); + c_siphash_init (&state->_state, (const guint8 *) seed); } guint diff --git a/shared/nm-utils/nm-hash-utils.h b/shared/nm-utils/nm-hash-utils.h index 3bd3f652fb..b7742e0fe3 100644 --- a/shared/nm-utils/nm-hash-utils.h +++ b/shared/nm-utils/nm-hash-utils.h @@ -22,11 +22,11 @@ #ifndef __NM_HASH_UTILS_H__ #define __NM_HASH_UTILS_H__ -#include "siphash24.h" +#include "c-siphash/src/c-siphash.h" #include "nm-macros-internal.h" struct _NMHashState { - struct siphash _state; + CSipHash _state; }; typedef struct _NMHashState NMHashState; @@ -42,7 +42,7 @@ nm_hash_complete (NMHashState *state) nm_assert (state); - h = siphash24_finalize (&state->_state); + h = c_siphash_finalize (&state->_state); /* we don't ever want to return a zero hash. * @@ -57,7 +57,7 @@ nm_hash_update (NMHashState *state, const void *ptr, gsize n) nm_assert (ptr); nm_assert (n > 0); - siphash24_compress (ptr, n, &state->_state); + c_siphash_append (&state->_state, ptr, n); } #define nm_hash_update_val(state, val) \ @@ -168,7 +168,7 @@ nm_hash_update_mem (NMHashState *state, const void *ptr, gsize n) * instead. */ nm_hash_update (state, &n, sizeof (n)); if (n > 0) - siphash24_compress (ptr, n, &state->_state); + c_siphash_append (&state->_state, ptr, n); } static inline void diff --git a/shared/nm-utils/siphash24.c b/shared/nm-utils/siphash24.c deleted file mode 100644 index 8e59afb2c2..0000000000 --- a/shared/nm-utils/siphash24.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - SipHash reference C implementation - - Written in 2012 by - Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com> - Daniel J. Bernstein <djb@cr.yp.to> - - To the extent possible under law, the author(s) have dedicated all copyright - and related and neighboring rights to this software to the public domain - worldwide. This software is distributed without any warranty. - - You should have received a copy of the CC0 Public Domain Dedication along with - this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. - - (Minimal changes made by Lennart Poettering, to make clean for inclusion in systemd) - (Refactored by Tom Gundersen to split up in several functions and follow systemd - coding style) -*/ - -#include "nm-default.h" - -#define assert(cond) nm_assert (cond) -#define _fallthrough_ _nm_fallthrough - -#include <stdio.h> - -#include "siphash24.h" -#include "unaligned.h" - -static inline uint64_t rotate_left(uint64_t x, uint8_t b) { - assert(b < 64); - - return (x << b) | (x >> (64 - b)); -} - -static inline void sipround(struct siphash *state) { - assert(state); - - state->v0 += state->v1; - state->v1 = rotate_left(state->v1, 13); - state->v1 ^= state->v0; - state->v0 = rotate_left(state->v0, 32); - state->v2 += state->v3; - state->v3 = rotate_left(state->v3, 16); - state->v3 ^= state->v2; - state->v0 += state->v3; - state->v3 = rotate_left(state->v3, 21); - state->v3 ^= state->v0; - state->v2 += state->v1; - state->v1 = rotate_left(state->v1, 17); - state->v1 ^= state->v2; - state->v2 = rotate_left(state->v2, 32); -} - -void siphash24_init(struct siphash *state, const uint8_t k[16]) { - uint64_t k0, k1; - - assert(state); - assert(k); - - k0 = unaligned_read_le64(k); - k1 = unaligned_read_le64(k + 8); - - *state = (struct siphash) { - /* "somepseudorandomlygeneratedbytes" */ - .v0 = 0x736f6d6570736575ULL ^ k0, - .v1 = 0x646f72616e646f6dULL ^ k1, - .v2 = 0x6c7967656e657261ULL ^ k0, - .v3 = 0x7465646279746573ULL ^ k1, - .padding = 0, - .inlen = 0, - }; -} - -void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) { - - const uint8_t *in = _in; - const uint8_t *end = in + inlen; - size_t left = state->inlen & 7; - uint64_t m; - - assert(in); - assert(state); - - /* Update total length */ - state->inlen += inlen; - - /* If padding exists, fill it out */ - if (left > 0) { - for ( ; in < end && left < 8; in ++, left ++) - state->padding |= ((uint64_t) *in) << (left * 8); - - if (in == end && left < 8) - /* We did not have enough input to fill out the padding completely */ - return; - -#ifdef DEBUG - printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); - printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); - printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); - printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); - printf("(%3zu) compress padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t)state->padding); -#endif - - state->v3 ^= state->padding; - sipround(state); - sipround(state); - state->v0 ^= state->padding; - - state->padding = 0; - } - - end -= (state->inlen % sizeof(uint64_t)); - - for ( ; in < end; in += 8) { - m = unaligned_read_le64(in); -#ifdef DEBUG - printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); - printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); - printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); - printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); - printf("(%3zu) compress %08x %08x\n", state->inlen, (uint32_t) (m >> 32), (uint32_t) m); -#endif - state->v3 ^= m; - sipround(state); - sipround(state); - state->v0 ^= m; - } - - left = state->inlen & 7; - switch (left) { - case 7: - state->padding |= ((uint64_t) in[6]) << 48; - _fallthrough_; - case 6: - state->padding |= ((uint64_t) in[5]) << 40; - _fallthrough_; - case 5: - state->padding |= ((uint64_t) in[4]) << 32; - _fallthrough_; - case 4: - state->padding |= ((uint64_t) in[3]) << 24; - _fallthrough_; - case 3: - state->padding |= ((uint64_t) in[2]) << 16; - _fallthrough_; - case 2: - state->padding |= ((uint64_t) in[1]) << 8; - _fallthrough_; - case 1: - state->padding |= ((uint64_t) in[0]); - _fallthrough_; - case 0: - break; - } -} - -uint64_t siphash24_finalize(struct siphash *state) { - uint64_t b; - - assert(state); - - b = state->padding | (((uint64_t) state->inlen) << 56); - -#ifdef DEBUG - printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); - printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); - printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); - printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); - printf("(%3zu) padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t) state->padding); -#endif - - state->v3 ^= b; - sipround(state); - sipround(state); - state->v0 ^= b; - -#ifdef DEBUG - printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); - printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); - printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); - printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); -#endif - state->v2 ^= 0xff; - - sipround(state); - sipround(state); - sipround(state); - sipround(state); - - return state->v0 ^ state->v1 ^ state->v2 ^ state->v3; -} - -uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]) { - struct siphash state; - - assert(in); - assert(k); - - siphash24_init(&state, k); - siphash24_compress(in, inlen, &state); - - return siphash24_finalize(&state); -} diff --git a/shared/nm-utils/siphash24.h b/shared/nm-utils/siphash24.h deleted file mode 100644 index 54e2420cc6..0000000000 --- a/shared/nm-utils/siphash24.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include <inttypes.h> -#include <stddef.h> -#include <stdint.h> -#include <sys/types.h> - -struct siphash { - uint64_t v0; - uint64_t v1; - uint64_t v2; - uint64_t v3; - uint64_t padding; - size_t inlen; -}; - -void siphash24_init(struct siphash *state, const uint8_t k[16]); -void siphash24_compress(const void *in, size_t inlen, struct siphash *state); -#define siphash24_compress_byte(byte, state) siphash24_compress((const uint8_t[]) { (byte) }, 1, (state)) - -uint64_t siphash24_finalize(struct siphash *state); - -uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]); diff --git a/src/dhcp/tests/meson.build b/src/dhcp/tests/meson.build index 32badae8bc..9d8be427f3 100644 --- a/src/dhcp/tests/meson.build +++ b/src/dhcp/tests/meson.build @@ -8,7 +8,7 @@ foreach test_unit: test_units test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: '-DTESTDIR="@0@"'.format(meson.current_source_dir()) + c_args: nm_build_cflags, ) test( diff --git a/src/dhcp/tests/test-dhcp-dhclient.c b/src/dhcp/tests/test-dhcp-dhclient.c index 25af51a135..a8284b23de 100644 --- a/src/dhcp/tests/test-dhcp-dhclient.c +++ b/src/dhcp/tests/test-dhcp-dhclient.c @@ -36,6 +36,8 @@ #include "nm-test-utils-core.h" +#define TEST_DIR NM_BUILD_SRCDIR"/src/dhcp/tests" + static void test_config (const char *orig, const char *expected, @@ -736,7 +738,7 @@ test_read_duid_from_leasefile (void) gconstpointer duid_arr; gsize duid_len; - duid = nm_dhcp_dhclient_read_duid (TESTDIR "/test-dhclient-duid.leases", &error); + duid = nm_dhcp_dhclient_read_duid (TEST_DIR"/test-dhclient-duid.leases", &error); g_assert_no_error (error); g_assert (duid); duid_arr = g_bytes_get_data (duid, &duid_len); @@ -750,7 +752,7 @@ test_read_commented_duid_from_leasefile (void) GBytes *duid; GError *error = NULL; - duid = nm_dhcp_dhclient_read_duid (TESTDIR "/test-dhclient-commented-duid.leases", &error); + duid = nm_dhcp_dhclient_read_duid (TEST_DIR"/test-dhclient-commented-duid.leases", &error); g_assert_no_error (error); g_assert (duid == NULL); } diff --git a/src/dnsmasq/tests/meson.build b/src/dnsmasq/tests/meson.build index 40f42f6f80..12106c52f6 100644 --- a/src/dnsmasq/tests/meson.build +++ b/src/dnsmasq/tests/meson.build @@ -4,7 +4,6 @@ exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: '-DTESTDIR="@0@"'.format(meson.source_root()) ) test( diff --git a/src/settings/plugins/ibft/tests/meson.build b/src/settings/plugins/ibft/tests/meson.build index 7a9445dd8a..59f49c3104 100644 --- a/src/settings/plugins/ibft/tests/meson.build +++ b/src/settings/plugins/ibft/tests/meson.build @@ -2,16 +2,11 @@ test_unit = 'test-ibft' test_ibft_dir = meson.current_source_dir() -cflags = [ - '-DTEST_IBFT_DIR="@0@"'.format(test_ibft_dir), - '-DTEST_SCRATCH_DIR="@0@"'.format(test_ibft_dir) -] - exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: cflags, + c_args: nm_build_cflags, link_with: libnms_ibft_core ) diff --git a/src/settings/plugins/ibft/tests/test-ibft.c b/src/settings/plugins/ibft/tests/test-ibft.c index fd2ec61bf0..5e46be2eb5 100644 --- a/src/settings/plugins/ibft/tests/test-ibft.c +++ b/src/settings/plugins/ibft/tests/test-ibft.c @@ -36,6 +36,8 @@ #include "nm-test-utils-core.h" +#define TEST_DIR NM_BUILD_SRCDIR"/src/settings/plugins/ibft/tests" + static GPtrArray * read_block (const char *iscsiadm_path, const char *expected_mac) { @@ -78,7 +80,7 @@ test_read_ibft_dhcp (void) const char *expected_mac_address = "00:33:21:98:b9:f1"; GPtrArray *block; - block = read_block (TEST_IBFT_DIR "/iscsiadm-test-dhcp", expected_mac_address); + block = read_block (TEST_DIR "/iscsiadm-test-dhcp", expected_mac_address); connection = nms_ibft_reader_get_connection_from_block (block, &error); g_assert_no_error (error); @@ -125,7 +127,7 @@ test_read_ibft_static (void) NMIPAddress *ip4_addr; GPtrArray *block; - block = read_block (TEST_IBFT_DIR "/iscsiadm-test-static", expected_mac_address); + block = read_block (TEST_DIR "/iscsiadm-test-static", expected_mac_address); connection = nms_ibft_reader_get_connection_from_block (block, &error); g_assert_no_error (error); @@ -227,7 +229,7 @@ test_read_ibft_vlan (void) GError *error = NULL; GPtrArray *block; - block = read_block (TEST_IBFT_DIR "/iscsiadm-test-vlan", expected_mac_address); + block = read_block (TEST_DIR "/iscsiadm-test-vlan", expected_mac_address); connection = nms_ibft_reader_get_connection_from_block (block, &error); g_assert_no_error (error); @@ -280,12 +282,12 @@ int main (int argc, char **argv) g_test_add_func (TPATH "ibft/dhcp", test_read_ibft_dhcp); g_test_add_func (TPATH "ibft/static", test_read_ibft_static); g_test_add_func (TPATH "ibft/vlan", test_read_ibft_vlan); - g_test_add_data_func (TPATH "ibft/bad-record-read", TEST_IBFT_DIR "/iscsiadm-test-bad-record", test_read_ibft_malformed); - g_test_add_data_func (TPATH "ibft/bad-entry-read", TEST_IBFT_DIR "/iscsiadm-test-bad-entry", test_read_ibft_malformed); - g_test_add_data_func (TPATH "ibft/bad-ipaddr-read", TEST_IBFT_DIR "/iscsiadm-test-bad-ipaddr", test_read_ibft_bad_address); - g_test_add_data_func (TPATH "ibft/bad-gateway-read", TEST_IBFT_DIR "/iscsiadm-test-bad-gateway", test_read_ibft_bad_address); - g_test_add_data_func (TPATH "ibft/bad-dns1-read", TEST_IBFT_DIR "/iscsiadm-test-bad-dns1", test_read_ibft_bad_address); - g_test_add_data_func (TPATH "ibft/bad-dns2-read", TEST_IBFT_DIR "/iscsiadm-test-bad-dns2", test_read_ibft_bad_address); + g_test_add_data_func (TPATH "ibft/bad-record-read", TEST_DIR "/iscsiadm-test-bad-record", test_read_ibft_malformed); + g_test_add_data_func (TPATH "ibft/bad-entry-read", TEST_DIR "/iscsiadm-test-bad-entry", test_read_ibft_malformed); + g_test_add_data_func (TPATH "ibft/bad-ipaddr-read", TEST_DIR "/iscsiadm-test-bad-ipaddr", test_read_ibft_bad_address); + g_test_add_data_func (TPATH "ibft/bad-gateway-read", TEST_DIR "/iscsiadm-test-bad-gateway", test_read_ibft_bad_address); + g_test_add_data_func (TPATH "ibft/bad-dns1-read", TEST_DIR "/iscsiadm-test-bad-dns1", test_read_ibft_bad_address); + g_test_add_data_func (TPATH "ibft/bad-dns2-read", TEST_DIR "/iscsiadm-test-bad-dns2", test_read_ibft_bad_address); return g_test_run (); } diff --git a/src/settings/plugins/ifcfg-rh/tests/meson.build b/src/settings/plugins/ifcfg-rh/tests/meson.build index 3596b642c9..3d72d89257 100644 --- a/src/settings/plugins/ifcfg-rh/tests/meson.build +++ b/src/settings/plugins/ifcfg-rh/tests/meson.build @@ -2,16 +2,11 @@ test_unit = 'test-ifcfg-rh' test_ifcfg_dir = meson.current_source_dir() -cflags = [ - '-DTEST_IFCFG_DIR="@0@"'.format(test_ifcfg_dir), - '-DTEST_SCRATCH_DIR="@0@"'.format(test_ifcfg_dir) -] - exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: cflags, + c_args: nm_build_cflags, link_with: libnms_ifcfg_rh_core ) diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 367de7ccc0..1331391dc2 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -59,7 +59,11 @@ #include "nm-test-utils-core.h" -#define TEST_SCRATCH_DIR_TMP TEST_SCRATCH_DIR"/network-scripts/tmp" +#define TEST_IFCFG_DIR NM_BUILD_SRCDIR"/src/settings/plugins/ifcfg-rh/tests/network-scripts" +#define TEST_SCRATCH_DIR NM_BUILD_BUILDDIR"/src/settings/plugins/ifcfg-rh/tests/network-scripts" +#define TEST_SCRATCH_DIR_TMP TEST_SCRATCH_DIR"/tmp" + +#define TEST_SCRATCH_ALIAS_BASE TEST_SCRATCH_DIR"/ifcfg-alias0" /*****************************************************************************/ @@ -411,7 +415,7 @@ test_read_netmask_1 (void) NMSettingConnection *s_con; NMSettingIPConfig *s_ip4; NMIPAddress *ip4_addr; - const char *FILENAME = TEST_IFCFG_DIR "/network-scripts/ifcfg-netmask-1"; + const char *FILENAME = TEST_IFCFG_DIR"/ifcfg-netmask-1"; connection = _connection_from_file (FILENAME, NULL, TYPE_ETHERNET, NULL); @@ -431,14 +435,14 @@ test_read_netmask_1 (void) content = nmtst_file_get_contents (FILENAME); - testfile = g_strdup (TEST_SCRATCH_DIR "/network-scripts/ifcfg-netmask-1.copy"); + testfile = g_strdup (TEST_SCRATCH_DIR"/ifcfg-netmask-1.copy"); nmtst_file_set_contents (testfile, content); _writer_update_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, testfile, - TEST_IFCFG_DIR "/network-scripts/ifcfg-netmask-1.cexpected"); + TEST_IFCFG_DIR"/ifcfg-netmask-1.cexpected"); } /*****************************************************************************/ @@ -553,7 +557,7 @@ test_read_basic (void) const char *mac; char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-minimal", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-minimal", NULL, TYPE_ETHERNET, NULL); /* ===== CONNECTION SETTING ===== */ @@ -606,7 +610,7 @@ test_read_miscellaneous_variables (void) guint64 expected_timestamp = 0; NMTST_EXPECT_NM_WARN ("*invalid MAC in HWADDR_BLACKLIST 'XX:aa:invalid'*"); - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-misc-variables", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-misc-variables", NULL, TYPE_ETHERNET, NULL); g_test_assert_expected_messages (); @@ -647,7 +651,7 @@ test_read_variables_corner_cases (void) const char *mac; char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-variables-corner-cases-1", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-variables-corner-cases-1", NULL, TYPE_ETHERNET, NULL); /* ===== CONNECTION SETTING ===== */ @@ -685,7 +689,7 @@ test_read_unmanaged (void) char *unhandled_spec = NULL; guint64 expected_timestamp = 0; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-nm-controlled", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-nm-controlled", NULL, TYPE_ETHERNET, &unhandled_spec); g_assert_cmpstr (unhandled_spec, ==, "unmanaged:mac:00:11:22:33:f8:9f"); @@ -709,7 +713,7 @@ test_read_unmanaged_unrecognized (void) gs_free char *unhandled_spec = NULL; guint64 expected_timestamp = 0; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-nm-controlled-unrecognized", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-nm-controlled-unrecognized", NULL, NULL, &unhandled_spec); g_assert_cmpstr (unhandled_spec, ==, "unmanaged:interface-name:ipoac0"); @@ -731,7 +735,7 @@ test_read_unrecognized (void) gs_free char *unhandled_spec = NULL; guint64 expected_timestamp = 0; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-unrecognized", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-unrecognized", NULL, NULL, &unhandled_spec); g_assert_cmpstr (unhandled_spec, ==, "unrecognized:mac:00:11:22:33"); @@ -855,7 +859,7 @@ test_read_wired_static_no_prefix (gconstpointer user_data) NMIPAddress *ip4_addr; char *file, *expected_id; - file = g_strdup_printf (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-static-no-prefix-%u", expected_prefix); + file = g_strdup_printf (TEST_IFCFG_DIR"/ifcfg-test-wired-static-no-prefix-%u", expected_prefix); expected_id = g_strdup_printf ("System test-wired-static-no-prefix-%u", expected_prefix); NMTST_EXPECT_NM_WARN ("*missing PREFIX, assuming*"); @@ -896,7 +900,7 @@ test_read_wired_dhcp (void) char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0xee }; const char *mac; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-dhcp", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-dhcp", NULL, TYPE_ETHERNET, &unmanaged); g_assert (unmanaged == NULL); @@ -939,7 +943,7 @@ test_read_wired_dhcp_plus_ip (void) NMIPAddress *ip4_addr; NMIPAddress *ip6_addr; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp-plus-ip", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-dhcp-plus-ip", NULL, TYPE_ETHERNET, NULL); /* ===== IPv4 SETTING ===== */ @@ -1006,7 +1010,7 @@ test_read_wired_shared_plus_ip (void) NMSettingIPConfig *s_ip4; NMIPAddress *ip4_addr; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-shared-plus-ip", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-shared-plus-ip", NULL, TYPE_ETHERNET, NULL); /* ===== IPv4 SETTING ===== */ @@ -1038,8 +1042,8 @@ test_read_wired_global_gateway (void) NMIPAddress *ip4_addr; char *unmanaged = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-global-gateway", - TEST_IFCFG_DIR"/network-scripts/network-test-wired-global-gateway", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-global-gateway", + TEST_IFCFG_DIR"/network-test-wired-global-gateway", TYPE_ETHERNET, &unmanaged); g_assert (unmanaged == NULL); @@ -1080,8 +1084,8 @@ test_read_wired_global_gateway_ignore (void) char *unmanaged = NULL; NMTST_EXPECT_NM_WARN ("*ignoring GATEWAY (/etc/sysconfig/network) for * because the connection has no static addresses"); - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-global-gateway-ignore", - TEST_IFCFG_DIR"/network-scripts/network-test-wired-global-gateway-ignore", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-global-gateway-ignore", + TEST_IFCFG_DIR"/network-test-wired-global-gateway-ignore", TYPE_ETHERNET, &unmanaged); g_test_assert_expected_messages (); g_assert (unmanaged == NULL); @@ -1116,7 +1120,7 @@ test_read_wired_obsolete_gateway_n (void) NMSettingIPConfig *s_ip4; NMIPAddress *ip4_addr; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-obsolete-gateway-n", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-obsolete-gateway-n", NULL, TYPE_ETHERNET, NULL); /* ===== IPv4 SETTING ===== */ @@ -1184,8 +1188,8 @@ test_user_1 (void) nm_connection_add_setting (connection, NM_SETTING (s_user)); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_User_1.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_User_1.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -1200,8 +1204,8 @@ test_read_wired_never_default (void) NMSettingIPConfig *s_ip4; NMSettingIPConfig *s_ip6; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-never-default", - TEST_IFCFG_DIR"/network-scripts/network-test-wired-never-default", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-never-default", + TEST_IFCFG_DIR"/network-test-wired-never-default", TYPE_ETHERNET, NULL); /* ===== WIRED SETTING ===== */ @@ -1232,7 +1236,7 @@ test_read_wired_defroute_no (void) NMSettingIPConfig *s_ip6; char *unmanaged = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-defroute-no", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-defroute-no", NULL, TYPE_ETHERNET, &unmanaged); g_assert (unmanaged == NULL); @@ -1264,8 +1268,8 @@ test_read_wired_defroute_no_gatewaydev_yes (void) NMSettingIPConfig *s_ip6; char *unmanaged = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-defroute-no-gatewaydev-yes", - TEST_IFCFG_DIR"/network-scripts/network-test-wired-defroute-no-gatewaydev-yes", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-defroute-no-gatewaydev-yes", + TEST_IFCFG_DIR"/network-test-wired-defroute-no-gatewaydev-yes", TYPE_ETHERNET, &unmanaged); @@ -1297,7 +1301,7 @@ test_read_wired_static_routes (void) NMSettingIPConfig *s_ip4; NMIPRoute *ip4_route; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-routes", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-static-routes", NULL, TYPE_ETHERNET, NULL); /* ===== CONNECTION SETTING ===== */ @@ -1370,7 +1374,7 @@ test_read_wired_static_routes_legacy (void) char *unmanaged = NULL; NMIPRoute *ip4_route; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-routes-legacy", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-static-routes-legacy", NULL, TYPE_ETHERNET, &unmanaged); g_assert (!unmanaged); @@ -1512,7 +1516,7 @@ test_read_wired_ipv6_manual (void) NMIPRoute *ip6_route; NMTST_EXPECT_NM_WARN ("*ignoring manual default route*"); - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-manual", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-ipv6-manual", NULL, TYPE_ETHERNET, &unmanaged); g_test_assert_expected_messages (); g_assert (!unmanaged); @@ -1688,7 +1692,7 @@ test_read_wired_dhcp6_only (void) char *unmanaged = NULL; const char *method; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp6-only", NULL, TYPE_ETHERNET, &unmanaged); + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-dhcp6-only", NULL, TYPE_ETHERNET, &unmanaged); g_assert (!unmanaged); /* ===== CONNECTION SETTING ===== */ @@ -1726,7 +1730,7 @@ test_read_wired_autoip (void) NMSettingIPConfig *s_ip4; char *unmanaged = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-autoip", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-autoip", NULL, TYPE_ETHERNET, &unmanaged); g_assert (unmanaged == NULL); @@ -1745,7 +1749,7 @@ test_read_onboot_no (void) NMSettingConnection *s_con; char *unmanaged = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-onboot-no", NULL, TYPE_ETHERNET, &unmanaged); + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-onboot-no", NULL, TYPE_ETHERNET, &unmanaged); g_assert (!unmanaged); s_con = nm_connection_get_setting_connection (connection); @@ -1763,7 +1767,7 @@ test_read_noip (void) NMSettingIPConfig *s_ip4; NMSettingIPConfig *s_ip6; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-noip", NULL, TYPE_ETHERNET, NULL); + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-noip", NULL, TYPE_ETHERNET, NULL); s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); @@ -1778,7 +1782,7 @@ test_read_noip (void) g_object_unref (connection); } -#define TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2_CA_CERT TEST_IFCFG_DIR "/network-scripts/test_ca_cert.pem" +#define TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2_CA_CERT TEST_IFCFG_DIR"/test_ca_cert.pem" static void test_read_wired_8021x_peap_mschapv2 (void) @@ -1794,7 +1798,7 @@ test_read_wired_8021x_peap_mschapv2 (void) const char *expected_ca_cert_path; const char *read_ca_cert_path; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-8021x-peap-mschapv2", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-8021x-peap-mschapv2", NULL, TYPE_ETHERNET, &unmanaged); g_assert (!unmanaged); @@ -1895,7 +1899,7 @@ test_read_write_802_1X_subj_matches (void) NMSetting8021x *s_8021x; NMTST_EXPECT_NM_WARN ("*missing IEEE_8021X_CA_CERT*peap*"); - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-802-1X-subj-matches", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-802-1X-subj-matches", NULL, TYPE_ETHERNET, NULL); g_test_assert_expected_messages (); @@ -1917,8 +1921,8 @@ test_read_write_802_1X_subj_matches (void) NMTST_EXPECT_NM_WARN ("*missing IEEE_8021X_CA_CERT for EAP method 'peap'; this is insecure!"); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-System_test-wired-802-1X-subj-matches.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-System_test-wired-802-1X-subj-matches.cexpected", &testfile); g_test_assert_expected_messages (); @@ -1955,7 +1959,7 @@ test_read_802_1x_ttls_eapgtc (void) * NMSetting8021x::autheap property. */ - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-802-1x-ttls-eapgtc", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-802-1x-ttls-eapgtc", NULL, TYPE_WIRELESS, NULL); /* ===== 802.1x SETTING ===== */ @@ -1987,7 +1991,7 @@ test_read_write_802_1x_password_raw (void) /* Test that the 802-1x.password-raw is correctly read and written. */ - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-802-1x-password-raw", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-802-1x-password-raw", NULL, TYPE_ETHERNET, NULL); /* ===== 802.1x SETTING ===== */ @@ -2004,7 +2008,7 @@ test_read_write_802_1x_password_raw (void) NM_SETTING_SECRET_FLAG_NONE); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); keyfile = utils_get_keys_path (testfile); @@ -2034,7 +2038,7 @@ test_read_wired_aliases_good (gconstpointer test_data) expected_label = N == 0 ? expected_label_0 : expected_label_3; expected_num_addresses = g_strv_length ((char **) expected_address); - nm_sprintf_buf (path, TEST_IFCFG_DIR "/network-scripts/ifcfg-aliasem%d", N); + nm_sprintf_buf (path, TEST_IFCFG_DIR"/ifcfg-aliasem%d", N); connection = _connection_from_file (path, NULL, TYPE_ETHERNET, NULL); @@ -2137,14 +2141,14 @@ static void test_read_wired_aliases_bad_1 (void) { NMTST_EXPECT_NM_WARN ("*aliasem1:1*has no DEVICE*"); - test_read_wired_aliases_bad (TEST_IFCFG_DIR "/network-scripts/ifcfg-aliasem1", "System aliasem1"); + test_read_wired_aliases_bad (TEST_IFCFG_DIR"/ifcfg-aliasem1", "System aliasem1"); } static void test_read_wired_aliases_bad_2 (void) { NMTST_EXPECT_NM_WARN ("*aliasem2:1*has invalid DEVICE*"); - test_read_wired_aliases_bad (TEST_IFCFG_DIR "/network-scripts/ifcfg-aliasem2", "System aliasem2"); + test_read_wired_aliases_bad (TEST_IFCFG_DIR"/ifcfg-aliasem2", "System aliasem2"); } static void @@ -2158,7 +2162,7 @@ test_read_dns_options (void) const char *options6[] = { "inet6" }; guint32 i, num; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dns-options", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-dns-options", NULL, TYPE_ETHERNET, &unmanaged); g_assert_cmpstr (unmanaged, ==, NULL); @@ -2198,7 +2202,7 @@ test_clear_master (void) shvarFile *f; /* 1. load the bridge slave connection from disk */ - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bridge-component", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bridge-component", NULL, TYPE_ETHERNET, &unmanaged); g_assert_cmpstr (unmanaged, ==, NULL); @@ -2210,8 +2214,8 @@ test_clear_master (void) /* 2. write the connection to a new file */ _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-System_test-bridge-component-a.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-System_test-bridge-component-a.cexpected", &testfile); /* 3. clear master and slave-type */ @@ -2227,9 +2231,9 @@ test_clear_master (void) /* 4. update the connection on disk */ _writer_update_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, testfile, - TEST_IFCFG_DIR "/network-scripts/ifcfg-System_test-bridge-component-b.cexpected"); + TEST_IFCFG_DIR"/ifcfg-System_test-bridge-component-b.cexpected"); keyfile = utils_get_keys_path (testfile); g_assert (!g_file_test (keyfile, G_FILE_TEST_EXISTS)); @@ -2314,7 +2318,7 @@ test_write_dns_options (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -2335,7 +2339,7 @@ test_read_wifi_open (void) char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; const char *expected_ssid = "blahblah"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-open", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-open", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2398,7 +2402,7 @@ test_read_wifi_open_auto (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-open-auto", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-open-auto", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2423,7 +2427,7 @@ test_read_wifi_open_ssid_hex (void) GBytes *ssid; const char *expected_ssid = "blahblah"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-open-ssid-hex", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-open-ssid-hex", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2453,7 +2457,7 @@ test_read_wifi_open_ssid_hex_bad (void) GBytes *ssid; const char *expected_ssid = "0x626cxx"; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-open-ssid-bad-hex", NULL, TYPE_WIRELESS, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -2483,7 +2487,7 @@ test_read_wifi_open_ssid_quoted (void) GBytes *ssid; const char *expected_ssid = "foo\"bar\\"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-open-ssid-quoted", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-open-ssid-quoted", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2518,7 +2522,7 @@ test_read_wifi_wep (void) const char *expected_ssid = "blahblah"; NMWepKeyType key_type; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2592,7 +2596,7 @@ test_read_wifi_wep_adhoc (void) GBytes *ssid; const char *expected_ssid = "blahblah"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-adhoc", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-adhoc", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2659,7 +2663,7 @@ test_read_wifi_wep_passphrase (void) NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-passphrase", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-passphrase", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2696,7 +2700,7 @@ test_read_wifi_wep_40_ascii (void) NMSettingWirelessSecurity *s_wsec; NMWepKeyType key_type; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-40-ascii", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-40-ascii", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2736,7 +2740,7 @@ test_read_wifi_wep_104_ascii (void) NMSettingWirelessSecurity *s_wsec; NMWepKeyType key_type; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-104-ascii", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-104-ascii", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2775,7 +2779,7 @@ test_read_wifi_leap (void) NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-leap", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-leap", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2837,7 +2841,7 @@ test_ifcfg_no_trailing_newline (void) { shvarFile *sv; - sv = _svOpenFile (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk"); + sv = _svOpenFile (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk"); _svGetValue_check (sv, "LAST_ENTRY", "no-newline"); svCloseFile (sv); } @@ -2864,7 +2868,7 @@ test_read_wifi_wpa_psk (void) gboolean found_proto_wpa = FALSE; gboolean found_proto_rsn = FALSE; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -2973,7 +2977,7 @@ test_read_wifi_wpa_psk_2 (void) NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk-2", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk-2", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -3004,7 +3008,7 @@ test_read_wifi_wpa_psk_unquoted (void) NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk-unquoted", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -3032,7 +3036,7 @@ test_read_wifi_wpa_psk_unquoted2 (void) { gs_unref_object NMConnection *connection = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk-unquoted2", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk-unquoted2", NULL, TYPE_WIRELESS, NULL); } @@ -3045,7 +3049,7 @@ test_read_wifi_wpa_psk_adhoc (void) NMSettingWirelessSecurity *s_wsec; NMSettingIPConfig *s_ip4; - connection = _connection_from_file(TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk-adhoc", + connection = _connection_from_file(TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk-adhoc", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -3097,7 +3101,7 @@ test_read_wifi_wpa_psk_hex (void) GBytes *ssid; const char *expected_ssid = "blahblah"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-psk-hex", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-psk-hex", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -3132,9 +3136,9 @@ test_read_wifi_wpa_psk_hex (void) g_object_unref (connection); } -#define TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT TEST_IFCFG_DIR "/network-scripts/test_ca_cert.pem" -#define TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT TEST_IFCFG_DIR "/network-scripts/test1_key_and_cert.pem" -#define TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY TEST_IFCFG_DIR "/network-scripts/test1_key_and_cert.pem" +#define TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT TEST_IFCFG_DIR"/test_ca_cert.pem" +#define TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT TEST_IFCFG_DIR"/test1_key_and_cert.pem" +#define TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY TEST_IFCFG_DIR"/test1_key_and_cert.pem" static void test_read_wifi_wpa_eap_tls (void) @@ -3146,7 +3150,7 @@ test_read_wifi_wpa_eap_tls (void) char *unmanaged = NULL; const char *expected_privkey_password = "test1"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-eap-tls", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-eap-tls", NULL, TYPE_ETHERNET, &unmanaged); g_assert (!unmanaged); @@ -3204,7 +3208,7 @@ test_read_wifi_wpa_eap_ttls_tls (void) char *unmanaged = NULL; const char *expected_privkey_password = "test1"; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-eap-ttls-tls", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wpa-eap-ttls-tls", NULL, TYPE_WIRELESS, &unmanaged); g_assert (!unmanaged); @@ -3228,7 +3232,7 @@ test_read_wifi_wpa_eap_ttls_tls (void) /* CA Cert */ verify_cert_or_key (s_8021x, - TEST_IFCFG_DIR "/network-scripts/test_ca_cert.pem", + TEST_IFCFG_DIR"/test_ca_cert.pem", NULL, NM_SETTING_802_1X_CA_CERT); @@ -3267,7 +3271,7 @@ test_read_wifi_dynamic_wep_leap (void) NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-dynamic-wep-leap", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-dynamic-wep-leap", NULL, TYPE_WIRELESS, NULL); /* ===== WIRELESS SETTING ===== */ @@ -3316,7 +3320,7 @@ test_read_wifi_wep_eap_ttls_chap (void) NMSetting8021x *s_8021x; char *unmanaged = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-eap-ttls-chap", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-eap-ttls-chap", NULL, TYPE_WIRELESS, &unmanaged); g_assert (!unmanaged); @@ -3346,7 +3350,7 @@ test_read_wifi_wep_eap_ttls_chap (void) /* CA Cert */ verify_cert_or_key (s_8021x, - TEST_IFCFG_DIR "/network-scripts/test_ca_cert.pem", + TEST_IFCFG_DIR"/test_ca_cert.pem", NULL, NM_SETTING_802_1X_CA_CERT); @@ -3364,7 +3368,7 @@ test_read_wired_wake_on_lan (void) NMSettingConnection *s_con; NMSettingWired *s_wired; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-wake-on-lan", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-wake-on-lan", NULL, TYPE_WIRELESS, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -3393,7 +3397,7 @@ test_read_wired_auto_negotiate_off (void) NMSettingConnection *s_con; NMSettingWired *s_wired; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-wake-on-lan", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-wake-on-lan", NULL, TYPE_ETHERNET, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -3415,7 +3419,7 @@ test_read_wired_auto_negotiate_on (void) NMSettingConnection *s_con; NMSettingWired *s_wired; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-auto-negotiate-on", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-auto-negotiate-on", NULL, TYPE_ETHERNET, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -3437,7 +3441,7 @@ test_read_wired_unknown_ethtool_opt (void) NMSettingConnection *s_con; NMSettingWired *s_wired; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-unknown-ethtool-opt", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-unknown-ethtool-opt", NULL, TYPE_ETHERNET, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -3468,7 +3472,7 @@ test_read_wifi_hidden (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-hidden", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-hidden", NULL, TYPE_WIRELESS, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -3522,8 +3526,8 @@ test_write_wifi_hidden (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_WiFi_Hidden.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_WiFi_Hidden.cexpected", &testfile); f = _svOpenFile (testfile); @@ -3548,7 +3552,7 @@ test_read_wifi_mac_random (gconstpointer user_data) nmtst_test_data_unpack (user_data, &name, &value_p); value = GPOINTER_TO_INT (value_p); - path = g_strdup_printf (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-mac-random-%s", name); + path = g_strdup_printf (TEST_IFCFG_DIR"/ifcfg-test-wifi-mac-random-%s", name); connection = _connection_from_file (path, NULL, TYPE_WIRELESS, NULL); s_wifi = nm_connection_get_setting_wireless (connection); @@ -3607,8 +3611,8 @@ test_write_wifi_mac_random (gconstpointer user_data) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - nm_sprintf_buf (cexpected, TEST_IFCFG_DIR"/network-scripts/ifcfg-Test_Write_WiFi_MAC_%s.cexpected", name), + TEST_SCRATCH_DIR, + nm_sprintf_buf (cexpected, TEST_IFCFG_DIR"/ifcfg-Test_Write_WiFi_MAC_%s.cexpected", name), &testfile); f = _svOpenFile (testfile); @@ -3660,8 +3664,8 @@ test_write_wired_wake_on_lan (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Wired_Wake-on-LAN.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Wired_Wake-on-LAN.cexpected", &testfile); f = _svOpenFile (testfile); @@ -3696,8 +3700,8 @@ test_write_wired_auto_negotiate_off (void) NULL); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Wired_Auto-Negotiate.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Wired_Auto-Negotiate.cexpected", &testfile); f = _svOpenFile (testfile); @@ -3731,7 +3735,7 @@ test_write_wired_auto_negotiate_on (void) NULL); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); f = _svOpenFile (testfile); @@ -3755,7 +3759,7 @@ test_read_wifi_band_a (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-band-a", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-band-a", NULL, TYPE_WIRELESS, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -3810,8 +3814,8 @@ test_write_wifi_band_a (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_WiFi_Band_A.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_WiFi_Band_A.cexpected", &testfile); f = _svOpenFile (testfile); @@ -3828,7 +3832,7 @@ test_read_wifi_band_a_channel_mismatch (void) { gs_free_error GError *error = NULL; - _connection_from_file_fail (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-band-a-channel-mismatch", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-wifi-band-a-channel-mismatch", NULL, TYPE_WIRELESS, &error); g_assert_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION); } @@ -3838,7 +3842,7 @@ test_read_wifi_band_bg_channel_mismatch (void) { gs_free_error GError *error = NULL; - _connection_from_file_fail (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-band-bg-channel-mismatch", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-wifi-band-bg-channel-mismatch", NULL, TYPE_WIRELESS, &error); g_assert_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION); } @@ -3853,7 +3857,7 @@ test_read_wired_qeth_static (void) char *unmanaged = NULL; const char * const *subchannels; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-qeth-static", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-qeth-static", NULL, TYPE_ETHERNET, &unmanaged); g_assert (!unmanaged); @@ -3902,7 +3906,7 @@ test_read_wired_ctc_static (void) char *unmanaged = NULL; const char * const *subchannels; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-ctc-static", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-ctc-static", NULL, TYPE_ETHERNET, &unmanaged); g_assert (unmanaged == NULL); @@ -3940,7 +3944,7 @@ test_read_wifi_wep_no_keys (void) NMSettingWirelessSecurity *s_wsec; NMWepKeyType key_type; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-no-keys", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-no-keys", NULL, TYPE_WIRELESS, NULL); /* ===== CONNECTION SETTING ===== */ @@ -3989,7 +3993,7 @@ test_read_permissions (void) guint32 num; const char *tmp; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-permissions", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-permissions", NULL, TYPE_ETHERNET, NULL); /* ===== CONNECTION SETTING ===== */ @@ -4028,7 +4032,7 @@ test_read_wifi_wep_agent_keys (void) NMWepKeyType key_type; NMSettingSecretFlags flags; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wep-agent-keys", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-wep-agent-keys", NULL, TYPE_WIRELESS, NULL); /* Ensure the connection is still marked for wifi security even though @@ -4179,7 +4183,7 @@ test_write_wired_static (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); route6file = utils_get_route6_path (testfile); @@ -4319,7 +4323,7 @@ test_write_wired_static_with_generic (void) nmtst_assert_connection_verifies (connection); _writer_new_connection_FIXME (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); route6file = utils_get_route6_path (testfile); @@ -4404,7 +4408,7 @@ test_write_wired_dhcp (void) NULL); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4419,11 +4423,11 @@ test_write_wired_dhcp_plus_ip (void) gs_unref_object NMConnection *connection = NULL; gs_unref_object NMConnection *reread = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp-plus-ip", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-dhcp-plus-ip", NULL, TYPE_ETHERNET, NULL); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4441,7 +4445,7 @@ test_read_write_wired_dhcp_send_hostname (void) NMSettingIPConfig *s_ip6; const char * dhcp_hostname = "kamil-patka"; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp-send-hostname", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-dhcp-send-hostname", NULL, TYPE_ETHERNET, NULL); /* Check dhcp-hostname and dhcp-send-hostname */ @@ -4459,7 +4463,7 @@ test_read_write_wired_dhcp_send_hostname (void) g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4482,7 +4486,7 @@ test_read_wired_dhcpv6_hostname_fallback (void) gs_unref_object NMConnection *connection = NULL; NMSettingIPConfig *s_ip6; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcpv6-hostname-fallback", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wired-dhcpv6-hostname-fallback", NULL, TYPE_ETHERNET, NULL); s_ip6 = nm_connection_get_setting_ip6_config (connection); @@ -4551,7 +4555,7 @@ test_write_wired_static_ip6_only (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4634,7 +4638,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4675,7 +4679,7 @@ test_read_write_static_routes_legacy (void) NMSettingIPConfig *s_ip4; const char *tmp; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-static-routes-legacy", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-static-routes-legacy", NULL, TYPE_ETHERNET, NULL); /* ===== CONNECTION SETTING ===== */ @@ -4709,7 +4713,7 @@ test_read_write_static_routes_legacy (void) */ _writer_new_connec_exp (connection, TEST_SCRATCH_DIR_TMP, - TEST_IFCFG_DIR "/network-scripts/ifcfg-test-static-routes-legacy.cexpected", + TEST_IFCFG_DIR"/ifcfg-test-static-routes-legacy.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4811,9 +4815,9 @@ test_write_wired_static_routes (void) nmtst_assert_connection_verifies (connection); _writer_new_connection_reread (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile, - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Wired_Static_Routes.cexpected", + TEST_IFCFG_DIR"/ifcfg-Test_Write_Wired_Static_Routes.cexpected", &reread, &reread_same); /* ifcfg does not support setting onlink=0. It gets lost during write+re-read. @@ -4906,7 +4910,7 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -4980,7 +4984,7 @@ test_write_wired_8021x_tls (gconstpointer test_data) /* CA cert */ success = nm_setting_802_1x_set_ca_cert (s_8021x, - TEST_IFCFG_DIR "/network-scripts/test_ca_cert.pem", + TEST_IFCFG_DIR"/test_ca_cert.pem", scheme, &format, &error); @@ -4991,7 +4995,7 @@ test_write_wired_8021x_tls (gconstpointer test_data) /* Client cert */ format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; success = nm_setting_802_1x_set_client_cert (s_8021x, - TEST_IFCFG_DIR "/network-scripts/test1_key_and_cert.pem", + TEST_IFCFG_DIR"/test1_key_and_cert.pem", scheme, &format, &error); @@ -5002,7 +5006,7 @@ test_write_wired_8021x_tls (gconstpointer test_data) /* Private key */ format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; success = nm_setting_802_1x_set_private_key (s_8021x, - TEST_IFCFG_DIR "/network-scripts/test1_key_and_cert.pem", + TEST_IFCFG_DIR"/test1_key_and_cert.pem", "test1", scheme, &format, @@ -5017,7 +5021,7 @@ test_write_wired_8021x_tls (gconstpointer test_data) nmtst_assert_connection_verifies (connection); _writer_new_connection_FIXME (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5079,8 +5083,6 @@ test_write_wired_8021x_tls (gconstpointer test_data) g_free (tmp); } -#define TEST_SCRATCH_ALIAS_BASE TEST_SCRATCH_DIR "/network-scripts/ifcfg-alias0" - static void test_write_wired_aliases (void) { @@ -5156,7 +5158,7 @@ test_write_wired_aliases (void) g_assert (g_file_test (TEST_SCRATCH_ALIAS_BASE ":5", G_FILE_TEST_EXISTS)); _writer_new_connection_FIXME (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); /* Re-check the alias files */ @@ -5258,7 +5260,7 @@ test_write_gateway (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); f = _svOpenFile (testfile); @@ -5341,7 +5343,7 @@ test_write_wifi_open (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5410,7 +5412,7 @@ test_write_wifi_open_hex_ssid (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5492,7 +5494,7 @@ test_write_wifi_wep (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5585,7 +5587,7 @@ test_write_wifi_wep_adhoc (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5670,7 +5672,7 @@ test_write_wifi_wep_passphrase (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5758,7 +5760,7 @@ test_write_wifi_wep_40_ascii (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5846,8 +5848,8 @@ test_write_wifi_wep_104_ascii (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Wifi_WEP_104_ASCII.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Wifi_WEP_104_ASCII.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -5931,8 +5933,8 @@ test_write_wifi_leap (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Wifi_LEAP.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Wifi_LEAP.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6014,7 +6016,7 @@ test_write_wifi_leap_secret_flags (gconstpointer data) nmtst_assert_connection_verifies (connection); _writer_new_connection_FIXME (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6122,7 +6124,7 @@ test_write_wifi_wpa_psk (gconstpointer test_data) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6218,7 +6220,7 @@ test_write_wifi_wpa_psk_adhoc (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6336,7 +6338,7 @@ test_write_wifi_wpa_eap_tls (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6463,7 +6465,7 @@ test_write_wifi_wpa_eap_ttls_tls (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6567,7 +6569,7 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6655,7 +6657,7 @@ test_write_wifi_wpa_then_open (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6671,9 +6673,9 @@ test_write_wifi_wpa_then_open (void) /* Write it back out */ _writer_update_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, testfile, - TEST_IFCFG_DIR "/network-scripts/ifcfg-random_wifi_connection.cexpected"); + TEST_IFCFG_DIR"/ifcfg-random_wifi_connection.cexpected"); keyfile = utils_get_keys_path (testfile); g_assert (!g_file_test (keyfile, G_FILE_TEST_EXISTS)); @@ -6769,7 +6771,7 @@ test_write_wifi_wpa_then_wep_with_perms (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6791,9 +6793,9 @@ test_write_wifi_wpa_then_wep_with_perms (void) /* Write it back out */ _writer_update_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, testfile, - TEST_IFCFG_DIR "/network-scripts/ifcfg-random_wifi_connection_2.cexpected"); + TEST_IFCFG_DIR"/ifcfg-random_wifi_connection_2.cexpected"); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6881,7 +6883,7 @@ test_write_wifi_dynamic_wep_leap (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -6961,7 +6963,7 @@ test_write_wired_qeth_dhcp (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7023,7 +7025,7 @@ test_write_wired_ctc_dhcp (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); /* Ensure the CTCPROT item gets written out as its own option */ @@ -7093,8 +7095,8 @@ test_write_permissions (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Permissions.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Permissions.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7168,7 +7170,7 @@ test_write_wifi_wep_agent_keys (void) nmtst_assert_connection_verifies (connection); _writer_new_connection_FIXME (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL); @@ -7239,7 +7241,7 @@ test_write_wired_pppoe (void) nmtst_assert_connection_verifies (connection); _writer_new_connection_fail (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, NULL); g_object_unref (connection); @@ -7291,7 +7293,7 @@ test_write_vpn (void) nmtst_assert_connection_verifies (connection); _writer_new_connection_fail (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, NULL); g_object_unref (connection); @@ -7364,7 +7366,7 @@ test_write_mobile_broadband (gconstpointer data) nmtst_assert_connection_verifies (connection); _writer_new_connection_fail (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, NULL); g_object_unref (connection); @@ -7380,7 +7382,7 @@ test_read_bridge_main (void) const char *mac; char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bridge-main", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bridge-main", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "br0"); @@ -7478,7 +7480,7 @@ test_write_bridge_main (void) nmtst_assert_connection_verifies_without_normalization (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_BRIDGE, NULL); @@ -7493,7 +7495,7 @@ test_read_bridge_component (void) NMSettingConnection *s_con; NMSettingBridgePort *s_port; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bridge-component", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bridge-component", NULL, TYPE_ETHERNET, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -7558,8 +7560,8 @@ test_write_bridge_component (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Bridge_Component.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Bridge_Component.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7573,7 +7575,7 @@ test_read_bridge_missing_stp (void) NMConnection *connection; NMSettingBridge *s_bridge; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-missing-stp", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bridge-missing-stp", NULL, TYPE_BRIDGE, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "br0"); @@ -7587,7 +7589,7 @@ test_read_bridge_missing_stp (void) g_object_unref (connection); } -#define TEST_IFCFG_VLAN_INTERFACE TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-interface" +#define TEST_IFCFG_VLAN_INTERFACE TEST_IFCFG_DIR"/ifcfg-test-vlan-interface" static void test_read_vlan_interface (void) @@ -7638,7 +7640,7 @@ test_read_vlan_interface (void) g_object_unref (connection); } -#define TEST_IFCFG_VLAN_ONLY_VLANID TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-only-vlanid" +#define TEST_IFCFG_VLAN_ONLY_VLANID TEST_IFCFG_DIR"/ifcfg-test-vlan-only-vlanid" static void test_read_vlan_only_vlan_id (void) @@ -7666,7 +7668,7 @@ test_read_vlan_only_device (void) NMConnection *connection; NMSettingVlan *s_vlan; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-vlan-only-device", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-only-device", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "eth0.9"); @@ -7686,7 +7688,7 @@ test_read_vlan_physdev (void) NMConnection *connection; NMSettingVlan *s_vlan; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-physdev", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-physdev", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "vlan0.3"); @@ -7707,7 +7709,7 @@ test_read_vlan_reorder_hdr_1 (void) NMSettingVlan *s_vlan; NMTST_EXPECT_NM_WARN ("*REORDER_HDR key is deprecated, use VLAN_FLAGS*"); - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-reorder-hdr-1", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-reorder-hdr-1", NULL, TYPE_ETHERNET, NULL); g_test_assert_expected_messages (); @@ -7730,7 +7732,7 @@ test_read_vlan_reorder_hdr_2 (void) NMConnection *connection; NMSettingVlan *s_vlan; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-reorder-hdr-2", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-reorder-hdr-2", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "vlan0.3"); @@ -7752,7 +7754,7 @@ test_read_vlan_flags_1 (void) NMConnection *connection; NMSettingVlan *s_vlan; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-flags-1", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-flags-1", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "super-vlan"); @@ -7775,7 +7777,7 @@ test_read_vlan_flags_2 (void) NMConnection *connection; NMSettingVlan *s_vlan; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-flags-2", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-flags-2", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "super-vlan"); @@ -7803,8 +7805,8 @@ test_write_vlan (void) NULL, TYPE_VLAN, NULL); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Vlan_test-vlan-interface.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Vlan_test-vlan-interface.cexpected", &testfile); } @@ -7815,11 +7817,11 @@ test_write_vlan_flags (void) gs_unref_object NMConnection *connection = NULL; gs_unref_object NMConnection *reread = NULL; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-flags-2", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-vlan-flags-2", NULL, TYPE_VLAN, NULL); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7838,7 +7840,7 @@ test_write_vlan_only_vlanid (void) NULL, TYPE_VLAN, NULL); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7884,8 +7886,8 @@ test_write_vlan_reorder_hdr (void) NULL); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7940,7 +7942,7 @@ test_write_ethernet_missing_ipv6 (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -7953,7 +7955,7 @@ test_read_ibft_ignored (void) { gs_free_error GError *error = NULL; - _connection_from_file_fail (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-ibft", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-ibft", NULL, TYPE_ETHERNET, &error); g_assert_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION); } @@ -7964,7 +7966,7 @@ test_read_bond_main (void) NMConnection *connection; NMSettingBond *s_bond; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-main", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bond-main", NULL, TYPE_ETHERNET,NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "bond0"); @@ -7985,7 +7987,7 @@ test_read_bond_eth_type (void) NMConnection *connection; NMSettingBond *s_bond; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-eth-type", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bond-eth-type", NULL, TYPE_ETHERNET,NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "bond0"); @@ -8069,8 +8071,8 @@ test_write_bond_main (void) nmtst_assert_connection_verifies_without_normalization (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Bond_Main.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Bond_Main.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_BOND, NULL); @@ -8084,7 +8086,7 @@ test_read_bond_slave (void) NMConnection *connection; NMSettingConnection *s_con; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-slave", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bond-slave", NULL, TYPE_ETHERNET, NULL); g_test_assert_expected_messages (); @@ -8136,7 +8138,7 @@ test_write_bond_slave (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -8154,7 +8156,7 @@ test_read_infiniband (void) char expected_mac_address[INFINIBAND_ALEN] = { 0x80, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22 }; const char *transport_mode; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-infiniband", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-infiniband", NULL, TYPE_INFINIBAND, &unmanaged); g_assert (!unmanaged); @@ -8240,7 +8242,7 @@ test_write_infiniband (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, TYPE_INFINIBAND, NULL); @@ -8254,7 +8256,7 @@ test_read_bond_slave_ib (void) gs_unref_object NMConnection *connection = NULL; NMSettingConnection *s_con; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-slave-ib", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bond-slave-ib", NULL, NULL, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -8302,7 +8304,7 @@ test_write_bond_slave_ib (void) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); reread = _connection_from_file (testfile, NULL, NULL, NULL); @@ -8317,7 +8319,7 @@ test_read_bond_opts_mode_numeric (void) NMSettingConnection *s_con; NMSettingBond *s_bond; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-mode-numeric", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-bond-mode-numeric", NULL, TYPE_ETHERNET, NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "bond0"); @@ -8350,7 +8352,7 @@ test_read_dcb_basic (void) guint expected_traffic_classes[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; gboolean expected_pfcs[8] = { TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE }; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-dcb", NULL, TYPE_ETHERNET, NULL); s_dcb = nm_connection_get_setting_dcb (connection); @@ -8464,8 +8466,8 @@ test_write_dcb_basic (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts//ifcfg-dcb-test.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"//ifcfg-dcb-test.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL); @@ -8479,7 +8481,7 @@ test_read_dcb_default_app_priorities (void) gs_unref_object NMConnection *connection = NULL; NMSettingDcb *s_dcb; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-default-app-priorities", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-dcb-default-app-priorities", NULL, TYPE_ETHERNET, NULL); s_dcb = nm_connection_get_setting_dcb (connection); @@ -8501,7 +8503,7 @@ test_read_dcb_bad_booleans (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*invalid DCB_PG_STRICT value*not all 0s and 1s*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-bad-booleans", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-bad-booleans", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8515,7 +8517,7 @@ test_read_dcb_short_booleans (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*DCB_PG_STRICT value*8 characters*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-short-booleans", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-short-booleans", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8529,7 +8531,7 @@ test_read_dcb_bad_uints (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*invalid DCB_PG_UP2TC value*not 0 - 7*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-bad-uints", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-bad-uints", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8543,7 +8545,7 @@ test_read_dcb_short_uints (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*DCB_PG_UP2TC value*8 characters*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-short-uints", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-short-uints", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8557,7 +8559,7 @@ test_read_dcb_bad_percent (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*invalid DCB_PG_PCT percentage value*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-bad-percent", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-bad-percent", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8571,7 +8573,7 @@ test_read_dcb_short_percent (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*invalid DCB_PG_PCT percentage list value*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-short-percent", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-short-percent", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8585,7 +8587,7 @@ test_read_dcb_pgpct_not_100 (void) gs_free_error GError *error = NULL; NMTST_EXPECT_NM_WARN ("*DCB_PG_PCT percentages do not equal 100*"); - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-pgpct-not-100", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-dcb-pgpct-not-100", NULL, TYPE_ETHERNET, &error); g_test_assert_expected_messages (); @@ -8601,7 +8603,7 @@ test_read_fcoe_mode (gconstpointer user_data) const char *expected_mode = user_data; NMSettingDcb *s_dcb; - file = g_strdup_printf (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-fcoe-%s", expected_mode); + file = g_strdup_printf (TEST_IFCFG_DIR"/ifcfg-test-fcoe-%s", expected_mode); connection = _connection_from_file (file, NULL, TYPE_ETHERNET, NULL); s_dcb = nm_connection_get_setting_dcb (connection); @@ -8661,7 +8663,7 @@ test_write_fcoe_mode (gconstpointer user_data) nmtst_assert_connection_verifies (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); ifcfg = _svOpenFile (testfile); @@ -8782,7 +8784,7 @@ test_write_team_master (void) nmtst_assert_connection_verifies_without_normalization (connection); _writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile); f = _svOpenFile (testfile); @@ -8856,8 +8858,8 @@ test_write_team_port (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Team_Port.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Team_Port.cexpected", &testfile); f = _svOpenFile (testfile); @@ -8913,8 +8915,8 @@ test_write_team_infiniband_port (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Team_Infiniband_Port.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Team_Infiniband_Port.cexpected", &testfile); f = _svOpenFile (testfile); @@ -8936,7 +8938,7 @@ test_read_team_port_empty_config (void) NMConnection *connection; NMSettingConnection *s_con; - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port-empty-config", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-team-port-empty-config", NULL, TYPE_ETHERNET, NULL); s_con = nm_connection_get_setting_connection (connection); @@ -9001,9 +9003,9 @@ test_team_reread_slave (void) nmtst_assert_connection_equals (connection_1, FALSE, connection_2, FALSE); _writer_new_connection_reread ((nmtst_get_rand_int () % 2) ? connection_1 : connection_2, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR, &testfile, - TEST_IFCFG_DIR "/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected", + TEST_IFCFG_DIR"/ifcfg-team-slave-enp31s0f1-142.cexpected", &reread, &reread_same); _assert_reread_same ((nmtst_get_rand_int () % 2) ? connection_1 : connection_2, reread); @@ -9024,7 +9026,7 @@ test_read_proxy_basic (void) /* Test basic proxy configuration */ - connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-read-proxy-basic", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-read-proxy-basic", NULL, TYPE_ETHERNET, NULL); /* ===== Proxy setting ===== */ @@ -9076,8 +9078,8 @@ test_write_proxy_basic (void) nmtst_assert_connection_verifies (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-Test_Write_Proxy_Basic.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-Test_Write_Proxy_Basic.cexpected", &testfile); f = _svOpenFile (testfile); @@ -9472,7 +9474,7 @@ test_write_unknown (gconstpointer test_data) static void test_read_vlan_trailing_spaces (void) { - const char *testfile = TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-trailing-spaces"; + const char *testfile = TEST_IFCFG_DIR"/ifcfg-test-vlan-trailing-spaces"; NMConnection *connection; gboolean success; GError *error = NULL; @@ -9510,7 +9512,7 @@ test_sit_read_ignore (void) { gs_free_error GError *error = NULL; - _connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-sit-ignore", + _connection_from_file_fail (TEST_IFCFG_DIR"/ifcfg-test-sit-ignore", NULL, TYPE_ETHERNET, &error); nmtst_assert_error (error, 0, 0, "*Ignoring unsupported connection due to IPV6TUNNELIPV4*"); } @@ -9639,7 +9641,7 @@ test_tc_read (void) NMTCTfilter *filter; char *str; - connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-tc", + connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-tc", NULL, TYPE_ETHERNET,NULL); g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "eth0"); @@ -9740,8 +9742,8 @@ test_tc_write (void) nmtst_assert_connection_verifies_without_normalization (connection); _writer_new_connec_exp (connection, - TEST_SCRATCH_DIR "/network-scripts/", - TEST_IFCFG_DIR "/network-scripts/ifcfg-test-tc-write.cexpected", + TEST_SCRATCH_DIR, + TEST_IFCFG_DIR"/ifcfg-test-tc-write.cexpected", &testfile); reread = _connection_from_file (testfile, NULL, TYPE_BOND, NULL); @@ -9753,8 +9755,8 @@ test_tc_write (void) #define TPATH "/settings/plugins/ifcfg-rh/" -#define TEST_IFCFG_WIFI_OPEN_SSID_LONG_QUOTED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted" -#define TEST_IFCFG_WIFI_OPEN_SSID_LONG_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-hex" +#define TEST_IFCFG_WIFI_OPEN_SSID_LONG_QUOTED TEST_IFCFG_DIR"/ifcfg-test-wifi-open-ssid-long-quoted" +#define TEST_IFCFG_WIFI_OPEN_SSID_LONG_HEX TEST_IFCFG_DIR"/ifcfg-test-wifi-open-ssid-long-hex" #define DEFAULT_HEX_PSK "7d308b11df1b4243b0f78e5f3fc68cdbb9a264ed0edf4c188edf329ff5b467f0" @@ -9769,10 +9771,10 @@ int main (int argc, char **argv) g_test_add_func (TPATH "svUnescape", test_svUnescape); - g_test_add_data_func (TPATH "write-unknown/1", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-write-unknown-1", test_write_unknown); - g_test_add_data_func (TPATH "write-unknown/2", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-write-unknown-2", test_write_unknown); - g_test_add_data_func (TPATH "write-unknown/3", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-write-unknown-3", test_write_unknown); - g_test_add_data_func (TPATH "write-unknown/4", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-write-unknown-4", test_write_unknown); + g_test_add_data_func (TPATH "write-unknown/1", TEST_IFCFG_DIR"/ifcfg-test-write-unknown-1", test_write_unknown); + g_test_add_data_func (TPATH "write-unknown/2", TEST_IFCFG_DIR"/ifcfg-test-write-unknown-2", test_write_unknown); + g_test_add_data_func (TPATH "write-unknown/3", TEST_IFCFG_DIR"/ifcfg-test-write-unknown-3", test_write_unknown); + g_test_add_data_func (TPATH "write-unknown/4", TEST_IFCFG_DIR"/ifcfg-test-write-unknown-4", test_write_unknown); g_test_add_func (TPATH "vlan-trailing-spaces", test_read_vlan_trailing_spaces); @@ -9792,8 +9794,8 @@ int main (int argc, char **argv) g_test_add_func (TPATH "read-dns-options", test_read_dns_options); g_test_add_func (TPATH "clear-master", test_clear_master); - nmtst_add_test_func (TPATH "read-static", test_read_wired_static, TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static", "System test-wired-static", GINT_TO_POINTER (TRUE)); - nmtst_add_test_func (TPATH "read-static-bootproto", test_read_wired_static, TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-static-bootproto", "System test-wired-static-bootproto", GINT_TO_POINTER (FALSE)); + nmtst_add_test_func (TPATH "read-static", test_read_wired_static, TEST_IFCFG_DIR"/ifcfg-test-wired-static", "System test-wired-static", GINT_TO_POINTER (TRUE)); + nmtst_add_test_func (TPATH "read-static-bootproto", test_read_wired_static, TEST_IFCFG_DIR"/ifcfg-test-wired-static-bootproto", "System test-wired-static-bootproto", GINT_TO_POINTER (FALSE)); g_test_add_func (TPATH "read-netmask-1", test_read_netmask_1); @@ -9811,17 +9813,17 @@ int main (int argc, char **argv) g_test_add_func (TPATH "routes/read-static", test_read_wired_static_routes); g_test_add_func (TPATH "routes/read-static-legacy", test_read_wired_static_routes_legacy); - nmtst_add_test_func (TPATH "wired/read/manual/1", test_read_wired_ipv4_manual, TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-ipv4-manual-1", "System test-wired-ipv4-manual-1"); - nmtst_add_test_func (TPATH "wired/read/manual/2", test_read_wired_ipv4_manual, TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-ipv4-manual-2", "System test-wired-ipv4-manual-2"); - nmtst_add_test_func (TPATH "wired/read/manual/3", test_read_wired_ipv4_manual, TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-ipv4-manual-3", "System test-wired-ipv4-manual-3"); - nmtst_add_test_func (TPATH "wired/read/manual/4", test_read_wired_ipv4_manual, TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-ipv4-manual-4", "System test-wired-ipv4-manual-4"); + nmtst_add_test_func (TPATH "wired/read/manual/1", test_read_wired_ipv4_manual, TEST_IFCFG_DIR"/ifcfg-test-wired-ipv4-manual-1", "System test-wired-ipv4-manual-1"); + nmtst_add_test_func (TPATH "wired/read/manual/2", test_read_wired_ipv4_manual, TEST_IFCFG_DIR"/ifcfg-test-wired-ipv4-manual-2", "System test-wired-ipv4-manual-2"); + nmtst_add_test_func (TPATH "wired/read/manual/3", test_read_wired_ipv4_manual, TEST_IFCFG_DIR"/ifcfg-test-wired-ipv4-manual-3", "System test-wired-ipv4-manual-3"); + nmtst_add_test_func (TPATH "wired/read/manual/4", test_read_wired_ipv4_manual, TEST_IFCFG_DIR"/ifcfg-test-wired-ipv4-manual-4", "System test-wired-ipv4-manual-4"); g_test_add_func (TPATH "user/1", test_user_1); g_test_add_func (TPATH "wired/ipv6-manual", test_read_wired_ipv6_manual); - nmtst_add_test_func (TPATH "wired-ipv6-only/0", test_read_wired_ipv6_only, TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-only", "System test-wired-ipv6-only"); - nmtst_add_test_func (TPATH "wired-ipv6-only/1", test_read_wired_ipv6_only, TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-only-1", "System test-wired-ipv6-only-1"); + nmtst_add_test_func (TPATH "wired-ipv6-only/0", test_read_wired_ipv6_only, TEST_IFCFG_DIR"/ifcfg-test-wired-ipv6-only", "System test-wired-ipv6-only"); + nmtst_add_test_func (TPATH "wired-ipv6-only/1", test_read_wired_ipv6_only, TEST_IFCFG_DIR"/ifcfg-test-wired-ipv6-only-1", "System test-wired-ipv6-only-1"); g_test_add_func (TPATH "wired/dhcpv6-only", test_read_wired_dhcp6_only); g_test_add_func (TPATH "wired/autoip", test_read_wired_autoip); @@ -9829,8 +9831,8 @@ int main (int argc, char **argv) g_test_add_func (TPATH "wired/no-ip", test_read_noip); g_test_add_func (TPATH "802-1x/peap/mschapv2", test_read_wired_8021x_peap_mschapv2); - nmtst_add_test_func (TPATH "test-wired-8021x-tls/agent", test_read_wired_8021x_tls_secret_flags, TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-8021x-tls-agent", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED)); - nmtst_add_test_func (TPATH "test-wired-8021x-tls/always", test_read_wired_8021x_tls_secret_flags, TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-8021x-tls-always", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED)); + nmtst_add_test_func (TPATH "test-wired-8021x-tls/agent", test_read_wired_8021x_tls_secret_flags, TEST_IFCFG_DIR"/ifcfg-test-wired-8021x-tls-agent", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED)); + nmtst_add_test_func (TPATH "test-wired-8021x-tls/always", test_read_wired_8021x_tls_secret_flags, TEST_IFCFG_DIR"/ifcfg-test-wired-8021x-tls-always", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED)); g_test_add_func (TPATH "802-1x/subj-matches", test_read_write_802_1X_subj_matches); g_test_add_func (TPATH "802-1x/ttls-eapgtc", test_read_802_1x_ttls_eapgtc); @@ -9853,8 +9855,8 @@ int main (int argc, char **argv) g_test_add_func (TPATH "wifi/read/wep/104-ascii", test_read_wifi_wep_104_ascii); g_test_add_func (TPATH "wifi/read/leap", test_read_wifi_leap); - nmtst_add_test_func (TPATH "wifi-leap-secret-flags/agent", test_read_wifi_leap_secret_flags, TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-leap-agent", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED)); - nmtst_add_test_func (TPATH "wifi-leap-secret-flags/ask", test_read_wifi_leap_secret_flags, TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-leap-always-ask", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED)); + nmtst_add_test_func (TPATH "wifi-leap-secret-flags/agent", test_read_wifi_leap_secret_flags, TEST_IFCFG_DIR"/ifcfg-test-wifi-leap-agent", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED)); + nmtst_add_test_func (TPATH "wifi-leap-secret-flags/ask", test_read_wifi_leap_secret_flags, TEST_IFCFG_DIR"/ifcfg-test-wifi-leap-always-ask", GINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED)); g_test_add_func (TPATH "wifi/read/wpa-psk", test_read_wifi_wpa_psk); g_test_add_func (TPATH "wifi/read/wpa-psk/2", test_read_wifi_wpa_psk_2); @@ -10003,12 +10005,12 @@ int main (int argc, char **argv) g_test_add_func (TPATH "bridge/write-component", test_write_bridge_component); g_test_add_func (TPATH "bridge/read-missing-stp", test_read_bridge_missing_stp); - g_test_add_data_func (TPATH "team/read-master-1", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-master-1", test_read_team_master); - g_test_add_data_func (TPATH "team/read-master-2", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-master-2", test_read_team_master); - g_test_add_data_func (TPATH "team/read-master-invalid", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-master-invalid", test_read_team_master_invalid); + g_test_add_data_func (TPATH "team/read-master-1", TEST_IFCFG_DIR"/ifcfg-test-team-master-1", test_read_team_master); + g_test_add_data_func (TPATH "team/read-master-2", TEST_IFCFG_DIR"/ifcfg-test-team-master-2", test_read_team_master); + g_test_add_data_func (TPATH "team/read-master-invalid", TEST_IFCFG_DIR"/ifcfg-test-team-master-invalid", test_read_team_master_invalid); g_test_add_func (TPATH "team/write-master", test_write_team_master); - g_test_add_data_func (TPATH "team/read-port-1", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port-1", test_read_team_port); - g_test_add_data_func (TPATH "team/read-port-2", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port-2", test_read_team_port); + g_test_add_data_func (TPATH "team/read-port-1", TEST_IFCFG_DIR"/ifcfg-test-team-port-1", test_read_team_port); + g_test_add_data_func (TPATH "team/read-port-2", TEST_IFCFG_DIR"/ifcfg-test-team-port-2", test_read_team_port); g_test_add_func (TPATH "team/write-port", test_write_team_port); g_test_add_func (TPATH "team/write-infiniband-port", test_write_team_infiniband_port); g_test_add_func (TPATH "team/read-port-empty-config", test_read_team_port_empty_config); diff --git a/src/settings/plugins/ifupdown/tests/meson.build b/src/settings/plugins/ifupdown/tests/meson.build index 7f210034b8..ee3b6a340b 100644 --- a/src/settings/plugins/ifupdown/tests/meson.build +++ b/src/settings/plugins/ifupdown/tests/meson.build @@ -1,12 +1,10 @@ test_unit = 'test-ifupdown' -cflags = '-DTEST_ENI_DIR="@0@"'.format(meson.current_source_dir()) - exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: cflags, + c_args: nm_build_cflags, link_with: libnms_ifupdown_core ) diff --git a/src/settings/plugins/ifupdown/tests/test-ifupdown.c b/src/settings/plugins/ifupdown/tests/test-ifupdown.c index 56515438c2..18bad65e36 100644 --- a/src/settings/plugins/ifupdown/tests/test-ifupdown.c +++ b/src/settings/plugins/ifupdown/tests/test-ifupdown.c @@ -29,6 +29,10 @@ #include "nm-test-utils-core.h" +#define TEST_DIR NM_BUILD_SRCDIR"/src/settings/plugins/ifupdown/tests" + +/*****************************************************************************/ + typedef struct { char *key; char *data; @@ -659,45 +663,45 @@ main (int argc, char **argv) if (0) dump_blocks (); - g_test_add_data_func ("/ifupdate/ignore_line_before_first_block", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/ignore_line_before_first_block", TEST_DIR, (GTestDataFunc) test1_ignore_line_before_first_block); - g_test_add_data_func ("/ifupdate/wrapped_line", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/wrapped_line", TEST_DIR, (GTestDataFunc) test2_wrapped_line); - g_test_add_data_func ("/ifupdate/wrapped_multiline_multiarg", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/wrapped_multiline_multiarg", TEST_DIR, (GTestDataFunc) test3_wrapped_multiline_multiarg); - g_test_add_data_func ("/ifupdate/allow_auto_is_auto", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/allow_auto_is_auto", TEST_DIR, (GTestDataFunc) test4_allow_auto_is_auto); - g_test_add_data_func ("/ifupdate/allow_auto_multiarg", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/allow_auto_multiarg", TEST_DIR, (GTestDataFunc) test5_allow_auto_multiarg); - g_test_add_data_func ("/ifupdate/mixed_whitespace", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/mixed_whitespace", TEST_DIR, (GTestDataFunc) test6_mixed_whitespace); - g_test_add_data_func ("/ifupdate/long_line", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/long_line", TEST_DIR, (GTestDataFunc) test7_long_line); - g_test_add_data_func ("/ifupdate/long_line_wrapped", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/long_line_wrapped", TEST_DIR, (GTestDataFunc) test8_long_line_wrapped); - g_test_add_data_func ("/ifupdate/wrapped_lines_in_block", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/wrapped_lines_in_block", TEST_DIR, (GTestDataFunc) test9_wrapped_lines_in_block); - g_test_add_data_func ("/ifupdate/complex_wrap", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/complex_wrap", TEST_DIR, (GTestDataFunc) test11_complex_wrap); - g_test_add_data_func ("/ifupdate/complex_wrap_split_word", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/complex_wrap_split_word", TEST_DIR, (GTestDataFunc) test12_complex_wrap_split_word); - g_test_add_data_func ("/ifupdate/more_mixed_whitespace", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/more_mixed_whitespace", TEST_DIR, (GTestDataFunc) test13_more_mixed_whitespace); - g_test_add_data_func ("/ifupdate/mixed_whitespace_block_start", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/mixed_whitespace_block_start", TEST_DIR, (GTestDataFunc) test14_mixed_whitespace_block_start); - g_test_add_data_func ("/ifupdate/trailing_space", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/trailing_space", TEST_DIR, (GTestDataFunc) test15_trailing_space); - g_test_add_data_func ("/ifupdate/missing_newline", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/missing_newline", TEST_DIR, (GTestDataFunc) test16_missing_newline); - g_test_add_data_func ("/ifupdate/read_static_ipv4", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/read_static_ipv4", TEST_DIR, (GTestDataFunc) test17_read_static_ipv4); - g_test_add_data_func ("/ifupdate/read_static_ipv6", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/read_static_ipv6", TEST_DIR, (GTestDataFunc) test18_read_static_ipv6); - g_test_add_data_func ("/ifupdate/read_static_ipv4_plen", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/read_static_ipv4_plen", TEST_DIR, (GTestDataFunc) test19_read_static_ipv4_plen); - g_test_add_data_func ("/ifupdate/source_stanza", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/source_stanza", TEST_DIR, (GTestDataFunc) test20_source_stanza); - g_test_add_data_func ("/ifupdate/source_dir_stanza", TEST_ENI_DIR, + g_test_add_data_func ("/ifupdate/source_dir_stanza", TEST_DIR, (GTestDataFunc) test21_source_dir_stanza); return g_test_run (); diff --git a/src/settings/plugins/keyfile/tests/meson.build b/src/settings/plugins/keyfile/tests/meson.build index 54b4ee0d9d..33aaa26436 100644 --- a/src/settings/plugins/keyfile/tests/meson.build +++ b/src/settings/plugins/keyfile/tests/meson.build @@ -2,16 +2,11 @@ test_unit = 'test-keyfile' test_keyfiles_dir = join_paths(meson.current_source_dir(), 'keyfiles') -cflags = [ - '-DTEST_KEYFILES_DIR="@0@"'.format(test_keyfiles_dir), - '-DTEST_SCRATCH_DIR="@0@"'.format(test_keyfiles_dir) -] - exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: cflags + c_args: nm_build_cflags, ) test( diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index b684f926d8..a3045f7dfc 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -37,6 +37,9 @@ #include "nm-test-utils-core.h" +#define TEST_KEYFILES_DIR NM_BUILD_SRCDIR"/src/settings/plugins/keyfile/tests/keyfiles" +#define TEST_SCRATCH_DIR NM_BUILD_BUILDDIR"/src/settings/plugins/keyfile/tests/keyfiles" + /*****************************************************************************/ static void diff --git a/src/supplicant/tests/meson.build b/src/supplicant/tests/meson.build index e6a86b20b4..b8bad7f3b8 100644 --- a/src/supplicant/tests/meson.build +++ b/src/supplicant/tests/meson.build @@ -4,7 +4,7 @@ exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: '-DTEST_CERT_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'certs')) + c_args: nm_build_cflags, ) test( diff --git a/src/supplicant/tests/test-supplicant-config.c b/src/supplicant/tests/test-supplicant-config.c index 509e913d8c..36831e6767 100644 --- a/src/supplicant/tests/test-supplicant-config.c +++ b/src/supplicant/tests/test-supplicant-config.c @@ -37,6 +37,10 @@ #include "nm-test-utils-core.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/src/supplicant/tests/certs" + +/*****************************************************************************/ + static gboolean validate_opt (const char *detail, GVariant *config, diff --git a/src/systemd/sd-adapt/unaligned.h b/src/systemd/sd-adapt/unaligned.h new file mode 100644 index 0000000000..17dc04446c --- /dev/null +++ b/src/systemd/sd-adapt/unaligned.h @@ -0,0 +1,3 @@ +#pragma once + +#include "nm-utils/unaligned.h" diff --git a/src/systemd/src/basic/siphash24.h b/src/systemd/src/basic/siphash24.h new file mode 100644 index 0000000000..77bb9a8c07 --- /dev/null +++ b/src/systemd/src/basic/siphash24.h @@ -0,0 +1,53 @@ +#pragma once + +#include <inttypes.h> +#include <stddef.h> +#include <stdint.h> +#include <sys/types.h> + +#if 0 /* NM_IGNORED */ +struct siphash { + uint64_t v0; + uint64_t v1; + uint64_t v2; + uint64_t v3; + uint64_t padding; + size_t inlen; +}; +#else /* NM_IGNORED */ +struct siphash { + CSipHash _csiphash; +}; + +static inline void +siphash24_init (struct siphash *state, const uint8_t k[16]) +{ + c_siphash_init ((CSipHash *) state, k); +} + +static inline void +siphash24_compress (const void *in, size_t inlen, struct siphash *state) +{ + c_siphash_append ((CSipHash *) state, in, inlen); +} + +static inline uint64_t +siphash24_finalize (struct siphash *state) +{ + return c_siphash_finalize ((CSipHash *) state); +} + +static inline uint64_t +siphash24 (const void *in, size_t inlen, const uint8_t k[16]) +{ + return c_siphash_hash (k, in, inlen); +} +#endif /* NM_IGNORED */ + +void siphash24_init(struct siphash *state, const uint8_t k[16]); +void siphash24_compress(const void *in, size_t inlen, struct siphash *state); +#define siphash24_compress_byte(byte, state) siphash24_compress((const uint8_t[]) { (byte) }, 1, (state)) + +uint64_t siphash24_finalize(struct siphash *state); + +uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]); diff --git a/src/tests/config/meson.build b/src/tests/config/meson.build index fb40d9a971..f542c45354 100644 --- a/src/tests/config/meson.build +++ b/src/tests/config/meson.build @@ -7,16 +7,11 @@ sources = files( test_config_dir = meson.current_source_dir() -cflags = [ - '-DSRCDIR="@0@"'.format(test_config_dir), - '-DBUILDDIR="@0@"'.format(test_config_dir) -] - exe = executable( test_unit, sources, dependencies: test_nm_dep, - c_args: cflags + c_args: nm_build_cflags, ) test( diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index c0cbe42f57..75fef4fad1 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -30,6 +30,9 @@ #include "nm-test-utils-core.h" +#define TEST_DIR NM_BUILD_SRCDIR"/src/tests/config" +#define BUILD_DIR NM_BUILD_BUILDDIR"/src/tests/config" + /*****************************************************************************/ static void @@ -133,9 +136,9 @@ test_config_simple (void) gs_unref_object NMDevice *dev51 = nm_test_device_new ("00:00:00:00:00:51"); gs_unref_object NMDevice *dev52 = nm_test_device_new ("00:00:00:00:00:52"); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", NULL); + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", NULL); - g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf"); + g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, TEST_DIR "/NetworkManager.conf"); g_assert_cmpstr (_config_get_dhcp_client_a (config), ==, "dhclient"); g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO"); g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 100); @@ -206,7 +209,7 @@ test_config_non_existent (void) { GError *error = NULL; - setup_config (&error, SRCDIR "/no-such-file", "", NULL, "/no/such/dir", "", NULL); + setup_config (&error, TEST_DIR "/no-such-file", "", NULL, "/no/such/dir", "", NULL); g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND); g_clear_error (&error); } @@ -216,7 +219,7 @@ test_config_parse_error (void) { GError *error = NULL; - setup_config (&error, SRCDIR "/bad.conf", "", NULL, "/no/such/dir", "", NULL); + setup_config (&error, TEST_DIR "/bad.conf", "", NULL, "/no/such/dir", "", NULL); g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE); g_clear_error (&error); } @@ -227,12 +230,12 @@ test_config_override (void) gs_unref_object NMConfig *config = NULL; gs_strfreev char **plugins = NULL; - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", "--plugins", "alpha,beta,gamma,delta", "--connectivity-interval", "12", NULL); - g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf"); + g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, TEST_DIR "/NetworkManager.conf"); g_assert_cmpstr (_config_get_dhcp_client_a (config), ==, "dhclient"); g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO"); g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 12); @@ -253,7 +256,7 @@ test_config_global_dns (void) NMGlobalDnsDomain *domain; const char *const*strv; - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", NULL); dns = nm_config_data_get_global_dns_config (nm_config_get_data_orig (config)); @@ -308,7 +311,7 @@ test_config_global_dns (void) g_object_unref (config); /* Check that a file without a default domain section gives a NULL configuration */ - config = setup_config (NULL, SRCDIR "/global-dns-invalid.conf", "", NULL, + config = setup_config (NULL, TEST_DIR "/global-dns-invalid.conf", "", NULL, "/no/such/dir", "", NULL); dns = nm_config_data_get_global_dns_config (nm_config_get_data_orig (config)); g_assert (!dns); @@ -319,12 +322,12 @@ static void test_config_connectivity_check (void) { #if WITH_CONCHECK - const char *CONFIG_INTERN = BUILDDIR"/test-connectivity-check-intern.conf"; + const char *CONFIG_INTERN = BUILD_DIR"/test-connectivity-check-intern.conf"; NMConfig *config; NMConnectivity *connectivity; g_assert (g_file_set_contents (CONFIG_INTERN, "", 0, NULL)); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", CONFIG_INTERN, NULL, + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", CONFIG_INTERN, NULL, "/no/such/dir", "", NULL); connectivity = nm_connectivity_get(); @@ -371,7 +374,7 @@ test_config_no_auto_default (void) g_assert_cmpint (nwrote, ==, 18); nm_close (fd); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", "--no-auto-default", state_file, NULL); @@ -393,7 +396,7 @@ test_config_no_auto_default (void) g_object_unref (config); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", "--no-auto-default", state_file, NULL); @@ -421,9 +424,9 @@ test_config_confdir (void) char *value; GSList *specs; - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL); + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", NULL); - g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf"); + g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, TEST_DIR "/NetworkManager.conf"); g_assert_cmpstr (_config_get_dhcp_client_a (config), ==, "dhcpcd"); g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO"); g_assert_cmpstr (nm_config_get_log_domains (config), ==, "PLATFORM,DNS,WIFI"); @@ -524,8 +527,8 @@ test_config_confdir_parse_error (void) { GError *error = NULL; - /* Using SRCDIR as the conf dir will pick up bad.conf */ - setup_config (&error, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR, "", NULL); + /* Using TEST_DIR as the conf dir will pick up bad.conf */ + setup_config (&error, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR, "", NULL); g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE); g_clear_error (&error); } @@ -808,8 +811,8 @@ static void test_config_set_values (void) { gs_unref_object NMConfig *config = NULL; - const char *CONFIG_USER = BUILDDIR"/test-set-values-user.conf"; - const char *CONFIG_INTERN = BUILDDIR"/test-set-values-intern.conf"; + const char *CONFIG_USER = BUILD_DIR"/test-set-values-user.conf"; + const char *CONFIG_INTERN = BUILD_DIR"/test-set-values-intern.conf"; const char *atomic_section_prefixes[] = { "atomic-prefix-1.", "atomic-prefix-2.", @@ -893,7 +896,7 @@ test_config_signal (void) NMConfigChangeFlags expected; gs_unref_object NMConfigData *config_data_orig = NULL; - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL); + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", NULL); config_data_orig = g_object_ref (nm_config_get_data_orig (config)); @@ -945,19 +948,19 @@ test_config_enable (void) _nm_config_match_env = g_strdup ("something-else"); _nm_config_match_nm_version = nm_encode_version (1, 3, 4); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL); + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", NULL); assert_config_value (nm_config_get_data_orig (config), "test-group-config-enable-1", "key1", NULL); g_clear_object (&config); _nm_config_match_nm_version = nm_encode_version (1, 5, 32); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL); + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", NULL); assert_config_value (nm_config_get_data_orig (config), "test-group-config-enable-1", "key1", "enabled"); g_clear_object (&config); _nm_config_match_nm_version = nm_encode_version (1, 5, 3); g_clear_pointer (&_nm_config_match_env, g_free); _nm_config_match_env = g_strdup ("test-match-env-1"); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL); + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", NULL); assert_config_value (nm_config_get_data_orig (config), "test-group-config-enable-1", "key1", "enabled"); g_clear_object (&config); @@ -977,14 +980,14 @@ test_config_state_file (void) gboolean ret; gs_free char *file_data = NULL; gsize file_size; - const char *const TMP_FILE = BUILDDIR "/tmp.state"; + const char *const TMP_FILE = BUILD_DIR "/tmp.state"; - ret = g_file_get_contents (SRCDIR "/NetworkManager.state", &file_data, &file_size, &error); + ret = g_file_get_contents (TEST_DIR "/NetworkManager.state", &file_data, &file_size, &error); nmtst_assert_success (ret, error); ret = g_file_set_contents (TMP_FILE, file_data, file_size, &error); nmtst_assert_success (ret, error); - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", "--state-file", TMP_FILE, NULL); g_assert (config); @@ -1010,7 +1013,7 @@ test_config_state_file (void) g_object_unref (config); /* Reload configuration */ - config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", + config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", "--state-file", TMP_FILE, NULL); g_assert (config); diff --git a/src/tests/meson.build b/src/tests/meson.build index 386ede8782..430ffe43dc 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -33,7 +33,7 @@ cflags = [ exe = executable( test_unit, - [test_unit + '.c'] + shared_siphash, + [test_unit + '.c'], include_directories: src_inc, dependencies: nm_core_dep, c_args: cflags, |