1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/dtrace/helper.rb (DTrace::TestCase#trap_probe): needs to pass

some paths by environment variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-04-06 00:59:12 +00:00
parent 8483e9bd58
commit 8ee121d060

View file

@ -13,7 +13,7 @@ end
ok &= (`dtrace -V` rescue false)
module DTrace
class TestCase < MiniTest::Unit::TestCase
INCLUDE = File.expand_path(File.join(File.dirname(__FILE__), '..'))
INCLUDE = File.expand_path('..', File.dirname(__FILE__))
def trap_probe d_program, ruby_program
d = Tempfile.new('probe.d')
@ -28,7 +28,14 @@ module DTrace
rb_path = rb.path
cmd = ["dtrace", "-q", "-s", d_path, "-c", "#{EnvUtil.rubybin} -I#{INCLUDE} #{rb_path}"]
sudo = ENV["SUDO"] and cmd.unshift(sudo)
if sudo = ENV["SUDO"]
[RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].each do |name|
if name and val = ENV[name]
cmd.unshift("#{name}=#{val}")
end
end
cmd.unshift(sudo)
end
probes = IO.popen(cmd) do |io|
io.readlines
end