envutil.rb: diagnostic_reports for ruby-runner

* test/lib/envutil.rb (EnvUtil.diagnostic_reports): ruby-runner
  execs "RUBY_INSTALL_NAME" file, so search by that name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-02-20 02:16:22 +00:00
Родитель 4d47e8d993
Коммит fca3cf6637
2 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -4,6 +4,10 @@ require "open3"
require "timeout"
require_relative "find_executable"
require "rbconfig/sizeof"
begin
require 'rbconfig'
rescue LoadError
end
class Integer
FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2))
@ -227,9 +231,12 @@ module EnvUtil
if /darwin/ =~ RUBY_PLATFORM
DIAGNOSTIC_REPORTS_PATH = File.expand_path("~/Library/Logs/DiagnosticReports")
DIAGNOSTIC_REPORTS_TIMEFORMAT = '%Y-%m-%d-%H%M%S'
def self.diagnostic_reports(signame, cmd, pid, now)
@ruby_install_name = RbConfig::CONFIG['RUBY_INSTALL_NAME']
def self.diagnostic_reports(signame, pid, now)
return unless %w[ABRT QUIT SEGV ILL TRAP].include?(signame)
cmd = File.basename(cmd)
cmd = rubybin
cmd = @ruby_install_name if %r{/ruby-runner#{Regexp.quote(RbConfig::CONFIG["EXEEXT"])}\z}o =~ cmd
path = DIAGNOSTIC_REPORTS_PATH
timeformat = DIAGNOSTIC_REPORTS_TIMEFORMAT
pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.crash"
@ -248,7 +255,7 @@ module EnvUtil
nil
end
else
def self.diagnostic_reports(signame, cmd, pid, now)
def self.diagnostic_reports(signame, pid, now)
end
end
@ -261,10 +268,7 @@ module EnvUtil
end
end
begin
require 'rbconfig'
rescue LoadError
else
if defined?(RbConfig)
module RbConfig
@ruby = EnvUtil.rubybin
class << self

Просмотреть файл

@ -509,7 +509,7 @@ EOT
signame = Signal.signame(signo)
sigdesc = "signal #{signo}"
end
log = EnvUtil.diagnostic_reports(signame, EnvUtil.rubybin, pid, now)
log = EnvUtil.diagnostic_reports(signame, pid, now)
if signame
sigdesc = "SIG#{signame} (#{sigdesc})"
end
@ -540,7 +540,7 @@ EOT
success: nil, **opt)
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
if signo = status.termsig
EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now)
EnvUtil.diagnostic_reports(Signal.signame(signo), status.pid, Time.now)
end
if block_given?
raise "test_stdout ignored, use block only or without block" if test_stdout != []