From 57ca531f76417a44e8a050361e4e5f5bfb084861 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 24 Apr 2026 08:18:41 +0900 Subject: [PATCH] mruby-socket: skip localhost-dependent addrinfo tests on Windows Addrinfo.getaddrinfo("localhost", ...) and Addrinfo.foreach("localhost", ...) crash on GitHub Actions Windows runners (Windows Server 2022 and 2025, both mingw-gcc and MSVC). Diagnostic showed 127.0.0.1 as a numeric literal resolves fine via Winsock getaddrinfo, but "localhost" as a hostname returns WSAHOST_NOT_FOUND under every address family (AF_INET, AF_INET6, AF_UNSPEC, nil). PowerShell Resolve-DnsName on the same runner succeeds, so the failure is Winsock-specific rather than OS-level. Earlier workarounds (Dnscache service start, hosts file append) had no effect. Skip both tests on Windows with the existing SocketTest.win? guard, matching the pattern already used for Addrinfo.unix and Addrinfo#afamily. Linux and macOS coverage is unaffected. Co-authored-by: Claude --- mrbgems/mruby-socket/test/addrinfo.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mrbgems/mruby-socket/test/addrinfo.rb b/mrbgems/mruby-socket/test/addrinfo.rb index ce70a984c..90ea763fd 100644 --- a/mrbgems/mruby-socket/test/addrinfo.rb +++ b/mrbgems/mruby-socket/test/addrinfo.rb @@ -28,6 +28,7 @@ assert('Addrinfo.getaddrinfo diagnostic') do end assert('Addrinfo.getaddrinfo') do + skip "localhost resolution unreliable in Windows getaddrinfo" if SocketTest.win? ary = Addrinfo.getaddrinfo("localhost", 53, Socket::AF_INET, Socket::SOCK_STREAM) assert_true(ary.size >= 1) ai = ary[0] @@ -39,6 +40,7 @@ assert('Addrinfo.getaddrinfo') do end assert('Addrinfo.foreach') do + skip "localhost resolution unreliable in Windows getaddrinfo" if SocketTest.win? # assume Addrinfo.getaddrinfo works well a = Addrinfo.getaddrinfo("localhost", 80) b = []