From 92bc0c1a99aa9f1ec438904f1f025141cc8ed422 Mon Sep 17 00:00:00 2001 From: Andreea Florescu Date: Wed, 27 Oct 2021 17:37:40 +0300 Subject: [PATCH 1/3] create vm-vcpu-ref crate This is going to be eventually published to crates.io. This is the crate that we're using for upstreaming building blocks for setting up the vm and vcpu for booting. For now it lives in vmm-reference, but we are considering moving it to its own worspace at some point in time. Signed-off-by: Andreea Florescu --- coverage_config_x86_64.json | 2 +- src/vm-vcpu-ref/Cargo.toml | 12 +++++++++++ src/vm-vcpu-ref/README.md | 41 +++++++++++++++++++++++++++++++++++++ src/vm-vcpu-ref/src/lib.rs | 7 +++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/vm-vcpu-ref/Cargo.toml create mode 100644 src/vm-vcpu-ref/README.md create mode 100644 src/vm-vcpu-ref/src/lib.rs diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json index 887ad1ed..c6341d19 100644 --- a/coverage_config_x86_64.json +++ b/coverage_config_x86_64.json @@ -1,5 +1,5 @@ { - "coverage_score": 70.4, + "coverage_score": 70.3, "exclude_path": "msr_index.rs,mpspec.rs,tests/,src/devices/src/virtio/net/bindings.rs", "crate_features": "" } diff --git a/src/vm-vcpu-ref/Cargo.toml b/src/vm-vcpu-ref/Cargo.toml new file mode 100644 index 00000000..6fb4d1c3 --- /dev/null +++ b/src/vm-vcpu-ref/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "vm-vcpu-ref" +version = "0.1.0" +authors = ["rust-vmm AWS maintainers "] +edition = "2018" +description = "Wrappers for setting up a VM for booting" +repository = "https://github.com/rust-vmm/vmm-reference" +readme = "README.md" +license = "Apache-2.0 OR BSD-3-Clause" +keywords = ["virt", "kvm", "vm"] + +[dependencies] diff --git a/src/vm-vcpu-ref/README.md b/src/vm-vcpu-ref/README.md new file mode 100644 index 00000000..d2af0dbd --- /dev/null +++ b/src/vm-vcpu-ref/README.md @@ -0,0 +1,41 @@ +# Crate Name + +## Design + +TODO: This section should have a high-level design of the crate. + +Some questions that might help in writing this section: +- What is the purpose of this crate? +- What are the main components of the crate? How do they interact which each + other? + +## Usage + +TODO: This section describes how the crate is used. + +Some questions that might help in writing this section: +- What traits do users need to implement? +- Does the crate have any default/optional features? What is each feature + doing? +- Is this crate used by other rust-vmm components? If yes, how? + +## Examples + +TODO: Usage examples. + +```rust +use my_crate; + +... +``` + +## License + +**!!!NOTICE**: The BSD-3-Clause license is not included in this template. +The license needs to be manually added because the text of the license file +also includes the copyright. The copyright can be different for different +crates. If the crate contains code from CrosVM, the crate must add the +CrosVM copyright which can be found +[here](https://chromium.googlesource.com/chromiumos/platform/crosvm/+/master/LICENSE). +For crates developed from scratch, the copyright is different and depends on +the contributors. diff --git a/src/vm-vcpu-ref/src/lib.rs b/src/vm-vcpu-ref/src/lib.rs new file mode 100644 index 00000000..31e1bb20 --- /dev/null +++ b/src/vm-vcpu-ref/src/lib.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} From 4790dab1e8ffee147c4e554637cf88b55113b3de Mon Sep 17 00:00:00 2001 From: Andreea Florescu Date: Thu, 28 Oct 2021 09:33:54 +0300 Subject: [PATCH 2/3] add rust-vmm-ci to vm-vcpu-ref This is created as a symlink so we don't need to have another submodule to maintain. This was we only need to update rust-vmm-ci in one place. Also, having rust-vmm-ci in vm-vcpu-ref is needed so we can test this as a separate crate within the workspace. Not all features that we'll add to vm-vcpu-ref are going to necessarily be used by vmm-reference, so we could have specialized tests only for vm-vcpu-ref. Also, for publishing we would like to know what is the coverage of the crate. For the coverage test to be able to run only for vm-vcpu-ref, we also need to include this crate in the global workspace. Signed-off-by: Andreea Florescu --- Cargo.lock | 4 ++++ Cargo.toml | 1 + src/vm-vcpu-ref/.buildkite/custom-tests.json | 11 +++++++++++ src/vm-vcpu-ref/coverage_config_x86_64.json | 5 +++++ src/vm-vcpu-ref/rust-vmm-ci | 1 + 5 files changed, 22 insertions(+) create mode 100644 src/vm-vcpu-ref/.buildkite/custom-tests.json create mode 100644 src/vm-vcpu-ref/coverage_config_x86_64.json create mode 120000 src/vm-vcpu-ref/rust-vmm-ci diff --git a/Cargo.lock b/Cargo.lock index 1e0bb5f2..7e33521d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -234,6 +234,10 @@ dependencies = [ "vmm-sys-util", ] +[[package]] +name = "vm-vcpu-ref" +version = "0.1.0" + [[package]] name = "vmm" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index e214d535..aa0039fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ vmm = { path = "src/vmm" } api = { path = "src/api" } [workspace] +members = ["src/vm-vcpu-ref"] [profile.dev] panic = "abort" diff --git a/src/vm-vcpu-ref/.buildkite/custom-tests.json b/src/vm-vcpu-ref/.buildkite/custom-tests.json new file mode 100644 index 00000000..247b72bb --- /dev/null +++ b/src/vm-vcpu-ref/.buildkite/custom-tests.json @@ -0,0 +1,11 @@ +{ + "tests": [ + { + "test_name": "vm-vcpu_coverage", + "command": "cd src/vm-vcpu-ref/ && pytest rust-vmm-ci/integration_tests/test_coverage.py --test-scope crate", + "platform": [ + "x86_64" + ] + } + ] +} diff --git a/src/vm-vcpu-ref/coverage_config_x86_64.json b/src/vm-vcpu-ref/coverage_config_x86_64.json new file mode 100644 index 00000000..789197c4 --- /dev/null +++ b/src/vm-vcpu-ref/coverage_config_x86_64.json @@ -0,0 +1,5 @@ +{ + "coverage_score": 33.3, + "exclude_path": "", + "crate_features": "" +} diff --git a/src/vm-vcpu-ref/rust-vmm-ci b/src/vm-vcpu-ref/rust-vmm-ci new file mode 120000 index 00000000..d4f0f246 --- /dev/null +++ b/src/vm-vcpu-ref/rust-vmm-ci @@ -0,0 +1 @@ +../../rust-vmm-ci \ No newline at end of file From 9f06f8cf5d9c8d1e21280644e47ddbb7014fc50e Mon Sep 17 00:00:00 2001 From: Andreea Florescu Date: Thu, 28 Oct 2021 14:20:31 +0300 Subject: [PATCH 3/3] updated rust-vmm-ci b037be3 update test_coverage to allow running it on crates Signed-off-by: Andreea Florescu --- rust-vmm-ci | 2 +- src/vm-vcpu-ref/src/lib.rs | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/rust-vmm-ci b/rust-vmm-ci index 7931077c..b037be33 160000 --- a/rust-vmm-ci +++ b/rust-vmm-ci @@ -1 +1 @@ -Subproject commit 7931077cdc577edc20af54bf4786de750886fb85 +Subproject commit b037be339677c2f24b7ba676fc9ff893ad474305 diff --git a/src/vm-vcpu-ref/src/lib.rs b/src/vm-vcpu-ref/src/lib.rs index 31e1bb20..a285917f 100644 --- a/src/vm-vcpu-ref/src/lib.rs +++ b/src/vm-vcpu-ref/src/lib.rs @@ -1,7 +1,3 @@ -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!(2 + 2, 4); - } +pub fn main() { + println!("It works!"); }