-
Notifications
You must be signed in to change notification settings - Fork 110
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
Cleanup usage of cfg(target_arch = "...") in doc tests #293
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roypat
force-pushed
the
doctest-cleanup
branch
2 times, most recently
from
October 31, 2024 11:45
9f17761
to
d6b50ba
Compare
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
- Convert `assert!(... == ...)` to `assert_eq!` - Drop unneeded `any` inside cfgs if the `any` only contains a single condition. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
- Remove unneeded cfg(target_arch = ...) from doc tests of functions that are already cfg'd themselves to only exist on that arch - Remove unneeded code block in cpuid doc test. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
When they are needed, hide them from carg doc output (in favor of a comment above the example that calls out which architectures the example will work on). If they're not needed (e.g. because the function itself is already cfg'd to that specific architecture), drop them. In some cases, replace cfgs with explicit checks of KVM capabilities (specifically around guest_memfd stuff). Also fix up the guest_memfd doctests not using a VM type that supports guest private memory (if one exists, aka only on x86). Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Add KVM_CAP_{GUEST_MEMFD, USER_MEMORY2, MEMORY_ATTRIBUTES} to the `Cap` enum, so they can be used with `VmFd::check_extension`. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
roypat
force-pushed
the
doctest-cleanup
branch
from
October 31, 2024 11:47
d6b50ba
to
23588d7
Compare
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
roypat
force-pushed
the
doctest-cleanup
branch
from
October 31, 2024 11:52
23588d7
to
551911a
Compare
roypat
requested review from
acatangiu,
andreeaflorescu,
lauralt,
sameo and
ShadowCurse
as code owners
October 31, 2024 11:52
roypat
force-pushed
the
doctest-cleanup
branch
from
October 31, 2024 12:42
184daee
to
70f0da6
Compare
The KVM docs do not list this ioctls as restricted to any specific architecture. It is instead discoverable via capabilities, and can theoretically work on any architecture (provided the architecture has a VM type that support guest private memory). Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
roypat
force-pushed
the
doctest-cleanup
branch
from
October 31, 2024 12:48
70f0da6
to
a95f794
Compare
rbradford
approved these changes
Nov 2, 2024
ShadowCurse
approved these changes
Nov 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of the PR
This is a follow up to #208 (it came up during review, but was definitely out of scope there):
cargo doc
output, as it's clutter, and the indentation it comes with is somewhat unsightly imoRequirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.