Merge pull request #14313 from apainintheneck/fix-brew-prof
cmd/prof: Fix gem errors
This commit is contained in:
commit
585d10fdc8
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,6 +11,7 @@
|
|||||||
/Library/Homebrew/.npmignore
|
/Library/Homebrew/.npmignore
|
||||||
/Library/Homebrew/bin
|
/Library/Homebrew/bin
|
||||||
/Library/Homebrew/doc
|
/Library/Homebrew/doc
|
||||||
|
/Library/Homebrew/prof
|
||||||
/Library/Homebrew/test/.gem
|
/Library/Homebrew/test/.gem
|
||||||
/Library/Homebrew/test/.subversion
|
/Library/Homebrew/test/.subversion
|
||||||
/Library/Homebrew/test/coverage
|
/Library/Homebrew/test/coverage
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
if ENV["HOMEBREW_STACKPROF"]
|
if ENV["HOMEBREW_STACKPROF"]
|
||||||
|
require "rubygems"
|
||||||
require "stackprof"
|
require "stackprof"
|
||||||
StackProf.start(mode: :wall, raw: true)
|
StackProf.start(mode: :wall, raw: true)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -37,7 +37,9 @@ module Homebrew
|
|||||||
output_filename = "prof/d3-flamegraph.html"
|
output_filename = "prof/d3-flamegraph.html"
|
||||||
safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}"
|
safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}"
|
||||||
else
|
else
|
||||||
Homebrew.install_gem_setup_path! "ruby-prof"
|
# NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x
|
||||||
|
# TODO: Remove explicit version arg when we move to a newer version of Ruby
|
||||||
|
Homebrew.install_gem_setup_path! "ruby-prof", version: "1.4.3"
|
||||||
output_filename = "prof/call_stack.html"
|
output_filename = "prof/call_stack.html"
|
||||||
safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named
|
safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,4 +5,24 @@ require "cmd/shared_examples/args_parse"
|
|||||||
|
|
||||||
describe "brew prof" do
|
describe "brew prof" do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
|
describe "integration tests", :integration_test, :needs_network do
|
||||||
|
after do
|
||||||
|
FileUtils.rm_rf HOMEBREW_LIBRARY_PATH/"prof"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "works using ruby-prof (the default)" do
|
||||||
|
expect { brew "prof", "help", "HOMEBREW_BROWSER" => "echo" }
|
||||||
|
.to output(/^Example usage:/).to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
.and be_a_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it "works using stackprof" do
|
||||||
|
expect { brew "prof", "--stackprof", "help", "HOMEBREW_BROWSER" => "echo" }
|
||||||
|
.to output(/^Example usage:/).to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
.and be_a_success
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user