-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test-bot: check all dependents for broken dylibs #107
Conversation
To avoid getting false positives like in the quoted example, we either need to teach Otherwise generally 👍 on this. |
@@ -583,7 +583,7 @@ def formula(formula_name) | |||
end | |||
end | |||
test "brew", "test", "--verbose", formula_name if formula.test_defined? | |||
testable_dependents.each do |dependent| | |||
dependents.each do |dependent| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike the name suggests, testable_dependents
are not merely dependents with a test, but dependents that have a test and are bottled (see a bit further up). Switching to dependents
potentially means that unbottled dependents will be built from source, just for the sake of checking their linkage, which is likely to be alright due to the from-source build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Yeah, testing linkage on non-bottled formulae is probably pointless. I'll modify it to do only bottled ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be useful but it's too slow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to doing just the bottled dependents.
Seems good, thanks for this 👍 |
Switched to testing bottled dependents only. I modified it to treat install paths starting with
I read a couple articles on the (To be strict, maybe we should be checking for unresolved symbols before complaining about referenced library paths that don't resolve. But I think 99% of the time they'll be an error for us regardless, so we probably don't have to check the symbols, too.) |
@keg.find do |file| | ||
next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle? | ||
file.dynamically_linked_libraries.each do |dylib| | ||
if !dylib.empty? && dylib[0] == "@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find dylib.start_with?("@")
easier to parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
@MikeMcQuaid You're welcome! |
Pulls 'brew linkage' in to main brew repo as a dev-cmd, and has test-bot use it to detect dylib breakage, which usually means a revision bump is needed. Checks all dependents, not just those with a 'test do' block defined, since we can do this without formula support.
And here's what the results look like, from Homebrew/homebrew-core#427. Gonna go make a revision-bump PR now... :) |
It's working! We've caught dylib breakage in PRs a couple times this last week. Example: Homebrew/homebrew-core#621 |
cool! so is this functionality integrated or not merged? confused by the red closing of the pull request. |
Thanks! It's integrated and running now (at least for in-tap dependencies), and we've already caught and fixed a couple broken bottles with it. Most of our closed pull requests for things that get accepted are still red "closed" instead of purple "merged" because we usually use If the message says something with a commit identifier like "apjanke closed this in da34fba 14 days ago", that means it was accepted and merged. If the message just says "apjanke closed this 14 days ago" that means it was probably rejected or superseded, and there should be an explicit comment in the discussion indicating why it was rejected. Sorry if this is confusing. |
Maybe GitHub could make a special "Mark as manually merged" button. But maybe that would break their model with tight coupling between commit history and issues. |
ah ok I see now, thanks for the clarification! It would be nice if github allowed things to be made clearer more easily... oh well now I know! |
brew linkage
depends on having a formula installed, so we can't test that reproducibly without interacting with the Homebrew installation.brew tests
with your changes locally?Goes with Homebrew/homebrew-dev-tools/pull/5.
Addresses #60
Description
Has
test-bot
check all dependents of changed formulae for dylib link breakage, independent of whether they have atest do
block.Pulls 'brew linkage' in to main brew repo as a dev-cmd, and has test-bot use it to detect dylib breakage, which usually means a revision bump is needed. Checks all dependents, not just those with a 'test do' block defined, since we can do this without formula support.
This follows up #60 ("Preventing formulae updates from breaking their dependencies") and partially addresses its concerns. Doesn't fully fix them, because the decoupling between repos means that test-bot still won't be able to validate cross-repo library dependencies. It will take manual work on the PR author's part to make sure separate PRs are made for revision bumps dependent repos and that all formulae are included.
Testing
You can see an example of the new output at https://gist.github.com/apjanke/77f7e593c922a58408bdc1f92964bcec.
This was produced with
brew test-bot --keep-logs --junit --local --verbose --skip-homebrew --skip-setup icu4c | tee test-bot-with-linkage.txt
run against the current repo states.You can see it catching dylib breakage that's still in some of
icu4c
's dependents. Some of these were not caught by the existing tests, because they don't define atest do
block, so they're not "testable". This would show up in Jenkins as a failed test step.Changes and Compatibility
With this,
brew linkage
is now a dev-cmd inside mainbrew
, instead of a regular cmd inhomebrew/dev-tools
. Users will need to haveHOMEBREW_DEVELOPER
enabled to make it visible. Users who hadhomebrew/dev-tools
tapped but didn't haveHOMEBREW_DEVELOPER
set will lose it.I chose to put it in
dev-cmd
because the move was done fortest-bot
's use, and it was originally a "dev" tool. I think it'd be fine to just have incmd
, too, to avoid breaking things for anybody, if other maintainers think that would be more appropriate.Any other taps which define a
linkage
command will now have it masked whenHOMEBREW_DEVELOPER
is enabled. (Or always, if we choose to make it a regularcmd
.)