mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
44011ee041
commit
301d669a31
1 changed files with 11 additions and 2 deletions
|
@ -63,6 +63,7 @@ class TestTrace < Test::Unit::TestCase
|
||||||
def test_trace_stackoverflow
|
def test_trace_stackoverflow
|
||||||
assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}", timeout: 60)
|
assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}", timeout: 60)
|
||||||
begin;
|
begin;
|
||||||
|
require 'timeout'
|
||||||
require 'tracer'
|
require 'tracer'
|
||||||
class HogeError < StandardError
|
class HogeError < StandardError
|
||||||
def to_s
|
def to_s
|
||||||
|
@ -70,8 +71,16 @@ class TestTrace < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Tracer.stdout = open(IO::NULL, "w")
|
Tracer.stdout = open(IO::NULL, "w")
|
||||||
Tracer.on
|
begin
|
||||||
HogeError.new.to_s
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue