From d98dd4731391cc95bc34830e6415aab32d091013 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 23 Jul 2016 14:59:25 +0000 Subject: 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 --- test/dtrace/helper.rb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'test/dtrace/helper.rb') diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb index a479b1adb7..5a2ff79682 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] -- cgit v1.2.3