Skip to content

Commit 96d19b3

Browse files
Merge branch 'master' into pvh-boot
2 parents c351804 + 0dcda0d commit 96d19b3

13 files changed

+45
-387
lines changed

.buildkite/pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ steps:
1010
platform: x86_64.metal
1111
plugins:
1212
- docker#v3.0.1:
13-
image: "rustvmm/dev:v2"
13+
image: "rustvmm/dev:v5"
1414
always-pull: true
1515

1616
- label: "build-musl-x86-bzimage"
@@ -22,5 +22,5 @@ steps:
2222
platform: x86_64.metal
2323
plugins:
2424
- docker#v3.0.1:
25-
image: "rustvmm/dev:v2"
25+
image: "rustvmm/dev:v5"
2626
always-pull: true

.buildkite/rust-vmm-ci-pipeline.yml

Lines changed: 0 additions & 176 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
**/*.rs.bk
33
Cargo.lock
4+
.idea/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "rust-vmm-ci"]
2+
path = rust-vmm-ci
3+
url = https://github.com/rust-vmm/rust-vmm-ci.git

README.md

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,88 +18,40 @@ cargo build
1818
Our Continuous Integration (CI) pipeline is implemented on top of
1919
[Buildkite](https://buildkite.com/).
2020
For the complete list of tests, check our
21-
[CI pipeline](https://buildkite.com/rust-vmm/vm-virtio-ci).
21+
[CI pipeline](https://buildkite.com/rust-vmm/rust-vmm-ci).
2222

2323
Each individual test runs in a container. To reproduce a test locally, you can
2424
use the dev-container on both x86 and arm64.
2525

2626
```bash
27+
container_version=5
2728
docker run -it \
2829
--security-opt seccomp=unconfined \
2930
--volume $(pwd):/linux-loader \
30-
rustvmm/dev:v2
31+
rustvmm/dev:v${container_version}
3132
cd linux-loader/
3233
cargo test
3334
```
3435

35-
### Test Profiles
36-
37-
The integration tests support two test profiles:
38-
- **devel**: this is the recommended profile for running the integration tests
39-
on a local development machine.
40-
- **ci** (default option): this is the profile used when running the
41-
integration tests as part of the the Continuous Integration (CI).
42-
43-
The test profiles are applicable to tests that run using pytest. Currently only
44-
the [coverage test](tests/test_coverage.py) follows this model as all the other
45-
integration tests are run using the
46-
[Buildkite pipeline](https://buildkite.com/rust-vmm/vm-virtio-ci).
47-
48-
The difference between is declaring tests as passed or failed:
49-
- with the **devel** profile the coverage test passes if the current coverage
50-
is equal or higher than the upstream coverage value. In case the current
51-
coverage is higher, the coverage file is updated to the new coverage value.
52-
- with the **ci** profile the coverage test passes only if the current coverage
53-
is equal to the upstream coverage value.
54-
55-
Further details about the coverage test can be found in the
56-
[Adaptive Coverage](#adaptive-coverage) section.
57-
58-
### Adaptive Coverage
36+
### bzImage test
5937

60-
The line coverage is saved in [tests/coverage](tests/coverage). To update the
61-
coverage before submitting a PR, run the coverage test:
38+
As we don't want to distribute an entire kernel bzImage, the `load_bzImage`
39+
test is ignored by default. In order to test the bzImage support, one needs to
40+
locally build a bzImage, copy it to the `src/loader` directory and run
41+
`cargo test`:
6242

6343
```bash
44+
# Assuming your linux-loader and linux-stable are both under ${LINUX_LOADER}:
45+
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ${LINUX_LOADER}/linux-stable
46+
cd linux-stable
47+
make bzImage
48+
cp linux-stable/arch/x86/boot/bzImage ${LINUX_LOADER}/linux-loader/src/loader/
49+
cd ${LINUX_LOADER}/linux-loader
50+
container_version=5
6451
docker run -it \
6552
--security-opt seccomp=unconfined \
6653
--volume $(pwd):/linux-loader \
67-
rustvmm/dev:v2
54+
rustvmm/dev:v${container_version}
6855
cd linux-loader/
69-
pytest --profile=devel tests/test_coverage.py
70-
```
71-
72-
If the PR coverage is higher than the upstream coverage, the coverage file
73-
needs to be manually added to the commit before submitting the PR:
74-
75-
```bash
76-
git add tests/coverage
77-
```
78-
79-
Failing to do so will generate a fail on the CI pipeline when publishing the
80-
PR.
81-
82-
**NOTE:** The coverage file is only updated in the `devel` test profile. In
83-
the `ci` profile the coverage test will fail if the current coverage is higher
84-
than the coverage reported in [tests/coverage](tests/coverage).
85-
86-
### bzImage test
87-
88-
As we don't want to distribute an entire kernel bzImage, the `load_bzImage` test is ignored by
89-
default. In order to test the bzImage support, one needs to locally build a bzImage, copy it
90-
to the `src/loader` directory and run cargo test:
91-
92-
```shell
93-
# Assuming your linux-loader and linux-stable are both under $LINUX_LOADER
94-
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git $LINUX_LOADER/linux-stable
95-
$ cd linux-stable
96-
$ make bzImage
97-
$ cp linux-stable/arch/x86/boot/bzImage $LINUX_LOADER/linux-loader/src/loader/
98-
$ cd $LINUX_LOADER/linux-loader
99-
$ docker run -it \
100-
--security-opt seccomp=unconfined \
101-
--volume $(pwd):/linux-loader \
102-
rustvmm/dev:v2
103-
$ cd linux-loader/
104-
$ cargo test
56+
cargo test
10557
```

coverage_config_aarch64.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"coverage_score": 71,
3+
"exclude_path": "",
4+
"crate_features": ""
5+
}

coverage_config_x86_64.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"coverage_score": 75.9,
3+
"exclude_path": "",
4+
"crate_features": ""
5+
}

rust-vmm-ci

Submodule rust-vmm-ci added at cd7096e

src/loader/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ pub fn load_cmdline<M: GuestMemory>(
487487
.checked_add(len as u64 + 1)
488488
.ok_or(Error::CommandLineOverflow)?; // Extra for null termination.
489489
if end > guest_mem.last_addr() {
490-
return Err(Error::CommandLineOverflow)?;
490+
return Err(Error::CommandLineOverflow);
491491
}
492492

493493
guest_mem

src/loader/struct_util.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ pub enum Error {
1818
pub type Result<T> = std::result::Result<T, Error>;
1919

2020
/// Reads a struct from an input buffer.
21-
/// This is unsafe because the struct is initialized to unverified data read from the input.
22-
/// `read_struct` should only be called to fill plain old data structs. It is not endian safe.
2321
///
2422
/// # Arguments
2523
///
2624
/// * `f` - The input to read from. Often this is a file.
2725
/// * `out` - The struct to fill with data read from `f`.
26+
///
27+
/// # Safety
28+
///
29+
/// This is unsafe because the struct is initialized to unverified data read from the input.
30+
/// `read_struct` should only be called to fill plain data structs. It is not endian safe.
2831
pub unsafe fn read_struct<T: Copy, F: Read>(f: &mut F, out: &mut T) -> Result<()> {
2932
let out_slice = std::slice::from_raw_parts_mut(out as *mut T as *mut u8, mem::size_of::<T>());
3033
f.read_exact(out_slice).map_err(|_| Error::ReadStruct)?;
@@ -33,13 +36,16 @@ pub unsafe fn read_struct<T: Copy, F: Read>(f: &mut F, out: &mut T) -> Result<()
3336

3437
/// Reads an array of structs from an input buffer. Returns a Vec of structs initialized with data
3538
/// from the specified input.
36-
/// This is unsafe because the structs are initialized to unverified data read from the input.
37-
/// `read_struct_slice` should only be called for plain old data structs. It is not endian safe.
3839
///
3940
/// # Arguments
4041
///
4142
/// * `f` - The input to read from. Often this is a file.
4243
/// * `len` - The number of structs to fill with data read from `f`.
44+
///
45+
/// # Safety
46+
///
47+
/// This is unsafe because the struct is initialized to unverified data read from the input.
48+
/// `read_struct_slice` should only be called to fill plain data structs. It is not endian safe.
4349
#[cfg(feature = "elf")]
4450
pub unsafe fn read_struct_slice<T: Copy, F: Read>(f: &mut F, len: usize) -> Result<Vec<T>> {
4551
let mut out: Vec<T> = Vec::with_capacity(len);

tests/conftest.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

tests/coverage

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)