提交 efb835c9 编写于 作者: A Aaron Patterson

UnexpectedErrors may reference exceptions that can't be dumped

UnexpectedError exceptions wrap the original exception, and the original
exception may contain a reference to something that can't be marshal
dumped which will cause the process to die.
上级 c6af3bad
......@@ -484,6 +484,9 @@ def shutdown
method = job[1]
reporter = job[2]
result = Minitest.run_one_method klass, method
if result.error?
translate_exceptions result
end
queue.record reporter, result
end
}
......@@ -491,6 +494,20 @@ def shutdown
@size.times { @queue << nil }
pool.each { |pid| Process.waitpid pid }
end
private
def translate_exceptions(result)
result.failures.map! { |e|
begin
Marshal.dump e
e
rescue TypeError
ex = Exception.new e.message
ex.set_backtrace e.backtrace
Minitest::UnexpectedError.new ex
end
}
end
end
if ActiveSupport::Testing::Isolation.forking_env? && PROCESS_COUNT > 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册