From 11c19607296066a0ec11347d6a84de7393a135ae Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 2 Apr 2024 22:49:40 +0100 Subject: [PATCH 1/8] Remove `byebug` since it doesn't work in tests anymore - Byebug was introduced in [2020](https://github.com/Homebrew/brew/pull/7577) for hooking into tests for debugging. - It does not work anymore in so far as it does not stop at breakpoints when following the instructions to trigger them in tests. --- Library/Homebrew/Gemfile | 1 - Library/Homebrew/Gemfile.lock | 2 -- Library/Homebrew/dev-cmd/tests.rb | 4 ---- Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi | 3 --- Library/Homebrew/sorbet/tapioca/config.yml | 1 - Library/Homebrew/test/spec_helper.rb | 1 - Library/Homebrew/vendor/bundle/bundler/setup.rb | 2 -- completions/bash/brew | 1 - completions/fish/brew.fish | 1 - completions/zsh/_brew | 1 - docs/Manpage.md | 4 ---- manpages/brew.1 | 3 --- 12 files changed, 24 deletions(-) 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..d8c6c62ded525 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -21,8 +21,6 @@ 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 "--changed", description: "Only runs tests on files that were changed from the master branch." switch "--fail-fast", @@ -45,8 +43,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! 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/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 1cf4a428ea9c7..ba08b3bac1389 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")) 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..c5ec5801a856e 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -1465,7 +1465,6 @@ __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' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 65e86cf5b5143..69bdbe7c35e89 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -1815,7 +1815,6 @@ _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]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 498b56171ea23..a001fde3dfd1d 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2650,10 +2650,6 @@ 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` - -: Enable debugging using byebug. - `--changed` : Only runs tests on files that were changed from the master branch. diff --git a/manpages/brew.1 b/manpages/brew.1 index 270a4f0a6b4dc..9716af71e1bee 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1687,9 +1687,6 @@ 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\. -.TP \fB\-\-changed\fP Only runs tests on files that were changed from the master branch\. .TP From 58fbaecedbe696b6dea573a5fed44ac718ffcd53 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 2 Apr 2024 23:55:24 +0100 Subject: [PATCH 2/8] Add the `debug` gem for test debugging --- .gitignore | 5 +++++ Library/Homebrew/Gemfile | 2 ++ Library/Homebrew/Gemfile.lock | 16 ++++++++++++++++ Library/Homebrew/sorbet/tapioca/config.yml | 7 +++++++ Library/Homebrew/vendor/bundle/bundler/setup.rb | 11 +++++++++++ 5 files changed, 41 insertions(+) diff --git a/.gitignore b/.gitignore index 7f978ca750f96..29db8f57101ae 100644 --- a/.gitignore +++ b/.gitignore @@ -76,12 +76,14 @@ **/vendor/bundle/ruby/*/gems/coderay-*/ **/vendor/bundle/ruby/*/gems/colorize-*/ **/vendor/bundle/ruby/*/gems/commander-*/ +**/vendor/bundle/ruby/*/gems/debug-*/ **/vendor/bundle/ruby/*/gems/diff-lcs-*/ **/vendor/bundle/ruby/*/gems/docile-*/ **/vendor/bundle/ruby/*/gems/ecma-re-validator-*/ **/vendor/bundle/ruby/*/gems/erubi-*/ **/vendor/bundle/ruby/*/gems/hana-*/ **/vendor/bundle/ruby/*/gems/highline-*/ +**/vendor/bundle/ruby/*/gems/irb-*/ **/vendor/bundle/ruby/*/gems/jaro_winkler-*/ **/vendor/bundle/ruby/*/gems/json-*/ **/vendor/bundle/ruby/*/gems/json_schemer-*/ @@ -105,7 +107,9 @@ **/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/reline-*/ **/vendor/bundle/ruby/*/gems/rexml-*/ **/vendor/bundle/ruby/*/gems/rspec-*/ **/vendor/bundle/ruby/*/gems/rspec-core-*/ @@ -126,6 +130,7 @@ !**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/ **/vendor/bundle/ruby/*/gems/spoom-*/ **/vendor/bundle/ruby/*/gems/stackprof-*/ +**/vendor/bundle/ruby/*/gems/stringio-*/ **/vendor/bundle/ruby/*/gems/strscan-*/ **/vendor/bundle/ruby/*/gems/syntax_tree-*/ **/vendor/bundle/ruby/*/gems/tapioca-*/ diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 533593a96f489..1f20df7d6dbd1 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -48,6 +48,8 @@ group :style, optional: true do gem "rubocop-sorbet", require: false end group :tests, optional: true do + gem "psych", "< 5", require: false + gem "debug", 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 04018f866b453..d5590b518180d 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -10,6 +10,9 @@ GEM coderay (1.1.3) commander (4.6.0) highline (~> 2.0.0) + debug (1.9.2) + irb (~> 1.10) + reline (>= 0.3.8) diff-lcs (1.5.1) docile (1.4.0) elftools (1.3.0) @@ -17,6 +20,10 @@ GEM erubi (1.12.0) hana (1.3.7) highline (2.0.3) + io-console (0.7.2) + irb (1.12.0) + rdoc + reline (>= 0.4.2) json (2.7.2) json_schemer (2.1.1) hana (~> 1.3) @@ -47,13 +54,19 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) + psych (4.0.6) + stringio public_suffix (5.0.5) racc (1.7.3) rainbow (3.1.1) rbi (0.1.10) prism (>= 0.18.0, < 0.25) sorbet-runtime (>= 0.5.9204) + rdoc (6.6.3.1) + psych (>= 4.0.0) regexp_parser (2.9.0) + reline (0.5.0) + io-console (~> 0.5) rexml (3.2.6) rspec (3.13.0) rspec-core (~> 3.13.0) @@ -136,6 +149,7 @@ GEM sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) stackprof (0.2.26) + stringio (3.1.0) tapioca (0.13.3) bundler (>= 2.2.25) netrc (>= 0.11.0) @@ -166,6 +180,7 @@ PLATFORMS DEPENDENCIES addressable bootsnap + debug json_schemer kramdown method_source @@ -175,6 +190,7 @@ DEPENDENCIES patchelf plist pry + psych (< 5) rexml rspec rspec-github diff --git a/Library/Homebrew/sorbet/tapioca/config.yml b/Library/Homebrew/sorbet/tapioca/config.yml index 027f3e0ce2dcb..64b2d614da38a 100644 --- a/Library/Homebrew/sorbet/tapioca/config.yml +++ b/Library/Homebrew/sorbet/tapioca/config.yml @@ -6,17 +6,23 @@ gem: - json - msgpack # These aren't needed: + - byebug - coderay - commander + - debug - diff-lcs - docile - hana - highline + - io-console + - irb - language_server-protocol - netrc - parallel - public_suffix - racc + - rdoc + - reline - rexml - rspec-github - rspec-mocks @@ -33,6 +39,7 @@ gem: - ruby-prof - simplecov_json_formatter - simpleidn + - stringio - unf - unf_ext - unicode-display_width diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 5a696f1f252c6..913cc12511a2a 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -38,6 +38,17 @@ def self.extension_api_version $:.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") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stringio-3.1.0") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stringio-3.1.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/psych-4.0.6") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/psych-4.0.6/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rdoc-6.6.3.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/io-console-0.7.2") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/io-console-0.7.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/reline-0.5.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/irb-1.12.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/debug-1.9.2") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/debug-1.9.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.5.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/elftools-1.3.0/lib") From 1daeb5bee0add239ba933416558a29293efa6831 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 2 Apr 2024 23:43:46 +0100 Subject: [PATCH 3/8] Set up the `debug` gem for test debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - This processed that we'd requested a debugger, but didn't drop us into a debugging console until I [stopped the stdin disablement](https://github.com/Homebrew/brew/issues/16708#issuecomment-1953483970). Usage: ``` ❯ git diff diff --git a/Library/Homebrew/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb index 87fadd5e95..db4700810a 100644 --- a/Library/Homebrew/test/migrator_spec.rb +++ b/Library/Homebrew/test/migrator_spec.rb @@ -69,6 +69,8 @@ RSpec.describe Migrator do tab.source["tap"] = "homebrew/core" tab.write + binding.break + expect do described_class.new(new_formula, "oldname") end.to raise_error(Migrator::MigratorDifferentTapsError) issyl0 at pictor in /opt/homebrew on bye-byebug ❯ brew tests --only=migrator --debug Randomized with seed 59158 1 process for 1 spec, ~ 1 spec per process .==> Relinking newname .==> Unlinking oldname ...==> Moving oldname versions to /private/tmp/homebrew-tests-20240403-85464-3uogqr/cellar/newname ....==> Migrating formula oldname to newname ==> Unlinking oldname ==> Moving oldname versions to /private/tmp/homebrew-tests-20240403-85464-3uogqr/cellar/newname ==> Relinking newname ....[67, 76] in ~/migrator_spec.rb 67| tab = Tab.empty 68| tab.tabfile = HOMEBREW_CELLAR/"oldname/0.1/INSTALL_RECEIPT.json" 69| tab.source["tap"] = "homebrew/core" 70| tab.write 71| => 72| binding.break 73| 74| expect do 75| described_class.new(new_formula, "oldname") 76| end.to raise_error(Migrator::MigratorDifferentTapsError) =>#0 block in (3 levels) at ~/migrator_spec.rb:72 #1 [C] BasicObject#instance_exec at /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:263 # and 68 frames (use `bt' command for all frames) (rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p tab (rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p # command(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p # command t # command ta # command tab # command(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p tab # command => #"Macintosh", "os_version"=>"macOS 14", "cpu_family"=>"arm_firestorm_icestorm"}, @compiler=:clang, @homebrew_version="4.2.16-55-gc8f60ec-dirty", @installed_as_dependency=false, @installed_on_request=false, @loaded_from_api=false, @poured_from_bottle=false, @runtime_dependencies=nil, @source={"path"=>nil, "tap"=>"homebrew/core", "tap_git_head"=>nil, "spec"=>"stable", "versions"=>{"stable"=>nil, "head"=>nil, "version_scheme"=>0}}, @source_modified_time=0, @stdlib=nil, @tabfile=#, @time=nil, @unused_options=[], @used_options=[]> (rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) ``` --- .gitignore | 1 + Library/Homebrew/dev-cmd/tests.rb | 4 ++++ Library/Homebrew/test/spec_helper.rb | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 29db8f57101ae..7941b6dee2a35 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 diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index d8c6c62ded525..9050ace4e4745 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -21,6 +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 "--debug", + description: "Enable debugging using ruby/debug." switch "--changed", description: "Only runs tests on files that were changed from the master branch." switch "--fail-fast", @@ -43,6 +45,8 @@ 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 "debug" if args.debug? + HOMEBREW_LIBRARY_PATH.cd do setup_environment! diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index ba08b3bac1389..2de31df22eb4d 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -29,6 +29,7 @@ require "rspec/sorbet" require "rubocop/rspec/support" require "find" +require "debug" require "timeout" $LOAD_PATH.unshift(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib")) @@ -229,14 +230,14 @@ @__stdin = $stdin.clone begin - if !example.metadata.keys.intersect?([:focus, :byebug]) && !ENV.key?("HOMEBREW_VERBOSE_TESTS") + if !example.metadata.keys.include?(: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) From f2a64f3808c78c0d445f7f74151cbf95785c5a58 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 3 Apr 2024 00:12:28 +0100 Subject: [PATCH 4/8] Fix RuboCop and exclude `psych` from RBI generation --- Library/Homebrew/Gemfile | 2 +- Library/Homebrew/sorbet/tapioca/config.yml | 2 +- Library/Homebrew/test/spec_helper.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 1f20df7d6dbd1..b4bedd6060e6e 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -48,9 +48,9 @@ group :style, optional: true do gem "rubocop-sorbet", require: false end group :tests, optional: true do - gem "psych", "< 5", require: false gem "debug", require: false gem "parallel_tests", require: false + gem "psych", "< 5", require: false gem "rspec", require: false gem "rspec-github", require: false gem "rspec_junit_formatter", require: false diff --git a/Library/Homebrew/sorbet/tapioca/config.yml b/Library/Homebrew/sorbet/tapioca/config.yml index 64b2d614da38a..da48797bbba25 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 - debug @@ -19,6 +18,7 @@ gem: - language_server-protocol - netrc - parallel + - psych - public_suffix - racc - rdoc diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 2de31df22eb4d..c36ea110f3482 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -230,7 +230,7 @@ @__stdin = $stdin.clone begin - if !example.metadata.keys.include?(:focus) && !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) From 621e51a6c97e97f090d5b05ee6a37d806674e86c Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 4 Apr 2024 23:27:31 +0100 Subject: [PATCH 5/8] Don't `require "debug"` in `brew tests` - it's in our RSpec config --- Library/Homebrew/dev-cmd/tests.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 9050ace4e4745..342f155f139d2 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -22,7 +22,7 @@ class Tests < AbstractCommand description: "Include tests that use the GitHub API and tests that use any of the taps for " \ "official external commands." switch "--debug", - description: "Enable debugging using ruby/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 "debug" if args.debug? - HOMEBREW_LIBRARY_PATH.cd do setup_environment! From 073e739005e49034d572fca164d5e185692bc51c Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 7 Apr 2024 20:17:07 +0100 Subject: [PATCH 6/8] Use the `debug` gem from portable Ruby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - This is cleaner than vendoring a whole bunch of new gems and pinning `psych`. - Thanks for the pointer, Bo! - It doesn't work, though? ``` ❯ brew tests --only=migrator --debug Error: cannot load such file -- debug/debug.so Warning: Removed Sorbet lines from backtrace! Rerun with `--verbose` to see the original backtrace /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:16:in `require' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:16:in `rescue in ' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:13:in `' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:3:in `' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/session.rb:31:in `require_relative' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/session.rb:31:in `' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug.rb:3:in `require_relative' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug.rb:3:in `' /opt/homebrew/Library/Homebrew/dev-cmd/tests.rb:48:in `require' /opt/homebrew/Library/Homebrew/dev-cmd/tests.rb:48:in `run' /opt/homebrew/Library/Homebrew/brew.rb:89:in `
' ``` --- .gitignore | 4 ---- Library/Homebrew/Gemfile | 2 -- Library/Homebrew/Gemfile.lock | 16 ---------------- Library/Homebrew/dev-cmd/tests.rb | 2 ++ Library/Homebrew/sorbet/tapioca/config.yml | 7 ------- Library/Homebrew/standalone/init.rb | 6 ++++++ Library/Homebrew/test/migrator_spec.rb | 2 ++ Library/Homebrew/test/spec_helper.rb | 1 - Library/Homebrew/vendor/bundle/bundler/setup.rb | 11 ----------- completions/fish/brew.fish | 2 +- completions/zsh/_brew | 2 +- docs/Manpage.md | 4 ++++ manpages/brew.1 | 3 +++ 13 files changed, 19 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index 7941b6dee2a35..55a5659a8436c 100644 --- a/.gitignore +++ b/.gitignore @@ -77,14 +77,12 @@ **/vendor/bundle/ruby/*/gems/coderay-*/ **/vendor/bundle/ruby/*/gems/colorize-*/ **/vendor/bundle/ruby/*/gems/commander-*/ -**/vendor/bundle/ruby/*/gems/debug-*/ **/vendor/bundle/ruby/*/gems/diff-lcs-*/ **/vendor/bundle/ruby/*/gems/docile-*/ **/vendor/bundle/ruby/*/gems/ecma-re-validator-*/ **/vendor/bundle/ruby/*/gems/erubi-*/ **/vendor/bundle/ruby/*/gems/hana-*/ **/vendor/bundle/ruby/*/gems/highline-*/ -**/vendor/bundle/ruby/*/gems/irb-*/ **/vendor/bundle/ruby/*/gems/jaro_winkler-*/ **/vendor/bundle/ruby/*/gems/json-*/ **/vendor/bundle/ruby/*/gems/json_schemer-*/ @@ -110,7 +108,6 @@ **/vendor/bundle/ruby/*/gems/rbi-*/ **/vendor/bundle/ruby/*/gems/rdoc-*/ **/vendor/bundle/ruby/*/gems/regexp_parser-*/ -**/vendor/bundle/ruby/*/gems/reline-*/ **/vendor/bundle/ruby/*/gems/rexml-*/ **/vendor/bundle/ruby/*/gems/rspec-*/ **/vendor/bundle/ruby/*/gems/rspec-core-*/ @@ -131,7 +128,6 @@ !**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/ **/vendor/bundle/ruby/*/gems/spoom-*/ **/vendor/bundle/ruby/*/gems/stackprof-*/ -**/vendor/bundle/ruby/*/gems/stringio-*/ **/vendor/bundle/ruby/*/gems/strscan-*/ **/vendor/bundle/ruby/*/gems/syntax_tree-*/ **/vendor/bundle/ruby/*/gems/tapioca-*/ diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index b4bedd6060e6e..533593a96f489 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -48,9 +48,7 @@ group :style, optional: true do gem "rubocop-sorbet", require: false end group :tests, optional: true do - gem "debug", require: false gem "parallel_tests", require: false - gem "psych", "< 5", require: false gem "rspec", require: false gem "rspec-github", require: false gem "rspec_junit_formatter", require: false diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index d5590b518180d..04018f866b453 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -10,9 +10,6 @@ GEM coderay (1.1.3) commander (4.6.0) highline (~> 2.0.0) - debug (1.9.2) - irb (~> 1.10) - reline (>= 0.3.8) diff-lcs (1.5.1) docile (1.4.0) elftools (1.3.0) @@ -20,10 +17,6 @@ GEM erubi (1.12.0) hana (1.3.7) highline (2.0.3) - io-console (0.7.2) - irb (1.12.0) - rdoc - reline (>= 0.4.2) json (2.7.2) json_schemer (2.1.1) hana (~> 1.3) @@ -54,19 +47,13 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (4.0.6) - stringio public_suffix (5.0.5) racc (1.7.3) rainbow (3.1.1) rbi (0.1.10) prism (>= 0.18.0, < 0.25) sorbet-runtime (>= 0.5.9204) - rdoc (6.6.3.1) - psych (>= 4.0.0) regexp_parser (2.9.0) - reline (0.5.0) - io-console (~> 0.5) rexml (3.2.6) rspec (3.13.0) rspec-core (~> 3.13.0) @@ -149,7 +136,6 @@ GEM sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) stackprof (0.2.26) - stringio (3.1.0) tapioca (0.13.3) bundler (>= 2.2.25) netrc (>= 0.11.0) @@ -180,7 +166,6 @@ PLATFORMS DEPENDENCIES addressable bootsnap - debug json_schemer kramdown method_source @@ -190,7 +175,6 @@ DEPENDENCIES patchelf plist pry - psych (< 5) rexml rspec rspec-github diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 342f155f139d2..f99ab7e6a846e 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -45,6 +45,8 @@ 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 "debug" if args.debug? + HOMEBREW_LIBRARY_PATH.cd do setup_environment! diff --git a/Library/Homebrew/sorbet/tapioca/config.yml b/Library/Homebrew/sorbet/tapioca/config.yml index da48797bbba25..027f3e0ce2dcb 100644 --- a/Library/Homebrew/sorbet/tapioca/config.yml +++ b/Library/Homebrew/sorbet/tapioca/config.yml @@ -8,21 +8,15 @@ gem: # These aren't needed: - coderay - commander - - debug - diff-lcs - docile - hana - highline - - io-console - - irb - language_server-protocol - netrc - parallel - - psych - public_suffix - racc - - rdoc - - reline - rexml - rspec-github - rspec-mocks @@ -39,7 +33,6 @@ gem: - ruby-prof - simplecov_json_formatter - simpleidn - - stringio - unf - unf_ext - unicode-display_width diff --git a/Library/Homebrew/standalone/init.rb b/Library/Homebrew/standalone/init.rb index fafbaa2ab576c..9f9c7831fb968 100644 --- a/Library/Homebrew/standalone/init.rb +++ b/Library/Homebrew/standalone/init.rb @@ -39,6 +39,12 @@ ENV["HOMEBREW_SKIP_INITIAL_GEM_INSTALL"] = "1" end +if Pathname.new(RbConfig.ruby).to_s.include?("/vendor/portable-ruby/") + prefix = RbConfig::CONFIG["rubylibprefix"] + ruby_version = RbConfig::CONFIG["ruby_version"] + $LOAD_PATH.unshift "#{prefix}/gems/#{ruby_version}/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/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb index 87fadd5e95555..4494b919b7345 100644 --- a/Library/Homebrew/test/migrator_spec.rb +++ b/Library/Homebrew/test/migrator_spec.rb @@ -69,6 +69,8 @@ tab.source["tap"] = "homebrew/core" tab.write + binding.b + expect do described_class.new(new_formula, "oldname") end.to raise_error(Migrator::MigratorDifferentTapsError) diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index c36ea110f3482..517acadb8cc26 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 "debug" require "timeout" $LOAD_PATH.unshift(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib")) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 913cc12511a2a..5a696f1f252c6 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -38,17 +38,6 @@ def self.extension_api_version $:.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") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stringio-3.1.0") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stringio-3.1.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/psych-4.0.6") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/psych-4.0.6/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rdoc-6.6.3.1/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/io-console-0.7.2") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/io-console-0.7.2/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/reline-0.5.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/irb-1.12.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/debug-1.9.2") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/debug-1.9.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.5.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/elftools-1.3.0/lib") diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index c5ec5801a856e..ecb629d655642 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -1467,7 +1467,7 @@ __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 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 69bdbe7c35e89..e7536ef77e41f 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -1817,7 +1817,7 @@ _brew_tests() { _arguments \ '(--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 a001fde3dfd1d..b4b42f9e8c25e 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2650,6 +2650,10 @@ 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. +`--debug` + +: Enable debugging using ruby/debug, or surface the standard `odebug` output. + `--changed` : Only runs tests on files that were changed from the master branch. diff --git a/manpages/brew.1 b/manpages/brew.1 index 9716af71e1bee..2415dca39a57a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1687,6 +1687,9 @@ 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\-\-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\. .TP From 9cf5334469c2f75eec5c21f19564ee15bf8da4dd Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 10 Apr 2024 23:43:55 +0100 Subject: [PATCH 7/8] Load `debug.so` extensions along with the debug gem itself - This doesn't work still, but now for new reasons. ``` NoMethodError: undefined method `b' for # binding.b ^^ # ./test/migrator_spec.rb:72:in `block (3 levels) in ' ``` and if I add `require "debug"` to the spec_helper again it gives: ``` LoadError: cannot load such file -- debug ``` but, doing a `require "debug"; binding.b` in `migrator_spec` _does_ work. Where is the require coming from where it works some of the time but not through all of the layers we have? --- Library/Homebrew/standalone/init.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/standalone/init.rb b/Library/Homebrew/standalone/init.rb index 9f9c7831fb968..7e3d2f04f996a 100644 --- a/Library/Homebrew/standalone/init.rb +++ b/Library/Homebrew/standalone/init.rb @@ -40,9 +40,11 @@ end if Pathname.new(RbConfig.ruby).to_s.include?("/vendor/portable-ruby/") - prefix = RbConfig::CONFIG["rubylibprefix"] ruby_version = RbConfig::CONFIG["ruby_version"] - $LOAD_PATH.unshift "#{prefix}/gems/#{ruby_version}/gems/debug-1.6.3/lib" + 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) From 4c64193b9b10021aa9b3903e67738de1a6777985 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 17 Apr 2024 22:17:47 +0100 Subject: [PATCH 8/8] Set `HOMEBREW_DEBUG` when running `brew tests --debug` - This will cause the "debug" gem to be required in `spec_helper.rb`, so we can do interactive debugging. --- Library/Homebrew/dev-cmd/tests.rb | 4 ++-- Library/Homebrew/test/migrator_spec.rb | 2 -- Library/Homebrew/test/spec_helper.rb | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index f99ab7e6a846e..0a3a99b2d19e7 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -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 "debug" if args.debug? - 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/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb index 4494b919b7345..87fadd5e95555 100644 --- a/Library/Homebrew/test/migrator_spec.rb +++ b/Library/Homebrew/test/migrator_spec.rb @@ -69,8 +69,6 @@ tab.source["tap"] = "homebrew/core" tab.write - binding.b - expect do described_class.new(new_formula, "oldname") end.to raise_error(Migrator::MigratorDifferentTapsError) diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 517acadb8cc26..b525f7a11bc7e 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -37,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"