ruby-changes:36024
From: normal <ko1@a...>
Date: Thu, 23 Oct 2014 10:37:09 +0900 (JST)
Subject: [ruby-changes:36024] normal:r48105 (trunk): test/ruby/test_process.rb: use io/wait instead of timeout
normal 2014-10-23 10:37:04 +0900 (Thu, 23 Oct 2014) New Revision: 48105 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48105 Log: 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 Modified files: trunk/ChangeLog trunk/test/ruby/test_process.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 48104) +++ ChangeLog (revision 48105) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Oct 23 10:22:41 2014 Eric Wong <e@8...> + + * 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@8...> * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking): Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 48104) +++ test/ruby/test_process.rb (revision 48105) @@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1 require 'test/unit' require 'tempfile' require 'timeout' +require 'io/wait' require_relative 'envutil' require 'rbconfig' @@ -1946,13 +1947,12 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1947 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/