summaryrefslogtreecommitdiff
path: root/test/socket/test_addrinfo.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-20 20:15:43 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-21 18:26:07 +0900
commite9974a466ac7edcb8035f5f7bc65c4c6731e2ee2 (patch)
tree5761b90323f43709f3d87c830c46c559be46793b /test/socket/test_addrinfo.rb
parent817764bd82513e2a0a672f5958f65854ea172c08 (diff)
Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661]
Diffstat (limited to 'test/socket/test_addrinfo.rb')
-rw-r--r--test/socket/test_addrinfo.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index 1421c153a0..e068c6c216 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -363,7 +363,12 @@ class TestSocketAddrinfo < Test::Unit::TestCase
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