mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_exception.rb: test_machine_stackoverflow_by_trace
* test/ruby/test_exception.rb (test_machine_stackoverflow_by_trace): move from test_trace.rb and rename, to be excluded by the default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6924066a65
commit
0280d1fb9a
2 changed files with 24 additions and 24 deletions
|
@ -604,6 +604,30 @@ end.join
|
|||
rescue SystemStackError
|
||||
end
|
||||
|
||||
def test_machine_stackoverflow_by_trace
|
||||
assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}", timeout: 60)
|
||||
begin;
|
||||
require 'timeout'
|
||||
require 'tracer'
|
||||
class HogeError < StandardError
|
||||
def to_s
|
||||
message.upcase # disable tailcall optimization
|
||||
end
|
||||
end
|
||||
Tracer.stdout = open(IO::NULL, "w")
|
||||
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
|
||||
|
||||
def test_cause
|
||||
msg = "[Feature #8257]"
|
||||
cause = nil
|
||||
|
|
|
@ -59,28 +59,4 @@ class TestTrace < Test::Unit::TestCase
|
|||
a.any? {true}
|
||||
}.value, bug2722)
|
||||
end
|
||||
|
||||
def test_trace_stackoverflow
|
||||
assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}", timeout: 60)
|
||||
begin;
|
||||
require 'timeout'
|
||||
require 'tracer'
|
||||
class HogeError < StandardError
|
||||
def to_s
|
||||
message.upcase # disable tailcall optimization
|
||||
end
|
||||
end
|
||||
Tracer.stdout = open(IO::NULL, "w")
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue