summaryrefslogtreecommitdiff
path: root/test/dtrace/helper.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-06 00:59:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-06 00:59:12 +0000
commit8ee121d060ed7b3191e86c981fe144be2e19953a (patch)
treeeb4e32e04ebcdc35c7b5ca36ffd7e4a2c82c6105 /test/dtrace/helper.rb
parent8483e9bd58620460b261a2c47ede8237ab219651 (diff)
downloadbundler-8ee121d060ed7b3191e86c981fe144be2e19953a.tar.gz
* 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
Diffstat (limited to 'test/dtrace/helper.rb')
-rw-r--r--test/dtrace/helper.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb
index 7a327a8695..a462851dbf 100644
--- a/test/dtrace/helper.rb
+++ b/test/dtrace/helper.rb
@@ -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