Commit b7426e91 authored by Thomas Haller's avatar Thomas Haller

build: use default NM_BUILD_* defines for tests

Use two common defines NM_BUILD_SRCDIR and NM_BUILD_BUILDDIR
for specifying the location of srcdir and builddir.

Note that this is only relevant for tests, as they expect
a certain layout of the directories, to find files that concern
them.
parent 7fcf3390
......@@ -672,9 +672,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)
......@@ -870,7 +871,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)
......@@ -1091,9 +1092,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 \
......@@ -1821,7 +1823,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
......@@ -1922,8 +1925,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) \
......@@ -2033,10 +2036,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) \
......@@ -2174,8 +2177,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) \
......@@ -2482,10 +2485,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) \
......@@ -2912,13 +2916,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)
......@@ -3085,7 +3089,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
......@@ -3113,8 +3118,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
......@@ -3325,11 +3330,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)
......@@ -4128,11 +4134,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 \
......@@ -4344,7 +4350,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 \
......@@ -4485,11 +4491,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 \
......
......@@ -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
)
......
......@@ -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,
......
......@@ -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(
......
......@@ -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-----";
......
......@@ -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"
......
......@@ -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"
......
......@@ -37,6 +37,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
/*****************************************************************************/
static void
......
......@@ -197,9 +197,7 @@ libnm_glib = shared_library(
sources: 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),
......
......@@ -16,10 +16,11 @@ foreach test_unit: test_units
test_unit,
[test_unit + '.c'] + shared_test_utils,
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(
......
......@@ -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'
......
......@@ -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-----";
......
......@@ -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);
......
......@@ -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"
......
......@@ -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,
......
......@@ -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
......
......@@ -13,8 +13,7 @@ deps = [
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(
......
......@@ -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);
}
}
......
......@@ -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(
......
......@@ -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);
}
......
......@@ -4,7 +4,6 @@ exe = executable(
test_unit,
test_unit + '.c',
dependencies: test_nm_dep,
c_args: '-DTESTDIR="@0@"'.format(meson.source_root())
)
test(
......
......@@ -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
)
......
......@@ -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 ();
}
......
......@@ -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
)
......
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
)
......
......@@ -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 ();
......
......@@ -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(
......
......@@ -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
......
......@@ -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(
......
......@@ -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,
......
......@@ -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(
......
......@@ -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);