diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-25 17:50:34 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-25 17:50:34 +0000 |
commit | 301d669a3150762c51473fde9c486169241e2ec0 (patch) | |
tree | bde4fdb4addca8a4e44a92e13bb2ab34302b563e /test/ruby/test_trace.rb | |
parent | 44011ee0412a09610835a2dce8a3c0fca45a1364 (diff) |
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/test_trace.rb')
-rw-r--r-- | test/ruby/test_trace.rb | 13 |
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 |