提交 6bcedea2 编写于 作者: R Rafael Mendonça França

Merge pull request #15845 from robin850/jruby-isolation

Make the isolated tests run on JRuby
...@@ -70,14 +70,24 @@ def run_in_isolation(&blk) ...@@ -70,14 +70,24 @@ def run_in_isolation(&blk)
exit! exit!
else else
Tempfile.open("isolation") do |tmpfile| Tempfile.open("isolation") do |tmpfile|
ENV["ISOLATION_TEST"] = self.class.name env = {
ENV["ISOLATION_OUTPUT"] = tmpfile.path ISOLATION_TEST: self.class.name,
ISOLATION_OUTPUT: tmpfile.path
}
load_paths = $-I.map {|p| "-I\"#{File.expand_path(p)}\"" }.join(" ") load_paths = $-I.map {|p| "-I\"#{File.expand_path(p)}\"" }.join(" ")
`#{Gem.ruby} #{load_paths} #{$0} #{ORIG_ARGV.join(" ")}` orig_args = ORIG_ARGV.join(" ")
test_opts = "-n#{self.class.name}##{self.name}"
ENV.delete("ISOLATION_TEST") command = "#{Gem.ruby} #{load_paths} #{$0} #{orig_args} #{test_opts}"
ENV.delete("ISOLATION_OUTPUT")
# IO.popen lets us pass env in a cross-platform way
child = IO.popen([env, command])
begin
Process.wait(child.pid)
rescue Errno::ECHILD # The child process may exit before we wait
nil
end
return tmpfile.read.unpack("m")[0] return tmpfile.read.unpack("m")[0]
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册