Skip to content

Commit

Permalink
Cherry pick PR #3930: Exclude unsupported getaddrinfo flags (#3984)
Browse files Browse the repository at this point in the history
Refer to the original PR: #3930

The failing test was actually not intended for Android because Android
is not a modular build and `getaddrinfo` does not go through abi wrapper
translation. And the test failed because Android uses bionic libc and is
not fully posix-compliant. I took a look at the flag usage across all of
Cobalt's dependencies and did not see usage of most flags except for
`AI_ADDRCONFIG` which does still work on Android. So we exclude the
unused flags from test for non-modular build here.

b/357161000

Change-Id: I62c935e6792f10bdc80ba9ecfcebae69a011a60f

Co-authored-by: johnx <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and johnxwork authored Aug 16, 2024
1 parent 2162303 commit 0c5180c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions starboard/nplb/posix_compliance/posix_socket_resolve_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,16 @@ TEST(PosixSocketResolveTest, SunnyDayFamily) {
TEST(PosixSocketResolveTest, SunnyDayFlags) {
struct addrinfo hints = {0};
int flags_to_test[] = {
AI_PASSIVE, AI_ADDRCONFIG, AI_PASSIVE, AI_CANONNAME, AI_V4MAPPED, AI_ALL,
// Non-modular builds use native libc getaddrinfo.
#if defined(SB_MODULAR_BUILD)
// And bionic does not support these flags.
AI_V4MAPPED, AI_NUMERICHOST, AI_NUMERICSERV,
#endif
AI_PASSIVE, AI_CANONNAME, AI_ADDRCONFIG,
};
for (auto flag : flags_to_test) {
hints.ai_flags |= flag;
hints.ai_flags = flag;
hints.ai_socktype = SOCK_STREAM;
struct addrinfo* ai = nullptr;

int result = getaddrinfo(kTestHostName, 0, &hints, &ai);
Expand Down

0 comments on commit 0c5180c

Please sign in to comment.