summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-23 14:59:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-23 14:59:25 +0000
commitd98dd4731391cc95bc34830e6415aab32d091013 (patch)
treea7d3e2da04f6a2a3a90664d2c9d50384b49948aa
parent9662ee0584083d73c5e9a4aa6db13ed431df22e2 (diff)
dtrace: use miniruby instead of ruby-runner
* test/dtrace/helper.rb (DTrace::TestCase#trap_probe): ruby-runner cannot be the target of dtrace, use miniruby instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/dtrace/helper.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb
index a479b1a..5a2ff79 100644
--- a/test/dtrace/helper.rb
+++ b/test/dtrace/helper.rb
@@ -15,6 +15,21 @@ module DTrace
class TestCase < Test::Unit::TestCase
INCLUDE = File.expand_path('..', File.dirname(__FILE__))
+ case RUBY_PLATFORM
+ when /solaris/i
+ # increase bufsize to 8m (default 4m on Solaris)
+ DTRACE_CMD = %w[dtrace -b 8m]
+ end
+
+ DTRACE_CMD ||= %w[dtrace]
+
+ case rubybin = EnvUtil.rubybin
+ when /\/ruby-runner#{Regexp.quote(RbConfig::CONFIG["EXEEXT"])}\z/
+ RUBYBIN = File.dirname(rubybin)+"/miniruby#{RbConfig::CONFIG["EXEEXT"]}"
+ else
+ RUBYBIN = rubybin
+ end
+
def trap_probe d_program, ruby_program
d = Tempfile.new(%w'probe .d')
d.write d_program
@@ -27,15 +42,7 @@ module DTrace
d_path = d.path
rb_path = rb.path
- case RUBY_PLATFORM
- when /solaris/i
- # increase bufsize to 8m (default 4m on Solaris)
- cmd = [ "dtrace", "-b", "8m" ]
- else
- cmd = [ "dtrace" ]
- end
-
- cmd.concat [ "-q", "-s", d_path, "-c", "#{EnvUtil.rubybin} -I#{INCLUDE} #{rb_path}"]
+ cmd = [*DTRACE_CMD, "-q", "-s", d_path, "-c", "#{RUBYBIN} -I#{INCLUDE} #{rb_path}"]
if sudo = @@sudo
[RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].each do |name|
if name and val = ENV[name]