1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

revert r65820 and retry assert_finish

From: MSP-Greg <greg.mpls@gmail.com>

5187ea768f

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-11-20 02:16:30 +00:00
parent 5187ea768f
commit 59676f6d03
3 changed files with 12 additions and 8 deletions

View file

@ -37,11 +37,3 @@ assert_normal_exit %q{
r.instance_eval { initialize r, r } r.instance_eval { initialize r, r }
r.inspect r.inspect
} }
# This test randomly fails on AppVeyor msys2 with:
# test_thread.rb: A non-blocking socket operation could not be completed immediately. - read would block
assert_finish 3, %{
th = Thread.new {sleep 0.2}
th.join(0.1)
th.join
}

View file

@ -383,8 +383,14 @@ def assert_finish(timeout_seconds, testsrc, message = '')
end end
if io.respond_to?(:read_nonblock) if io.respond_to?(:read_nonblock)
if IO.select([io], nil, nil, diff) if IO.select([io], nil, nil, diff)
tries = 0
begin begin
io.read_nonblock(1024) io.read_nonblock(1024)
rescue IO::WaitReadable
IO.select([io])
tries += 1
break if tries > 3
retry
rescue Errno::EAGAIN, EOFError rescue Errno::EAGAIN, EOFError
break break
end while true end while true

View file

@ -248,6 +248,12 @@ assert_equal 'ok', %{
$result $result
} }
assert_finish 3, %{
th = Thread.new {sleep 0.2}
th.join(0.1)
th.join
}
assert_finish 3, %{ assert_finish 3, %{
require 'timeout' require 'timeout'
th = Thread.new {sleep 0.2} th = Thread.new {sleep 0.2}