mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-16 03:38:06 +02:00
libnm/tests: fix dead code in WireGuard roundtrip test
The inner condition at line 4086 duplicated the outer check for NM_CONNECTION_SERIALIZE_ALL, making the else-if branch for NM_CONNECTION_SERIALIZE_WITH_NON_SECRET unreachable. This meant the non-secret serialization path was never actually tested. Restructure to make both branches reachable. Found by Coverity (CID: DEADCODE). Fixes:395a78618b('libnm/tests: add tests for creating wireguard connection profiles') Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commitca326bd636)
This commit is contained in:
parent
530a8934f5
commit
e42c1f6171
1 changed files with 6 additions and 7 deletions
|
|
@ -4082,13 +4082,12 @@ test_roundtrip_conversion(gconstpointer test_data)
|
|||
if (flag == NM_CONNECTION_SERIALIZE_ALL) {
|
||||
s_wg2 = NM_SETTING_WIREGUARD(
|
||||
nm_connection_get_setting(con2, NM_TYPE_SETTING_WIREGUARD));
|
||||
|
||||
if (flag == NM_CONNECTION_SERIALIZE_ALL)
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, TRUE, TRUE, FALSE);
|
||||
else if (flag == NM_CONNECTION_SERIALIZE_WITH_NON_SECRET)
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, FALSE, FALSE, TRUE);
|
||||
else
|
||||
g_assert_not_reached();
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, TRUE, TRUE, FALSE);
|
||||
} else if (flag == NM_CONNECTION_SERIALIZE_WITH_NON_SECRET) {
|
||||
con2 = _connection_new_from_dbus_strict(con_var, FALSE);
|
||||
s_wg2 = NM_SETTING_WIREGUARD(
|
||||
nm_connection_get_setting(con2, NM_TYPE_SETTING_WIREGUARD));
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, FALSE, FALSE, TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue