dtrace: suppress an empty line
* test/dtrace/helper.rb (DTrace::TestCase#trap_probe): suppress an extra empty line to the controlling tty by dtrace on Darwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d98dd47313
commit
106445d144
@ -10,6 +10,16 @@ elsif (sudo = ENV["SUDO"]) and !sudo.empty? and (`#{sudo} echo ok` rescue false)
|
|||||||
else
|
else
|
||||||
ok = false
|
ok = false
|
||||||
end
|
end
|
||||||
|
if ok
|
||||||
|
case RUBY_PLATFORM
|
||||||
|
when /darwin/i
|
||||||
|
begin
|
||||||
|
require 'pty'
|
||||||
|
rescue LoadError
|
||||||
|
ok = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
ok &= (`dtrace -V` rescue false)
|
ok &= (`dtrace -V` rescue false)
|
||||||
module DTrace
|
module DTrace
|
||||||
class TestCase < Test::Unit::TestCase
|
class TestCase < Test::Unit::TestCase
|
||||||
@ -19,10 +29,20 @@ module DTrace
|
|||||||
when /solaris/i
|
when /solaris/i
|
||||||
# increase bufsize to 8m (default 4m on Solaris)
|
# increase bufsize to 8m (default 4m on Solaris)
|
||||||
DTRACE_CMD = %w[dtrace -b 8m]
|
DTRACE_CMD = %w[dtrace -b 8m]
|
||||||
|
when /darwin/i
|
||||||
|
READ_PROBES = proc do |cmd|
|
||||||
|
PTY.spawn(*cmd) do |io, _|
|
||||||
|
break io.readlines
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
DTRACE_CMD ||= %w[dtrace]
|
DTRACE_CMD ||= %w[dtrace]
|
||||||
|
|
||||||
|
READ_PROBES ||= proc do |cmd|
|
||||||
|
IO.popen(cmd, err: [:child, :out], &:readlines)
|
||||||
|
end
|
||||||
|
|
||||||
case rubybin = EnvUtil.rubybin
|
case rubybin = EnvUtil.rubybin
|
||||||
when /\/ruby-runner#{Regexp.quote(RbConfig::CONFIG["EXEEXT"])}\z/
|
when /\/ruby-runner#{Regexp.quote(RbConfig::CONFIG["EXEEXT"])}\z/
|
||||||
RUBYBIN = File.dirname(rubybin)+"/miniruby#{RbConfig::CONFIG["EXEEXT"]}"
|
RUBYBIN = File.dirname(rubybin)+"/miniruby#{RbConfig::CONFIG["EXEEXT"]}"
|
||||||
@ -51,9 +71,7 @@ module DTrace
|
|||||||
end
|
end
|
||||||
cmd.unshift(sudo)
|
cmd.unshift(sudo)
|
||||||
end
|
end
|
||||||
probes = IO.popen(cmd, err: [:child, :out]) do |io|
|
probes = READ_PROBES.(cmd)
|
||||||
io.readlines
|
|
||||||
end
|
|
||||||
d.close(true)
|
d.close(true)
|
||||||
rb.close(true)
|
rb.close(true)
|
||||||
yield(d_path, rb_path, probes)
|
yield(d_path, rb_path, probes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user