diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-20 02:16:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-20 02:16:22 +0000 |
commit | 6d2199fc311c2a4e42347c61bf999a169480dd2f (patch) | |
tree | f2d227a2b47cb31d33c38ba2dc9fa1c7d8b2b61b /test/lib | |
parent | 7bcd7b09cb8d586fb9cf74134ea796b86d900b75 (diff) | |
download | ruby-6d2199fc311c2a4e42347c61bf999a169480dd2f.tar.gz |
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
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/envutil.rb | 18 | ||||
-rw-r--r-- | test/lib/test/unit/assertions.rb | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/test/lib/envutil.rb b/test/lib/envutil.rb index 89721754a2..60c924041c 100644 --- a/test/lib/envutil.rb +++ b/test/lib/envutil.rb @@ -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 diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb index facbc5873e..d605d7997f 100644 --- a/test/lib/test/unit/assertions.rb +++ b/test/lib/test/unit/assertions.rb @@ -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 != [] |