-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix structure sorting and partition numbering #97
Conversation
Revert previous change which sorted structure volumes by their offset. Instead, we preserve gadget.yaml order for purposes of partition numbering, but we still provide implicit offsets when they are missing, and we still sanity check for partition overlap.
) | ||
part2 = SimpleNamespace( | ||
name='gamma', | ||
type='mbr', |
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.
type='mbr', not role=mbr?
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 haven't yet done a wholesale change of the test suite to use role
yet. This is mostly a copy-n-paste of an existing test. LP: #1643086
# Part 1's image lives at MiB(4). | ||
fp.seek(MiB(4)) | ||
self.assertEqual(fp.read(15), b'\2' * 12 + b'\0' * 3) | ||
# Part 2's image is an MBR so it must live at offset 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.
Do we have any tests that verify the correctness of behavior of writing out partitions without an offset defined? That would probably be a good idea to land as part of this change, to ensure we aren't regressing other cases.
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.
Yeah, good idea. We have lots of tests for implicit offsets, but not one specifically for testing the written partitions. I'll add that in this branch.
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 just remembered that implicit offsets are handled in the parser, so effectively we do have tests for this use case. If an offset is not defined for a structure, it's assigned the "last offset", i.e. the offset of the previous structure + its size. We definitely have parser tests for this use case.
By the time the builder gets to making the disk, all structures will have offsets defined, so I think the tests added in this branch are sufficient.
Hi barry, My original gadget.yaml is:
After modifying , the new gadget.yaml is :
Using the commit with new gadget.yaml, I got following error:
|
LP: #1642999