aboutsummaryrefslogtreecommitdiffstats
path: root/test/rinda
diff options
context:
space:
mode:
Diffstat (limited to 'test/rinda')
-rw-r--r--test/rinda/test_rinda.rb27
1 files changed, 22 insertions, 5 deletions
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb
index 38909f90df..20aef9dc15 100644
--- a/test/rinda/test_rinda.rb
+++ b/test/rinda/test_rinda.rb
@@ -559,6 +559,15 @@ class TestRingServer < Test::Unit::TestCase
end
def test_do_reply
+ tl0 = Thread.list
+ tl = nil
+ th = Thread.new(Thread.current) do |mth|
+ sleep 1
+ (tl = Thread.list - tl0).each {|t|t.raise(Timeout::Error)}
+ mth.raise(Timeout::Error)
+ end
+ tl0 << th
+
called = nil
callback = proc { |ts|
@@ -567,11 +576,6 @@ class TestRingServer < Test::Unit::TestCase
callback = DRb::DRbObject.new callback
- th = Thread.new(Thread.current) do |mth|
- sleep 15
- mth.raise unless called
- end
-
@ts.write [:lookup_ring, callback]
@rs.do_reply
@@ -585,6 +589,19 @@ class TestRingServer < Test::Unit::TestCase
end
assert_same @ts, called
+ rescue Timeout::Error => e
+ if tl
+ bt = e.backtrace
+ tl.each do |t|
+ begin
+ t.value
+ rescue Timeout::Error => e
+ bt.unshift("")
+ bt[0, 0] = e.backtrace
+ end
+ end
+ end
+ raise Timeout::Error, "timeout", bt
ensure
th.kill if th
end