From 713e99cec284a7bfdfdc6b598102028e0f844b8f Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 17 Feb 2010 17:19:53 +0000 Subject: * io.c (io_fread, io_getpartial, io_read, io_sysread): by using lock, prohibit modification of buffer string during read (which had caused EFAULT or SEGV). [ruby-dev:40437] * test/ruby/test_io.rb: rewrite tests for the old behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 6d7f94eaab..5fc3b133dd 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -823,15 +823,15 @@ class TestIO < Test::Unit::TestCase end) end - def test_readpartial_error + def test_readpartial_lock with_pipe do |r, w| s = "" t = Thread.new { r.readpartial(5, s) } 0 until s.size == 5 - s.clear + assert_raise(RuntimeError) { s.clear } w.write "foobarbaz" w.close - assert_raise(RuntimeError) { t.join } + assert_equal("fooba", t.value) end end @@ -858,15 +858,15 @@ class TestIO < Test::Unit::TestCase end) end - def test_read_error + def test_read_lock with_pipe do |r, w| s = "" t = Thread.new { r.read(5, s) } 0 until s.size == 5 - s.clear + assert_raise(RuntimeError) { s.clear } w.write "foobarbaz" w.close - assert_raise(RuntimeError) { t.join } + assert_equal("fooba", t.value) end end -- cgit v1.2.3