[前][次][番号順一覧][スレッド一覧]

ruby-changes:61478

From: Yusuke <ko1@a...>
Date: Thu, 4 Jun 2020 11:24:36 +0900 (JST)
Subject: [ruby-changes:61478] 980655ce83 (master): test/socket/test_addrinfo.rb: Suppress Errno::EACCES when addr is in use

https://git.ruby-lang.org/ruby.git/commit/?id=980655ce83

From 980655ce8319f7c96f286ac0abdfbc98b2090a96 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 4 Jun 2020 11:22:12 +0900
Subject: test/socket/test_addrinfo.rb: Suppress Errno::EACCES when addr is in
 use

MinGW seems to raise Errno::EACCES instead of EADDRINUSE when bind fails
due to in use.

https://github.com/ruby/ruby/runs/736825846
```
  2) Error:
TestSocketAddrinfo#test_connect_from:
Errno::EACCES: Permission denied - bind(2) for 0.0.0.0:49721
    D:/a/ruby/ruby/build/.ext/common/socket.rb:54:in `bind'
    D:/a/ruby/ruby/build/.ext/common/socket.rb:54:in `connect_internal'
    D:/a/ruby/ruby/build/.ext/common/socket.rb:114:in `connect_from'
    D:/a/ruby/ruby/src/test/socket/test_addrinfo.rb:379:in `block in test_connect_from'
    D:/a/ruby/ruby/src/test/socket/test_addrinfo.rb:374:in `open'
    D:/a/ruby/ruby/src/test/socket/test_addrinfo.rb:374:in `test_connect_from'
```

diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index 92b61ea..d023fdd 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -367,7 +367,10 @@ class TestSocketAddrinfo < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/socket/test_addrinfo.rb#L367
   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 if /mingw/ =~ RUBY_PLATFORM
+    errs
   end
 
   def test_connect_from
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]