summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-21 16:36:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-21 16:36:41 +0000
commit300d60a8e425ef35a18f46d74fd582473cfafc4e (patch)
treebe6cc600d7c2ea25fd87dfb323c8614ddcaf73f5 /bootstraptest
parent09d18a1a8f1aded0b6d8ac63908e3b1da36cfc75 (diff)
* bootstraptest/test_io.rb: block write may block for long time.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_io.rb29
1 files changed, 16 insertions, 13 deletions
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index 83b38f8cce..2294654211 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -11,19 +11,22 @@ assert_finish 5, %q{
assert_finish 10, %q{
begin
require "io/nonblock"
- r, w = IO.pipe
- w.nonblock = true
- w.write_nonblock("a" * 100000)
- w.nonblock = false
- t1 = Thread.new { w.write("b" * 4096) }
- t2 = Thread.new { w.write("c" * 4096) }
- sleep 0.5
- r.sysread(4096).length
- sleep 0.5
- r.sysread(4096).length
- t1.join
- t2.join
- rescue LoadError
+ require "timeout"
+ timeout(3) do
+ r, w = IO.pipe
+ w.nonblock = true
+ w.write_nonblock("a" * 100000)
+ w.nonblock = false
+ t1 = Thread.new { w.write("b" * 4096) }
+ t2 = Thread.new { w.write("c" * 4096) }
+ sleep 0.5
+ r.sysread(4096).length
+ sleep 0.5
+ r.sysread(4096).length
+ t1.join
+ t2.join
+ end
+ rescue LoadError, TimeoutError
end
}, '[ruby-dev:32566]'