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

test/ruby/test_process.rb: use io/wait instead of timeout

Occasionally I get timeout errors during this test on an
overloaded system, so we may need to increase timeouts anyways.
For now, avoid the overhead of thread creation for every read we
do.

* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
  use IO#wait_readable instead of timeout

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2014-10-23 01:37:04 +00:00
parent 000e2b816d
commit a8ed25ea12
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Thu Oct 23 10:22:41 2014 Eric Wong <e@80x24.org>
* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
use IO#wait_readable instead of timeout
Thu Oct 23 10:22:24 2014 Eric Wong <e@80x24.org>
* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):

View file

@ -1,6 +1,7 @@
require 'test/unit'
require 'tempfile'
require 'timeout'
require 'io/wait'
require_relative 'envutil'
require 'rbconfig'
@ -1946,13 +1947,12 @@ EOS
ew.close
begin
loop do
Timeout.timeout(5) do
runner.readpartial(100)
end
runner.wait_readable(5)
runner.read_nonblock(100)
end
rescue EOFError => e
_, status = Process.wait2(runner.pid)
rescue Timeout::Error => e
rescue IO::WaitReadable => e
Process.kill(:INT, runner.pid)
raise Marshal.load(er.read.unpack("m")[0])
end