diff --git a/.gitignore b/.gitignore index 7f978ca750f96..55a5659a8436c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ /Library/Taps /Library/PinnedTaps /Library/Homebrew/.byebug_history +/Library/Homebrew/test/.rdbg_history # Ignore Bundler files **/.bundle/bin @@ -105,6 +106,7 @@ **/vendor/bundle/ruby/*/gems/racc-*/ **/vendor/bundle/ruby/*/gems/rainbow-*/ **/vendor/bundle/ruby/*/gems/rbi-*/ +**/vendor/bundle/ruby/*/gems/rdoc-*/ **/vendor/bundle/ruby/*/gems/regexp_parser-*/ **/vendor/bundle/ruby/*/gems/rexml-*/ **/vendor/bundle/ruby/*/gems/rspec-*/ diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 86fc80f2dd189..533593a96f489 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -48,7 +48,6 @@ group :style, optional: true do gem "rubocop-sorbet", require: false end group :tests, optional: true do - gem "byebug", require: false gem "parallel_tests", require: false gem "rspec", require: false gem "rspec-github", require: false diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 04970dc6c7f80..04018f866b453 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -7,7 +7,6 @@ GEM bindata (2.5.0) bootsnap (1.18.3) msgpack (~> 1.2) - byebug (11.1.3) coderay (1.1.3) commander (4.6.0) highline (~> 2.0.0) @@ -167,7 +166,6 @@ PLATFORMS DEPENDENCIES addressable bootsnap - byebug json_schemer kramdown method_source diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index d3d5e547862ce..0a3a99b2d19e7 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -21,8 +21,8 @@ class Tests < AbstractCommand switch "--online", description: "Include tests that use the GitHub API and tests that use any of the taps for " \ "official external commands." - switch "--byebug", - description: "Enable debugging using byebug." + switch "--debug", + description: "Enable debugging using ruby/debug, or surface the standard `odebug` output." switch "--changed", description: "Only runs tests on files that were changed from the master branch." switch "--fail-fast", @@ -45,8 +45,6 @@ def run # Given we might be testing various commands, we probably want everything (except sorbet-static) Homebrew.install_bundler_gems!(groups: Homebrew.valid_gem_groups - ["sorbet"]) - require "byebug" if args.byebug? - HOMEBREW_LIBRARY_PATH.cd do setup_environment! @@ -137,6 +135,8 @@ def run puts "Randomized with seed #{seed}" + ENV["HOMEBREW_DEBUG"] = "1" if args.debug? # Used in spec_helper.rb to require the "debug" gem. + # Submit test flakiness information using BuildPulse # BUILDPULSE used in spec_helper.rb if use_buildpulse? diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi index 61a59f02ee333..821f583831241 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi @@ -5,9 +5,6 @@ # Please instead update this file by running `bin/tapioca dsl Homebrew::DevCmd::Tests`. class Homebrew::CLI::Args - sig { returns(T::Boolean) } - def byebug?; end - sig { returns(T::Boolean) } def changed?; end diff --git a/Library/Homebrew/sorbet/tapioca/config.yml b/Library/Homebrew/sorbet/tapioca/config.yml index f94af4c19f89f..027f3e0ce2dcb 100644 --- a/Library/Homebrew/sorbet/tapioca/config.yml +++ b/Library/Homebrew/sorbet/tapioca/config.yml @@ -6,7 +6,6 @@ gem: - json - msgpack # These aren't needed: - - byebug - coderay - commander - diff-lcs diff --git a/Library/Homebrew/standalone/init.rb b/Library/Homebrew/standalone/init.rb index fafbaa2ab576c..7e3d2f04f996a 100644 --- a/Library/Homebrew/standalone/init.rb +++ b/Library/Homebrew/standalone/init.rb @@ -39,6 +39,14 @@ ENV["HOMEBREW_SKIP_INITIAL_GEM_INSTALL"] = "1" end +if Pathname.new(RbConfig.ruby).to_s.include?("/vendor/portable-ruby/") + ruby_version = RbConfig::CONFIG["ruby_version"] + ruby_path = "#{RbConfig::CONFIG["rubylibprefix"]}/gems/#{ruby_version}" + + $LOAD_PATH.unshift "#{ruby_path}/extensions/#{Gem::Platform.local}/#{ruby_version}-static/debug-1.6.3" + $LOAD_PATH.unshift "#{ruby_path}/gems/debug-1.6.3/lib" +end + unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) # Insert the path after any existing Homebrew paths (e.g. those inserted by tests and parent processes) last_homebrew_path_idx = $LOAD_PATH.rindex do |path| diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 1cf4a428ea9c7..b525f7a11bc7e 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -29,7 +29,6 @@ require "rspec/sorbet" require "rubocop/rspec/support" require "find" -require "byebug" require "timeout" $LOAD_PATH.unshift(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib")) @@ -38,6 +37,8 @@ require_relative "../global" +require "debug" if ENV["HOMEBREW_DEBUG"] + require "test/support/quiet_progress_formatter" require "test/support/helper/cask" require "test/support/helper/files" @@ -230,14 +231,14 @@ @__stdin = $stdin.clone begin - if !example.metadata.keys.intersect?([:focus, :byebug]) && !ENV.key?("HOMEBREW_VERBOSE_TESTS") + if example.metadata.keys.exclude?(:focus) && !ENV.key?("HOMEBREW_VERBOSE_TESTS") $stdout.reopen(File::NULL) $stderr.reopen(File::NULL) + $stdin.reopen(File::NULL) else - # don't retry when focusing/debugging + # don't retry when focusing config.default_retry_count = 0 end - $stdin.reopen(File::NULL) begin timeout = example.metadata.fetch(:timeout, 60) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index fdcc702b0870c..5a696f1f252c6 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -35,8 +35,6 @@ def self.extension_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/msgpack-1.7.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/bootsnap-1.18.3") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bootsnap-1.18.3/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/byebug-11.1.3") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/byebug-11.1.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/highline-2.0.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/commander-4.6.0/lib") diff --git a/completions/bash/brew b/completions/bash/brew index 318ae832a4d63..289e52bf871e5 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -2208,7 +2208,6 @@ _brew_tests() { case "${cur}" in -*) __brewcomp " - --byebug --changed --coverage --debug diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 9167474328f20..ecb629d655642 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -1465,10 +1465,9 @@ __fish_brew_complete_arg 'test' -a '(__fish_brew_suggest_formulae_installed)' __fish_brew_complete_cmd 'tests' 'Run Homebrew\'s unit and integration tests' -__fish_brew_complete_arg 'tests' -l byebug -d 'Enable debugging using byebug' __fish_brew_complete_arg 'tests' -l changed -d 'Only runs tests on files that were changed from the master branch' __fish_brew_complete_arg 'tests' -l coverage -d 'Generate code coverage reports' -__fish_brew_complete_arg 'tests' -l debug -d 'Display any debugging information' +__fish_brew_complete_arg 'tests' -l debug -d 'Enable debugging using ruby/debug, or surface the standard `odebug` output' __fish_brew_complete_arg 'tests' -l fail-fast -d 'Exit early on the first failing test' __fish_brew_complete_arg 'tests' -l generic -d 'Run only OS-agnostic tests' __fish_brew_complete_arg 'tests' -l help -d 'Show this message' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 65e86cf5b5143..e7536ef77e41f 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -1815,10 +1815,9 @@ _brew_test() { # brew tests _brew_tests() { _arguments \ - '--byebug[Enable debugging using byebug]' \ '(--only)--changed[Only runs tests on files that were changed from the master branch]' \ '--coverage[Generate code coverage reports]' \ - '--debug[Display any debugging information]' \ + '--debug[Enable debugging using ruby/debug, or surface the standard `odebug` output]' \ '--fail-fast[Exit early on the first failing test]' \ '--generic[Run only OS-agnostic tests]' \ '--help[Show this message]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 498b56171ea23..b4b42f9e8c25e 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2650,9 +2650,9 @@ Run Homebrew's unit and integration tests. : Include tests that use the GitHub API and tests that use any of the taps for official external commands. -`--byebug` +`--debug` -: Enable debugging using byebug. +: Enable debugging using ruby/debug, or surface the standard `odebug` output. `--changed` diff --git a/manpages/brew.1 b/manpages/brew.1 index 270a4f0a6b4dc..2415dca39a57a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1687,8 +1687,8 @@ Run only OS\-agnostic tests\. \fB\-\-online\fP Include tests that use the GitHub API and tests that use any of the taps for official external commands\. .TP -\fB\-\-byebug\fP -Enable debugging using byebug\. +\fB\-\-debug\fP +Enable debugging using ruby/debug, or surface the standard \fBodebug\fP output\. .TP \fB\-\-changed\fP Only runs tests on files that were changed from the master branch\.