Skip to content

Commit

Permalink
Exclude unsupported getaddrinfo flags (#3930)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
johnxwork authored Aug 6, 2024
1 parent a4dadc8 commit 62cdd00
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 62cdd00

Please sign in to comment.