Loading libnetd_resolv_test.cpp +13 −11 Original line number Diff line number Diff line Loading @@ -131,7 +131,8 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters) { char* ai_canonname; struct sockaddr* ai_addr; struct addrinfo* ai_next; int expected_errorno; // expected result int expected_eai_error; std::string asParameters() const { return StringPrintf("0x%x/%u/%s/%p/%p", ai_flags, ai_addrlen, Loading Loading @@ -167,7 +168,7 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters) { rv = android_getaddrinfofornetcontext("localhost", nullptr /*servname*/, &hints, &mNetcontext, &result); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); if (result) { freeaddrinfo(result); Loading Loading @@ -256,7 +257,8 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters_PortNameAndNumber) { int ai_family; int ai_socktype; const char* servname; int expected_errorno; // expected result int expected_eai_error; std::string asParameters() const { return StringPrintf("0x%x/%d/%d/%s", ai_flags, ai_family, ai_socktype, Loading Loading @@ -320,7 +322,7 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters_PortNameAndNumber) { struct addrinfo* result = nullptr; int rv = android_getaddrinfofornetcontext("localhost", config.servname, &hints, &mNetcontext, &result); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); if (result) freeaddrinfo(result); } Loading Loading @@ -398,7 +400,7 @@ TEST_F(GetAddrInfoForNetContextTest, ServerResponseError) { static const struct TestConfig { ns_rcode rcode; int expected_errorno; // expected result int expected_eai_error; // Only test failure RCODE [1..5] in RFC 1035 section 4.1.1 and skip successful RCODE 0 // which means no error. Loading Loading @@ -429,7 +431,7 @@ TEST_F(GetAddrInfoForNetContextTest, ServerResponseError) { const struct addrinfo hints = {.ai_family = AF_UNSPEC}; int rv = android_getaddrinfofornetcontext(host_name, nullptr, &hints, &mNetcontext, &result); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); if (result) freeaddrinfo(result); } Loading Loading @@ -523,7 +525,7 @@ TEST_F(GetHostByNameForNetContextTest, ServerResponseError) { static const struct TestConfig { ns_rcode rcode; int expected_errorno; // expected result int expected_eai_error; // expected result // Only test failure RCODE [1..5] in RFC 1035 section 4.1.1 and skip successful RCODE 0 // which means no error. Note that the return error codes aren't mapped by rcode in the Loading Loading @@ -555,7 +557,7 @@ TEST_F(GetHostByNameForNetContextTest, ServerResponseError) { struct hostent* hp = nullptr; int rv = android_gethostbynamefornetcontext(host_name, AF_INET, &mNetcontext, &hp); EXPECT_TRUE(hp == nullptr); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); } } Loading Loading
libnetd_resolv_test.cpp +13 −11 Original line number Diff line number Diff line Loading @@ -131,7 +131,8 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters) { char* ai_canonname; struct sockaddr* ai_addr; struct addrinfo* ai_next; int expected_errorno; // expected result int expected_eai_error; std::string asParameters() const { return StringPrintf("0x%x/%u/%s/%p/%p", ai_flags, ai_addrlen, Loading Loading @@ -167,7 +168,7 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters) { rv = android_getaddrinfofornetcontext("localhost", nullptr /*servname*/, &hints, &mNetcontext, &result); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); if (result) { freeaddrinfo(result); Loading Loading @@ -256,7 +257,8 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters_PortNameAndNumber) { int ai_family; int ai_socktype; const char* servname; int expected_errorno; // expected result int expected_eai_error; std::string asParameters() const { return StringPrintf("0x%x/%d/%d/%s", ai_flags, ai_family, ai_socktype, Loading Loading @@ -320,7 +322,7 @@ TEST_F(GetAddrInfoForNetContextTest, InvalidParameters_PortNameAndNumber) { struct addrinfo* result = nullptr; int rv = android_getaddrinfofornetcontext("localhost", config.servname, &hints, &mNetcontext, &result); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); if (result) freeaddrinfo(result); } Loading Loading @@ -398,7 +400,7 @@ TEST_F(GetAddrInfoForNetContextTest, ServerResponseError) { static const struct TestConfig { ns_rcode rcode; int expected_errorno; // expected result int expected_eai_error; // Only test failure RCODE [1..5] in RFC 1035 section 4.1.1 and skip successful RCODE 0 // which means no error. Loading Loading @@ -429,7 +431,7 @@ TEST_F(GetAddrInfoForNetContextTest, ServerResponseError) { const struct addrinfo hints = {.ai_family = AF_UNSPEC}; int rv = android_getaddrinfofornetcontext(host_name, nullptr, &hints, &mNetcontext, &result); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); if (result) freeaddrinfo(result); } Loading Loading @@ -523,7 +525,7 @@ TEST_F(GetHostByNameForNetContextTest, ServerResponseError) { static const struct TestConfig { ns_rcode rcode; int expected_errorno; // expected result int expected_eai_error; // expected result // Only test failure RCODE [1..5] in RFC 1035 section 4.1.1 and skip successful RCODE 0 // which means no error. Note that the return error codes aren't mapped by rcode in the Loading Loading @@ -555,7 +557,7 @@ TEST_F(GetHostByNameForNetContextTest, ServerResponseError) { struct hostent* hp = nullptr; int rv = android_gethostbynamefornetcontext(host_name, AF_INET, &mNetcontext, &hp); EXPECT_TRUE(hp == nullptr); EXPECT_EQ(config.expected_errorno, rv); EXPECT_EQ(config.expected_eai_error, rv); } } Loading