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:
parent
4d47e8d993
commit
fca3cf6637
@ -4,6 +4,10 @@ require "open3"
|
|||||||
require "timeout"
|
require "timeout"
|
||||||
require_relative "find_executable"
|
require_relative "find_executable"
|
||||||
require "rbconfig/sizeof"
|
require "rbconfig/sizeof"
|
||||||
|
begin
|
||||||
|
require 'rbconfig'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
class Integer
|
class Integer
|
||||||
FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2))
|
FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2))
|
||||||
@ -227,9 +231,12 @@ module EnvUtil
|
|||||||
if /darwin/ =~ RUBY_PLATFORM
|
if /darwin/ =~ RUBY_PLATFORM
|
||||||
DIAGNOSTIC_REPORTS_PATH = File.expand_path("~/Library/Logs/DiagnosticReports")
|
DIAGNOSTIC_REPORTS_PATH = File.expand_path("~/Library/Logs/DiagnosticReports")
|
||||||
DIAGNOSTIC_REPORTS_TIMEFORMAT = '%Y-%m-%d-%H%M%S'
|
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)
|
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
|
path = DIAGNOSTIC_REPORTS_PATH
|
||||||
timeformat = DIAGNOSTIC_REPORTS_TIMEFORMAT
|
timeformat = DIAGNOSTIC_REPORTS_TIMEFORMAT
|
||||||
pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.crash"
|
pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.crash"
|
||||||
@ -248,7 +255,7 @@ module EnvUtil
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
def self.diagnostic_reports(signame, cmd, pid, now)
|
def self.diagnostic_reports(signame, pid, now)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -261,10 +268,7 @@ module EnvUtil
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
if defined?(RbConfig)
|
||||||
require 'rbconfig'
|
|
||||||
rescue LoadError
|
|
||||||
else
|
|
||||||
module RbConfig
|
module RbConfig
|
||||||
@ruby = EnvUtil.rubybin
|
@ruby = EnvUtil.rubybin
|
||||||
class << self
|
class << self
|
||||||
|
@ -509,7 +509,7 @@ EOT
|
|||||||
signame = Signal.signame(signo)
|
signame = Signal.signame(signo)
|
||||||
sigdesc = "signal #{signo}"
|
sigdesc = "signal #{signo}"
|
||||||
end
|
end
|
||||||
log = EnvUtil.diagnostic_reports(signame, EnvUtil.rubybin, pid, now)
|
log = EnvUtil.diagnostic_reports(signame, pid, now)
|
||||||
if signame
|
if signame
|
||||||
sigdesc = "SIG#{signame} (#{sigdesc})"
|
sigdesc = "SIG#{signame} (#{sigdesc})"
|
||||||
end
|
end
|
||||||
@ -540,7 +540,7 @@ EOT
|
|||||||
success: nil, **opt)
|
success: nil, **opt)
|
||||||
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
|
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
|
||||||
if signo = status.termsig
|
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
|
end
|
||||||
if block_given?
|
if block_given?
|
||||||
raise "test_stdout ignored, use block only or without block" if test_stdout != []
|
raise "test_stdout ignored, use block only or without block" if test_stdout != []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user