ruby-changes:16354
From: mame <ko1@a...>
Date: Wed, 16 Jun 2010 00:08:51 +0900 (JST)
Subject: [ruby-changes:16354] Ruby:r28330 (trunk): * test/ruby/test_io.rb (safe_4): does not use Timeout because
mame 2010-06-16 00:08:29 +0900 (Wed, 16 Jun 2010) New Revision: 28330 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28330 Log: * test/ruby/test_io.rb (safe_4): does not use Timeout because Timeout.timeout uses Thread#kill which raises SecurityError when $SAFE == 4. based on a patch from Tomoyuki Chikanaga. [ruby-dev:41484] * test/ruby/test_io.rb (test_print_separators): use pipe (test helper method) instead of IO.pipe. [ruby-dev:41484] Modified files: trunk/ChangeLog trunk/test/ruby/test_io.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 28329) +++ ChangeLog (revision 28330) @@ -1,3 +1,13 @@ +Wed Jun 16 00:04:38 2010 Yusuke Endoh <mame@t...> + + * test/ruby/test_io.rb (safe_4): does not use Timeout because + Timeout.timeout uses Thread#kill which raises SecurityError when + $SAFE == 4. based on a patch from Tomoyuki Chikanaga. + [ruby-dev:41484] + + * test/ruby/test_io.rb (test_print_separators): use pipe (test helper + method) instead of IO.pipe. [ruby-dev:41484] + Tue Jun 15 17:14:58 2010 WATANABE Hirofumi <eban@r...> * ext/fiddle/extconf.rb: De Morgan's laws. Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 28329) +++ test/ruby/test_io.rb (revision 28330) @@ -740,12 +740,14 @@ end def safe_4 - Thread.new do - Timeout.timeout(10) do - $SAFE = 4 - yield - end - end.join + t = Thread.new do + $SAFE = 4 + yield + end + unless t.join(10) + t.kill + flunk("timeout in safe_4") + end end def pipe(wp, rp) @@ -1461,15 +1463,16 @@ def test_print_separators $, = ':' $\ = "\n" - r, w = IO.pipe - w.print('a') - w.print('a','b','c') - w.close - assert_equal("a\n", r.gets) - assert_equal("a:b:c\n", r.gets) - assert_nil r.gets - r.close - + pipe(proc do |w| + w.print('a') + w.print('a','b','c') + w.close + end, proc do |r| + assert_equal("a\n", r.gets) + assert_equal("a:b:c\n", r.gets) + assert_nil r.gets + r.close + end) ensure $, = nil $\ = nil -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/