ruby-changes:66287
From: Nobuyoshi <ko1@a...>
Date: Fri, 21 May 2021 18:26:40 +0900 (JST)
Subject: [ruby-changes:66287] e9974a466a (master): Get rid of sporadic WSAEACCES on Windows
https://git.ruby-lang.org/ruby.git/commit/?id=e9974a466a From e9974a466ac7edcb8035f5f7bc65c4c6731e2ee2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 20 May 2021 20:15:43 +0900 Subject: Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661] --- test/socket/test_addrinfo.rb | 7 ++++++- test/socket/test_socket.rb | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index 1421c15..e068c6c 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -363,7 +363,12 @@ class TestSocketAddrinfo < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/socket/test_addrinfo.rb#L363 def random_port # IANA suggests dynamic port for 49152 to 65535 # http://www.iana.org/assignments/port-numbers - 49152 + rand(65535-49152+1) + case RUBY_PLATFORM + when /mingw|mswin/ + rand(50000..65535) + else + rand(49152..65535) + end end def errors_addrinuse diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 77ce093..16c359e 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -172,7 +172,10 @@ class TestSocket < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/socket/test_socket.rb#L172 end def errors_addrinuse - [Errno::EADDRINUSE] + errs = [Errno::EADDRINUSE] + # MinGW fails with "Errno::EACCES: Permission denied - bind(2) for 0.0.0.0:49721" + errs << Errno::EACCES if /mingw/ =~ RUBY_PLATFORM + errs end def test_tcp_server_sockets -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/