ruby-changes:46526
From: nobu <ko1@a...>
Date: Wed, 10 May 2017 15:38:41 +0900 (JST)
Subject: [ruby-changes:46526] nobu:r58647 (trunk): test_exception.rb: test_machine_stackoverflow_by_trace
nobu 2017-05-10 15:38:30 +0900 (Wed, 10 May 2017) New Revision: 58647 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58647 Log: 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. Modified files: trunk/test/ruby/test_exception.rb trunk/test/ruby/test_trace.rb Index: test/ruby/test_exception.rb =================================================================== --- test/ruby/test_exception.rb (revision 58646) +++ test/ruby/test_exception.rb (revision 58647) @@ -604,6 +604,30 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L604 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 Index: test/ruby/test_trace.rb =================================================================== --- test/ruby/test_trace.rb (revision 58646) +++ test/ruby/test_trace.rb (revision 58647) @@ -59,28 +59,4 @@ class TestTrace < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_trace.rb#L59 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/