-
Notifications
You must be signed in to change notification settings - Fork 34
Add vsock phd smoketest #1086
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
Merged
+63
−2
Merged
Add vsock phd smoketest #1086
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ca75111
[spr] changes to master this commit is based on
papertigers 49497d2
[jj-spr] initial version
papertigers 922d657
[spr] changes introduced through rebase
papertigers f0985b4
rebase master
papertigers 32ec02e
remove python
papertigers 3f522f5
license
papertigers 9c152d5
prepush fix
papertigers c68dbd5
cleanup cfg.cpus
papertigers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,4 @@ mod migrate; | |
| mod server_state_machine; | ||
| mod smoke; | ||
| mod stats; | ||
| mod vsock; | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| use phd_testcase::*; | ||
iximeow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const GUEST_CID: u64 = 16; | ||
| const PCI_DEV_NUM: u8 = 26; | ||
|
|
||
| #[phd_testcase] | ||
| async fn vsock_smoke_test(ctx: &TestCtx) { | ||
| let mut cfg = ctx.vm_config_builder("vsock_smoke_test"); | ||
| cfg.vsock(GUEST_CID, PCI_DEV_NUM); | ||
|
|
||
| let mut vm = ctx.spawn_vm(&cfg, None).await?; | ||
| vm.launch().await?; | ||
| vm.wait_to_boot().await?; | ||
|
|
||
| // This doesn't tell the whole story since linux will sometimes make this | ||
| // device available even if the hypervisor does not present the virtio | ||
| // device itself. Either way, it would be an error if it's not present. | ||
| vm.run_shell_command("test -e /dev/vsock").await?; | ||
| } | ||
|
|
||
| #[phd_testcase] | ||
| async fn vsock_get_cid(ctx: &TestCtx) { | ||
| const GET_CID: &str = "/usr/local/bin/getcid"; | ||
|
|
||
| let mut cfg = ctx.vm_config_builder("vsock_get_cid"); | ||
| cfg.vsock(GUEST_CID, PCI_DEV_NUM); | ||
|
|
||
| let mut vm = ctx.spawn_vm(&cfg, None).await?; | ||
| vm.launch().await?; | ||
| vm.wait_to_boot().await?; | ||
|
|
||
| // If we are not using a modified alpine image with our additional tooling | ||
| // we should skip this test entirely. | ||
| if vm.run_shell_command(&format!("test -e {GET_CID}")).await.is_err() { | ||
| phd_skip!("guest doesn't have getcid installed"); | ||
| } | ||
|
|
||
| let cid = vm.run_shell_command(GET_CID).await?.parse::<u64>()?; | ||
| assert_eq!(cid, GUEST_CID, "guest cid matches what was configured"); | ||
| } | ||
Oops, something went wrong.
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.
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.
Sneaking this in here simply because
cargo xtask prepushpointed it out as apart of the style guidelines.Now: