[cmpcodesize][1] Extract otool subprocess calls #636
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this pull request?
The functions in
cmpcodesize.compare
do several things: they call otool, they use regex matchers to extract information from otool's output, and they output that information usingprint()
.Currently, the only way to test cmpcodesize is via functional tests: ones that actually run on a dylib like libswiftCore.dylib. This takes a lot of time and is difficult to fully automate.
The commit in this pull request extracts otool calls from
cmpcodesize.compare
. It also adds tests for those calls.Future commits can test the functions in
cmpcodesize.compare
using canned strings, instead of actual otool output.Why merge this pull request?
cmpcodesize.compare
more modular, and eliminates all uses of theflatten()
function.cmpcodesize
. Instead of running functional tests* on a sample dylib, we can refactor it such that we passcmpcodesize
sample strings, and verify its behavior parsing those sample strings.What downsides are there to merging this pull request?
I suppose some could argue the tests in
utils/cmpcodesize/tests/test_otool.py
don't provide much value--they're testing some very simple logic.