summaryrefslogtreecommitdiff
path: root/server/XfrmControllerTest.cpp
diff options
context:
space:
mode:
authorJonathan Basseri <misterikkit@google.com>2017-09-14 16:40:47 -0700
committerJonathan Basseri <misterikkit@google.com>2017-09-14 18:16:54 -0700
commit8fc43f5938f581cc0d24a7ce650e9c68726ad746 (patch)
treedcec3e8cfbba1e9b8926d5044d24c8441691b2fc /server/XfrmControllerTest.cpp
parentfc3b35f7b391d7917d54b0c9fa331c5daf408702 (diff)
Fix flaky XfrmControllerTest.
Several tests were comparing partially uninitialized structs. Bug: 65495297 Test: runtest -x system/netd/server/netd_unit_test.cpp Change-Id: Ia093b470e1119c1275615b569820d7ddf44fb8dd
Diffstat (limited to 'server/XfrmControllerTest.cpp')
-rw-r--r--server/XfrmControllerTest.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/XfrmControllerTest.cpp b/server/XfrmControllerTest.cpp
index 07db8444..dea1584b 100644
--- a/server/XfrmControllerTest.cpp
+++ b/server/XfrmControllerTest.cpp
@@ -157,11 +157,11 @@ TEST_F(XfrmControllerTest, TestIpSecAllocateSpi) {
EXPECT_EQ(AF_INET, userspi.info.sel.family);
- xfrm_address_t saddr;
+ xfrm_address_t saddr{};
inet_pton(AF_INET, "127.0.0.1", reinterpret_cast<void*>(&saddr));
EXPECT_EQ(0, memcmp(&saddr, &userspi.info.saddr, sizeof(xfrm_address_t)));
- xfrm_address_t daddr;
+ xfrm_address_t daddr{};
inet_pton(AF_INET, "8.8.8.8", reinterpret_cast<void*>(&daddr));
EXPECT_EQ(0, memcmp(&daddr, &userspi.info.id.daddr, sizeof(xfrm_address_t)));
@@ -206,11 +206,11 @@ TEST_F(XfrmControllerTest, TestIpSecAllocateSpiIpv6) {
EXPECT_EQ(AF_INET6, userspi.info.sel.family);
- xfrm_address_t saddr;
+ xfrm_address_t saddr{};
inet_pton(AF_INET6, "::1", reinterpret_cast<void*>(&saddr));
EXPECT_EQ(0, memcmp(&saddr, &userspi.info.saddr, sizeof(xfrm_address_t)));
- xfrm_address_t daddr;
+ xfrm_address_t daddr{};
inet_pton(AF_INET6, "2001:4860:4860::8888", reinterpret_cast<void*>(&daddr));
EXPECT_EQ(0, memcmp(&daddr, &userspi.info.id.daddr, sizeof(xfrm_address_t)));
@@ -378,7 +378,7 @@ TEST_F(XfrmControllerTest, TestIpSecDeleteSecurityAssociation) {
netdutils::extract(nlMsgSlice, said);
EXPECT_EQ(htonl(DROID_SPI), said.spi);
- xfrm_address_t daddr;
+ xfrm_address_t daddr{};
inet_pton(AF_INET, "8.8.8.8", reinterpret_cast<void*>(&daddr));
EXPECT_EQ(0, memcmp(&daddr, &said.daddr, sizeof(xfrm_address_t)));