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