Skip to content

Commit

Permalink
Add tests for opportunistic linkage
Browse files Browse the repository at this point in the history
See discussion at Homebrew/brew#12454.
  • Loading branch information
carlocab committed Nov 22, 2021
1 parent 53b06a1 commit 7a6569d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/tests/formulae.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ def formula!(formula_name, args:)
failed_linkage_or_test_messages ||= []
failed_linkage_or_test_messages << "linkage failed" unless steps.last.passed?

# Check for opportunistic linkage. Ignore failures because
# they can be unavoidable but we still want to know about them.
test "brew", "linkage", "--test", "--strict",
named_args: formula_name
ignore_failures: true

test "brew", "install", "--only-dependencies", "--include-test", formula_name

if formula.test_defined?
Expand Down
6 changes: 6 additions & 0 deletions lib/tests/formulae_dependents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ def install_dependent(dependent, testable_dependents, args:, build_from_source:
ignore_failures: !bottled_on_current_version
linkage_step = steps.last

# Check for opportunistic linkage. Ignore failures because
# they can be unavoidable but we still want to know about them.
test "brew", "linkage", "--test", "--strict",
named_args: dependent.full_name,
ignore_failures: true

if testable_dependents.include? dependent
test "brew", "install", "--only-dependencies", "--include-test", dependent.full_name

Expand Down

0 comments on commit 7a6569d

Please sign in to comment.