aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-25 17:50:34 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-25 17:50:34 +0000
commit97f9765a0e4b1d6e3aa2665aaaeb048092953ffa (patch)
treebde4fdb4addca8a4e44a92e13bb2ab34302b563e /test/ruby
parentc673b7fbeb8c5e4de73dc20331caf00ee2b9950f (diff)
downloadruby-97f9765a0e4b1d6e3aa2665aaaeb048092953ffa.tar.gz
add timeout.
* test/ruby/test_trace.rb (test_trace_stackoverflow): sometimes this test was stopped forever and killed by test process forcibly. However, this test only checks if this code cause some critical failure such as SEGV. So that we can add timeout for this code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_trace.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/ruby/test_trace.rb b/test/ruby/test_trace.rb
index d7a683b083..434da70107 100644
--- a/test/ruby/test_trace.rb
+++ b/test/ruby/test_trace.rb
@@ -63,6 +63,7 @@ class TestTrace < Test::Unit::TestCase
def test_trace_stackoverflow
assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}", timeout: 60)
begin;
+ require 'timeout'
require 'tracer'
class HogeError < StandardError
def to_s
@@ -70,8 +71,16 @@ class TestTrace < Test::Unit::TestCase
end
end
Tracer.stdout = open(IO::NULL, "w")
- Tracer.on
- HogeError.new.to_s
+ begin
+ Timeout.timeout(5) do
+ Tracer.on
+ HogeError.new.to_s
+ end
+ rescue Timeout::Error
+ # ok. there are no SEGV or critical error
+ rescue SystemStackError => e
+ # ok.
+ end
end;
end
end