Skip to content

Commit

Permalink
Fix ignore_failures usage with --test-default-formula
Browse files Browse the repository at this point in the history
Previously we were ignoring a bunch of failures in these cases which
makes this CI check pretty useless (e.g. see
Homebrew/brew#16423).
  • Loading branch information
MikeMcQuaid committed Jan 3, 2024
1 parent 7dc578b commit 4aeb0c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions lib/tests/formulae.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def setup_formulae_deps_instances(formula, formula_name, args:)
test "brew", "fetch", "--retry", "--build-from-source",
*changed_dependencies

ignore_failures = changed_dependencies.any? do |dep|
ignore_failures = !args.test_default_formula? && changed_dependencies.any? do |dep|
!bottled?(Formulary.factory(dep), no_older_versions: true)
end

Expand Down Expand Up @@ -236,7 +236,7 @@ def bottle_reinstall_formula(formula, new_formula, args:)
root_url = args.root_url

# GitHub Releases url
root_url ||= if tap.present? && !tap.core_tap? && !@test_default_formula
root_url ||= if tap.present? && !tap.core_tap? && !args.test_default_formula?
"#{tap.default_remote}/releases/download/#{formula.name}-#{formula.pkg_version}"
end

Expand All @@ -247,7 +247,7 @@ def bottle_reinstall_formula(formula, new_formula, args:)
bottle_args = ["--verbose", "--json", formula.full_name]
bottle_args << "--keep-old" if args.keep_old? && !new_formula
bottle_args << "--skip-relocation" if args.skip_relocation?
bottle_args << "--force-core-tap" if @test_default_formula
bottle_args << "--force-core-tap" if args.test_default_formula?
bottle_args << "--root-url=#{root_url}" if root_url
bottle_args << "--only-json-tab" if args.only_json_tab?

Expand Down Expand Up @@ -394,7 +394,7 @@ def formula!(formula_name, args:)
end

new_formula = @added_formulae.include?(formula_name)
ignore_failures = !bottled_on_current_version && !new_formula
ignore_failures = !args.test_default_formula? && !bottled_on_current_version && !new_formula

deps = []
reqs = []
Expand Down Expand Up @@ -540,7 +540,7 @@ def formula!(formula_name, args:)
# they can be unavoidable but we still want to know about them.
test "brew", "linkage", "--cached", "--test", "--strict",
named_args: formula_name,
ignore_failures: true
ignore_failures: !args.test_default_formula? && true
end

test "brew", "linkage", "--cached", formula_name
Expand Down
8 changes: 4 additions & 4 deletions lib/tests/formulae_dependents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def install_dependent(dependent, testable_dependents, args:, build_from_source:
test "brew", "install", *build_args,
named_args: dependent.full_name,
env: env.merge({ "HOMEBREW_DEVELOPER" => nil }),
ignore_failures: build_from_source && !bottled_on_current_version
ignore_failures: !args.test_default_formula? && build_from_source && !bottled_on_current_version
install_step = steps.last

return unless install_step.passed?
Expand All @@ -249,15 +249,15 @@ def install_dependent(dependent, testable_dependents, args:, build_from_source:
test "brew", "install", "--only-dependencies", dependent.full_name
test "brew", "linkage", "--test",
named_args: dependent.full_name,
ignore_failures: !bottled_on_current_version
ignore_failures: !args.test_default_formula? && !bottled_on_current_version
linkage_step = steps.last

if linkage_step.passed? && !build_from_source
# Check for opportunistic linkage. Ignore failures because
# they can be unavoidable but we still want to know about them.
test "brew", "linkage", "--cached", "--test", "--strict",
named_args: dependent.full_name,
ignore_failures: true
ignore_failures: !args.test_default_formula?
end

if testable_dependents.include? dependent
Expand All @@ -279,7 +279,7 @@ def install_dependent(dependent, testable_dependents, args:, build_from_source:
test "brew", "test", "--retry", "--verbose",
named_args: dependent.full_name,
env: env,
ignore_failures: !bottled_on_current_version
ignore_failures: !args.test_default_formula? && !bottled_on_current_version
test_step = steps.last
end

Expand Down
1 change: 0 additions & 1 deletion lib/tests/formulae_detect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def detect_formulae!(args:)

if args.test_default_formula?
# Build the default test formula.
@test_default_formula = true
modified_formulae << "homebrew/test-bot/testbottest"
end

Expand Down

0 comments on commit 4aeb0c8

Please # to comment.