mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-26 06:30:36 +01:00
libnm/tests: mark team tests as skipped without JSON validation
We should not just disable tests with an #if. Instead, mark them as skipped. This way, we still compile them, and we even run them (showing a message why they are skipped).
This commit is contained in:
parent
a178fbac26
commit
35c92cf582
2 changed files with 24 additions and 6 deletions
|
|
@ -626,11 +626,15 @@ test_team_conf_read_valid (void)
|
|||
static void
|
||||
test_team_conf_read_invalid (void)
|
||||
{
|
||||
#if WITH_JSON_VALIDATION
|
||||
GKeyFile *keyfile = NULL;
|
||||
gs_unref_object NMConnection *con = NULL;
|
||||
NMSettingTeam *s_team;
|
||||
|
||||
if (!WITH_JSON_VALIDATION) {
|
||||
g_test_skip ("team test requires JSON validation");
|
||||
return;
|
||||
}
|
||||
|
||||
con = nmtst_create_connection_from_keyfile (
|
||||
"[connection]\n"
|
||||
"type=team\n"
|
||||
|
|
@ -645,7 +649,6 @@ test_team_conf_read_invalid (void)
|
|||
g_assert (nm_setting_team_get_config (s_team) == NULL);
|
||||
|
||||
CLEAR (&con, &keyfile);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -45,6 +45,15 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* assert that the define is just a plain integer (boolean). */
|
||||
|
||||
G_STATIC_ASSERT ( (WITH_JSON_VALIDATION) == 1
|
||||
|| (WITH_JSON_VALIDATION) == 0);
|
||||
|
||||
_nm_unused static const int _with_json_validation = WITH_JSON_VALIDATION;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* converts @dict to a connection. In this case, @dict must be good, without warnings, so that
|
||||
* NM_SETTING_PARSE_FLAGS_STRICT and NM_SETTING_PARSE_FLAGS_BEST_EFFORT yield the exact same results. */
|
||||
static NMConnection *
|
||||
|
|
@ -966,7 +975,6 @@ test_dcb_bandwidth_sums (void)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if WITH_JSON_VALIDATION
|
||||
static void
|
||||
_test_team_config_sync (const char *team_config,
|
||||
int notify_peer_count,
|
||||
|
|
@ -989,6 +997,11 @@ _test_team_config_sync (const char *team_config,
|
|||
guint i, j;
|
||||
gboolean found;
|
||||
|
||||
if (!WITH_JSON_VALIDATION) {
|
||||
g_test_skip ("team test requires JSON validation");
|
||||
return;
|
||||
}
|
||||
|
||||
s_team = (NMSettingTeam *) nm_setting_team_new ();
|
||||
g_assert (s_team);
|
||||
|
||||
|
|
@ -1250,6 +1263,11 @@ _test_team_port_config_sync (const char *team_port_config,
|
|||
guint i, j;
|
||||
gboolean found;
|
||||
|
||||
if (!WITH_JSON_VALIDATION) {
|
||||
g_test_skip ("team test requires JSON validation");
|
||||
return;
|
||||
}
|
||||
|
||||
s_team_port = (NMSettingTeamPort *) nm_setting_team_port_new ();
|
||||
g_assert (s_team_port);
|
||||
|
||||
|
|
@ -1354,7 +1372,6 @@ test_team_port_full_config (void)
|
|||
"\"send_always\": true}]}",
|
||||
10, 20, true, 30, 40, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -3251,7 +3268,6 @@ main (int argc, char **argv)
|
|||
|
||||
g_test_add_func ("/libnm/settings/bridge/vlans", test_bridge_vlans);
|
||||
|
||||
#if WITH_JSON_VALIDATION
|
||||
g_test_add_func ("/libnm/settings/team/sync_runner_from_config_roundrobin",
|
||||
test_runner_roundrobin_sync_from_config);
|
||||
g_test_add_func ("/libnm/settings/team/sync_runner_from_config_broadcast",
|
||||
|
|
@ -3280,7 +3296,6 @@ main (int argc, char **argv)
|
|||
g_test_add_func ("/libnm/settings/team-port/sync_from_config_lacp_prio", test_team_port_lacp_prio);
|
||||
g_test_add_func ("/libnm/settings/team-port/sync_from_config_lacp_key", test_team_port_lacp_key);
|
||||
g_test_add_func ("/libnm/settings/team-port/sycn_from_config_full", test_team_port_full_config);
|
||||
#endif
|
||||
|
||||
g_test_add_data_func ("/libnm/settings/roundtrip-conversion/general/0", GINT_TO_POINTER (0), test_roundtrip_conversion);
|
||||
g_test_add_data_func ("/libnm/settings/roundtrip-conversion/wireguard/1", GINT_TO_POINTER (1), test_roundtrip_conversion);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue