petri_artifacts_vmm_test/
lib.rs#![forbid(unsafe_code)]
pub mod artifacts {
use petri_artifacts_core::declare_artifacts;
macro_rules! openvmm_native {
($id_ty:ty, $os:literal, $arch:literal) => {
#[cfg(all(target_os = $os, target_arch = $arch))]
pub const OPENVMM_NATIVE: petri_artifacts_core::ArtifactHandle<$id_ty> =
petri_artifacts_core::ArtifactHandle::new();
};
}
openvmm_native!(OPENVMM_WIN_X64, "windows", "x86_64");
openvmm_native!(OPENVMM_LINUX_X64, "linux", "x86_64");
openvmm_native!(OPENVMM_WIN_AARCH64, "windows", "aarch64");
openvmm_native!(OPENVMM_LINUX_AARCH64, "linux", "aarch64");
openvmm_native!(OPENVMM_MACOS_AARCH64, "macos", "aarch64");
declare_artifacts! {
OPENVMM_WIN_X64,
OPENVMM_LINUX_X64,
OPENVMM_WIN_AARCH64,
OPENVMM_LINUX_AARCH64,
OPENVMM_MACOS_AARCH64,
}
pub mod loadable {
use petri_artifacts_common::tags::IsLoadable;
use petri_artifacts_common::tags::MachineArch;
use petri_artifacts_core::declare_artifacts;
macro_rules! linux_direct_native {
($id_kernel_ty:ty, $id_initrd_ty:ty, $arch:literal) => {
#[cfg(target_arch = $arch)]
pub const LINUX_DIRECT_TEST_KERNEL_NATIVE: petri_artifacts_core::ArtifactHandle<
$id_kernel_ty,
> = petri_artifacts_core::ArtifactHandle::new();
#[cfg(target_arch = $arch)]
pub const LINUX_DIRECT_TEST_INITRD_NATIVE: petri_artifacts_core::ArtifactHandle<
$id_initrd_ty,
> = petri_artifacts_core::ArtifactHandle::new();
};
}
linux_direct_native!(
LINUX_DIRECT_TEST_KERNEL_X64,
LINUX_DIRECT_TEST_INITRD_X64,
"x86_64"
);
linux_direct_native!(
LINUX_DIRECT_TEST_KERNEL_AARCH64,
LINUX_DIRECT_TEST_INITRD_AARCH64,
"aarch64"
);
declare_artifacts! {
LINUX_DIRECT_TEST_KERNEL_X64,
LINUX_DIRECT_TEST_INITRD_X64,
LINUX_DIRECT_TEST_KERNEL_AARCH64,
LINUX_DIRECT_TEST_INITRD_AARCH64,
PCAT_FIRMWARE_X64,
SVGA_FIRMWARE_X64,
UEFI_FIRMWARE_X64,
UEFI_FIRMWARE_AARCH64,
}
impl IsLoadable for LINUX_DIRECT_TEST_KERNEL_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsLoadable for LINUX_DIRECT_TEST_INITRD_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsLoadable for LINUX_DIRECT_TEST_KERNEL_AARCH64 {
const ARCH: MachineArch = MachineArch::Aarch64;
}
impl IsLoadable for LINUX_DIRECT_TEST_INITRD_AARCH64 {
const ARCH: MachineArch = MachineArch::Aarch64;
}
impl IsLoadable for PCAT_FIRMWARE_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsLoadable for SVGA_FIRMWARE_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsLoadable for UEFI_FIRMWARE_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsLoadable for UEFI_FIRMWARE_AARCH64 {
const ARCH: MachineArch = MachineArch::Aarch64;
}
}
pub mod openhcl_igvm {
use petri_artifacts_common::tags::IsLoadable;
use petri_artifacts_common::tags::IsOpenhclIgvm;
use petri_artifacts_common::tags::MachineArch;
use petri_artifacts_core::declare_artifacts;
declare_artifacts! {
LATEST_STANDARD_X64,
LATEST_STANDARD_DEV_KERNEL_X64,
LATEST_CVM_X64,
LATEST_LINUX_DIRECT_TEST_X64,
LATEST_STANDARD_AARCH64,
}
impl IsLoadable for LATEST_STANDARD_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsOpenhclIgvm for LATEST_STANDARD_X64 {}
impl IsLoadable for LATEST_STANDARD_DEV_KERNEL_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsOpenhclIgvm for LATEST_STANDARD_DEV_KERNEL_X64 {}
impl IsLoadable for LATEST_CVM_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsOpenhclIgvm for LATEST_CVM_X64 {}
impl IsLoadable for LATEST_LINUX_DIRECT_TEST_X64 {
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsOpenhclIgvm for LATEST_LINUX_DIRECT_TEST_X64 {}
impl IsLoadable for LATEST_STANDARD_AARCH64 {
const ARCH: MachineArch = MachineArch::Aarch64;
}
impl IsOpenhclIgvm for LATEST_STANDARD_AARCH64 {}
pub mod um_bin {
use petri_artifacts_core::declare_artifacts;
declare_artifacts! {
LATEST_LINUX_DIRECT_TEST_X64
}
}
pub mod um_dbg {
use petri_artifacts_core::declare_artifacts;
declare_artifacts! {
LATEST_LINUX_DIRECT_TEST_X64
}
}
}
pub mod test_vhd {
use crate::tags::IsHostedOnHvliteAzureBlobStore;
use petri_artifacts_common::tags::GuestQuirks;
use petri_artifacts_common::tags::IsTestVhd;
use petri_artifacts_common::tags::MachineArch;
use petri_artifacts_common::tags::OsFlavor;
use petri_artifacts_core::declare_artifacts;
declare_artifacts! {
GUEST_TEST_UEFI_X64,
GUEST_TEST_UEFI_AARCH64,
}
impl IsTestVhd for GUEST_TEST_UEFI_X64 {
const OS_FLAVOR: OsFlavor = OsFlavor::Uefi;
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsTestVhd for GUEST_TEST_UEFI_AARCH64 {
const OS_FLAVOR: OsFlavor = OsFlavor::Uefi;
const ARCH: MachineArch = MachineArch::Aarch64;
}
declare_artifacts! {
GEN1_WINDOWS_DATA_CENTER_CORE2022_X64
}
impl IsTestVhd for GEN1_WINDOWS_DATA_CENTER_CORE2022_X64 {
const OS_FLAVOR: OsFlavor = OsFlavor::Windows;
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsHostedOnHvliteAzureBlobStore for GEN1_WINDOWS_DATA_CENTER_CORE2022_X64 {
const FILENAME: &'static str =
"WindowsServer-2022-datacenter-core-smalldisk-20348.1906.230803.vhd";
const SIZE: u64 = 32214352384;
}
declare_artifacts! {
GEN2_WINDOWS_DATA_CENTER_CORE2022_X64
}
impl IsTestVhd for GEN2_WINDOWS_DATA_CENTER_CORE2022_X64 {
const OS_FLAVOR: OsFlavor = OsFlavor::Windows;
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsHostedOnHvliteAzureBlobStore for GEN2_WINDOWS_DATA_CENTER_CORE2022_X64 {
const FILENAME: &'static str =
"WindowsServer-2022-datacenter-core-smalldisk-g2-20348.1906.230803.vhd";
const SIZE: u64 = 32214352384;
}
declare_artifacts! {
FREE_BSD_13_2_X64
}
impl IsTestVhd for FREE_BSD_13_2_X64 {
const OS_FLAVOR: OsFlavor = OsFlavor::FreeBsd;
const ARCH: MachineArch = MachineArch::X86_64;
fn quirks() -> GuestQuirks {
GuestQuirks {
hyperv_shutdown_ic_sleep: Some(std::time::Duration::from_secs(15)),
}
}
}
impl IsHostedOnHvliteAzureBlobStore for FREE_BSD_13_2_X64 {
const FILENAME: &'static str = "FreeBSD-13.2-RELEASE-amd64.vhd";
const SIZE: u64 = 6477005312;
}
declare_artifacts! {
UBUNTU_2204_SERVER_X64
}
impl IsTestVhd for UBUNTU_2204_SERVER_X64 {
const OS_FLAVOR: OsFlavor = OsFlavor::Linux;
const ARCH: MachineArch = MachineArch::X86_64;
}
impl IsHostedOnHvliteAzureBlobStore for UBUNTU_2204_SERVER_X64 {
const FILENAME: &'static str = "ubuntu-22.04-server-cloudimg-amd64.vhd";
const SIZE: u64 = 2361655808;
}
declare_artifacts! {
UBUNTU_2404_SERVER_AARCH64
}
impl IsTestVhd for UBUNTU_2404_SERVER_AARCH64 {
const OS_FLAVOR: OsFlavor = OsFlavor::Linux;
const ARCH: MachineArch = MachineArch::Aarch64;
}
impl IsHostedOnHvliteAzureBlobStore for UBUNTU_2404_SERVER_AARCH64 {
const FILENAME: &'static str = "ubuntu-24.04-server-cloudimg-arm64.vhd";
const SIZE: u64 = 3758211584;
}
}
pub mod test_iso {
use crate::tags::IsHostedOnHvliteAzureBlobStore;
use petri_artifacts_common::tags::GuestQuirks;
use petri_artifacts_common::tags::IsTestIso;
use petri_artifacts_common::tags::MachineArch;
use petri_artifacts_common::tags::OsFlavor;
use petri_artifacts_core::declare_artifacts;
declare_artifacts! {
FREE_BSD_13_2_X64
}
impl IsTestIso for FREE_BSD_13_2_X64 {
const OS_FLAVOR: OsFlavor = OsFlavor::FreeBsd;
const ARCH: MachineArch = MachineArch::X86_64;
fn quirks() -> GuestQuirks {
GuestQuirks {
hyperv_shutdown_ic_sleep: Some(std::time::Duration::from_secs(20)),
}
}
}
impl IsHostedOnHvliteAzureBlobStore for FREE_BSD_13_2_X64 {
const FILENAME: &'static str = "FreeBSD-13.2-RELEASE-amd64-dvd1.iso";
const SIZE: u64 = 4245487616;
}
}
}
pub mod tags {
use petri_artifacts_core::ArtifactId;
pub trait IsHostedOnHvliteAzureBlobStore: ArtifactId {
const FILENAME: &'static str;
const SIZE: u64;
}
}