Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .buildkite/custom-tests.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,9 @@
{
"tests": [
{
"test_name": "build-gnu-mmap",
"command": "cargo build --release --features=xen",
"platform": ["x86_64", "aarch64"]
},
{
"test_name": "build-gnu-mmap-no-xen",
"command": "cargo build --release --features=backend-mmap",
"platform": ["x86_64", "aarch64"]
},
{
"test_name": "build-musl-mmap",
"command": "cargo build --release --features=xen --target {target_platform}-unknown-linux-musl",
"platform": ["x86_64", "aarch64"]
},
{
"test_name": "build-musl-mmap-no-xen",
"command": "cargo build --release --features=backend-mmap --target {target_platform}-unknown-linux-musl",
"platform": ["x86_64", "aarch64"]
},
{
"test_name": "miri",
"command": "RUST_BACKTRACE=1 MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-backtrace=full' cargo +nightly miri test --features backend-mmap,backend-bitmap",
"platform": ["x86_64", "aarch64"]
},
{
"test_name": "unittests-gnu-no-xen",
"command": "cargo test --features 'backend-bitmap backend-mmap backend-atomic' --workspace",
"platform": [
"x86_64",
"aarch64"
]
},
{
"test_name": "unittests-musl-no-xen",
"command": "cargo test --features 'backend-bitmap backend-mmap backend-atomic' --workspace --target {target_platform}-unknown-linux-musl",
"platform": [
"x86_64",
"aarch64"
]
},
{
"test_name": "clippy-no-xen",
"command": "cargo clippy --workspace --bins --examples --benches --features 'backend-bitmap backend-mmap backend-atomic' --all-targets -- -D warnings -D clippy::undocumented_unsafe_blocks",
"platform": [
"x86_64",
"aarch64"
]
},
{
"test_name": "check-warnings-no-xen",
"command": "RUSTFLAGS=\"-D warnings\" cargo check --all-targets --features 'backend-bitmap backend-mmap backend-atomic' --workspace",
"platform": [
"x86_64",
"aarch64"
]
}
]
}
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ codegen-units = 1
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.cargo-all-features]
skip_optional_dependencies = true
8 changes: 8 additions & 0 deletions benches/mmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
extern crate criterion;
extern crate vm_memory;

#[cfg(feature = "rawfd")]
use std::fs::{File, OpenOptions};
use std::mem::size_of;

#[cfg(feature = "rawfd")]
use std::path::Path;

use core::hint::black_box;
Expand Down Expand Up @@ -84,7 +87,10 @@ pub fn benchmark_for_mmap(c: &mut Criterion) {

let mut image = make_image(ACCESS_SIZE);
let buf = &mut [0u8; ACCESS_SIZE];

#[cfg(feature = "rawfd")]
let mut file = File::open(Path::new("/dev/zero")).expect("Could not open /dev/zero");
#[cfg(feature = "rawfd")]
let mut file_to_write = OpenOptions::new()
.write(true)
.open("/dev/null")
Expand All @@ -110,6 +116,7 @@ pub fn benchmark_for_mmap(c: &mut Criterion) {
})
});

#[cfg(feature = "rawfd")]
c.bench_function(format!("read_from_file_{:#0X}", offset).as_str(), |b| {
b.iter(|| {
black_box(&memory)
Expand Down Expand Up @@ -159,6 +166,7 @@ pub fn benchmark_for_mmap(c: &mut Criterion) {
})
});

#[cfg(feature = "rawfd")]
c.bench_function(format!("write_to_file_{:#0X}", offset).as_str(), |b| {
b.iter(|| {
black_box(&memory)
Expand Down
2 changes: 1 addition & 1 deletion rust-vmm-ci
2 changes: 1 addition & 1 deletion src/mmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<B: Bitmap> GuestMemoryRegionBytes for GuestRegionMmap<B> {}
/// virtual address space of the calling process.
pub type GuestMemoryMmap<B = ()> = GuestRegionCollection<GuestRegionMmap<B>>;

/// Errors that can happen during [`GuestMemoryMap::from_ranges`] and related functions.
/// Errors that can happen during [`GuestMemoryMmap::from_ranges`] and related functions.
#[derive(Debug, thiserror::Error)]
pub enum FromRangesError {
/// Error during construction of [`GuestMemoryMmap`]
Expand Down