ruby-changes:39123
From: nobu <ko1@a...>
Date: Thu, 9 Jul 2015 16:55:19 +0900 (JST)
Subject: [ruby-changes:39123] nobu:r51204 (trunk): test_process.rb: test for [Bug #11340]
nobu 2015-07-09 16:54:56 +0900 (Thu, 09 Jul 2015) New Revision: 51204 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51204 Log: test_process.rb: test for [Bug #11340] * test/ruby/test_process.rb (test_wait_exception): test for r51202 and r51203. [Bug #11340] Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 51203) +++ test/ruby/test_process.rb (revision 51204) @@ -1369,6 +1369,29 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1369 end end + def test_wait_exception + bug11340 = '[ruby-dev:49176] [Bug #11340]' + t0 = t1 = nil + IO.popen([RUBY, '-e', 'puts;STDOUT.flush;Thread.start{gets;exit};sleep(3)'], 'r+') do |f| + pid = f.pid + f.gets + t0 = Time.now + th = Thread.start(Thread.current) do |main| + Thread.pass until main.stop? + main.raise Interrupt + end + begin + assert_raise(Interrupt) {Process.wait(pid)} + ensure + th.kill.join + end + t1 = Time.now + f.puts + end + assert_operator(t1 - t0, :<, 3, + ->{"#{bug11340}: #{t1-t0} seconds to interrupt Process.wait"}) + end + def test_abort with_tmpchdir do s = run_in_child("abort") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/