From 0c5180c823baeb9664906916c7f123188cac7721 Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Fri, 16 Aug 2024 13:49:40 -0700 Subject: [PATCH] Cherry pick PR #3930: Exclude unsupported getaddrinfo flags (#3984) Refer to the original PR: https://github.com/youtube/cobalt/pull/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 --- .../nplb/posix_compliance/posix_socket_resolve_test.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/starboard/nplb/posix_compliance/posix_socket_resolve_test.cc b/starboard/nplb/posix_compliance/posix_socket_resolve_test.cc index 3f7a749af8e5..e2d2026150df 100644 --- a/starboard/nplb/posix_compliance/posix_socket_resolve_test.cc +++ b/starboard/nplb/posix_compliance/posix_socket_resolve_test.cc @@ -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);