зеркало из https://github.com/github/ruby.git
Handle `Timeout::Error` reported from workers
This commit is contained in:
Родитель
9c973f9555
Коммит
4f4016497e
|
@ -1065,7 +1065,7 @@ module Test
|
|||
runner.add_status(" = #$1")
|
||||
when /\A\.+\z/
|
||||
runner.succeed
|
||||
when /\A\.*[EFS][EFS.]*\z/
|
||||
when /\A\.*[EFST][EFST.]*\z/
|
||||
runner.failed(s)
|
||||
else
|
||||
$stdout.print(s)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
|
||||
|
||||
require 'test/unit'
|
||||
require 'timeout'
|
||||
|
||||
class TestForTestTimeout < Test::Unit::TestCase
|
||||
10.times do |i|
|
||||
define_method("test_timeout_#{i}") do
|
||||
Timeout.timeout(0.001) do
|
||||
sleep
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
|
||||
class TestTiemout < Test::Unit::TestCase
|
||||
def test_timeout
|
||||
cmd = [*@options[:ruby], "#{File.dirname(__FILE__)}/test4test_timeout.rb"]
|
||||
result = IO.popen(cmd, err: [:child, :out], &:read)
|
||||
assert_not_match(/^T{10}$/, result)
|
||||
end
|
||||
end
|
Загрузка…
Ссылка в новой задаче