From 62cdd00f7d24b315636cf369acda5545b8d82ce8 Mon Sep 17 00:00:00 2001 From: johnx Date: Tue, 6 Aug 2024 23:51:39 +0800 Subject: [PATCH] Exclude unsupported getaddrinfo flags (#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 --- .../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);