diff --git a/.buildkite/custom-tests.json b/.buildkite/custom-tests.json index 6f5415eb..3204f562 100644 --- a/.buildkite/custom-tests.json +++ b/.buildkite/custom-tests.json @@ -4,6 +4,13 @@ "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": "check-windows-build", + "command": "printf '\ndenylist=[\"rawfd\", \"xen\"]' >> Cargo.toml; RUSTFLAGS=\"-D warnings\" cargo all-features check --all-targets --target x86_64-pc-windows-gnu", + "platform": [ + "x86_64" + ] } ] } diff --git a/Cargo.toml b/Cargo.toml index f26ed37c..69d5406c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ autobenches = false [features] default = ["rawfd"] -backend-bitmap = ["dep:libc"] +backend-bitmap = ["dep:libc", "dep:winapi"] backend-mmap = ["dep:libc", "dep:winapi"] backend-atomic = ["arc-swap"] rawfd = ["dep:libc"] diff --git a/src/bitmap/backend/atomic_bitmap.rs b/src/bitmap/backend/atomic_bitmap.rs index c75567d3..ae8b0f9e 100644 --- a/src/bitmap/backend/atomic_bitmap.rs +++ b/src/bitmap/backend/atomic_bitmap.rs @@ -196,7 +196,7 @@ impl NewBitmap for AtomicBitmap { #[cfg(target_family = "windows")] let page_size = { - use winapi::um::sysinfoapi::{GetSystemInfo, LPSYSTEM_INFO, SYSTEM_INFO}; + use winapi::um::sysinfoapi::GetSystemInfo; let mut sysinfo = std::mem::MaybeUninit::zeroed(); // SAFETY: It's safe to call `GetSystemInfo` as `sysinfo` is rightly sized // allocated memory. diff --git a/src/lib.rs b/src/lib.rs index 2f87f4c8..3d4ad1e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,12 @@ #[cfg(not(target_pointer_width = "64"))] compile_error!("vm-memory only supports 64-bit targets!"); +#[cfg(all(target_family = "windows", feature = "rawfd"))] +compile_error!("rawfd feature is not supported on Windows targets!"); + +#[cfg(all(target_family = "windows", feature = "xen"))] +compile_error!("xen feature is not supported on Windows targets!"); + #[macro_use] pub mod address; pub use address::{Address, AddressValue}; diff --git a/src/mmap/windows.rs b/src/mmap/windows.rs index 571fa7a2..6d723917 100644 --- a/src/mmap/windows.rs +++ b/src/mmap/windows.rs @@ -245,6 +245,7 @@ impl Drop for MmapRegion { mod tests { use std::os::windows::io::FromRawHandle; + #[cfg(feature = "backend-bitmap")] use crate::bitmap::AtomicBitmap; use crate::guest_memory::FileOffset; use crate::mmap::windows::INVALID_HANDLE_VALUE; @@ -260,6 +261,7 @@ mod tests { } #[test] + #[cfg(feature = "backend-bitmap")] fn test_dirty_tracking() { // Using the `crate` prefix because we aliased `MmapRegion` to `MmapRegion<()>` for // the rest of the unit tests above.