microsoft/openvmm

Public

mirrored fromhttps://github.com/microsoft/openvmmAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
e1cdda602823a24e5785dbcb350e21da7f113215

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

petri/petri_artifacts_common/src/lib.rs

95lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! `petri` test artifact declarations used by all petri-based tests, no matter
5//! what VMM backend is being used.
6
7#![forbid(unsafe_code)]
8#![warn(missing_docs)]
9
10/// Artifact declarations
11pub mod artifacts {
12 use petri_artifacts_core::declare_artifacts;
13
14 declare_artifacts! {
15 /// Pipette windows x86_64 executable
16 PIPETTE_WINDOWS_X64,
17 /// Pipette linux x86_64 executable
18 PIPETTE_LINUX_X64,
19 /// Pipette windows aarch64 executable
20 PIPETTE_WINDOWS_AARCH64,
21 /// Pipette linux aarch64 executable
22 PIPETTE_LINUX_AARCH64,
23 /// Directory to put petri test logs in
24 TEST_LOG_DIRECTORY,
25 }
26}
27
28/// Artifact tag trait declarations
29pub mod tags {
30 use petri_artifacts_core::ArtifactId;
31
32 /// A coarse-grained label used to differentiate between different OS
33 /// environments.
34 #[derive(Debug, Clone, Copy)]
35 #[allow(missing_docs)] // Self-describing names.
36 pub enum OsFlavor {
37 Windows,
38 Linux,
39 FreeBsd,
40 Uefi,
41 }
42
43 /// The machine architecture supported by the artifact or VM.
44 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
45 #[allow(missing_docs)] // Self describing names
46 pub enum MachineArch {
47 X86_64,
48 Aarch64,
49 }
50
51 /// Quirks needed to boot a guest.
52 #[derive(Default, Copy, Clone, Debug)]
53 pub struct GuestQuirks {
54 /// How long to wait after the shutdown IC reports ready before sending
55 /// the shutdown command.
56 pub hyperv_shutdown_ic_sleep: Option<std::time::Duration>,
57 }
58
59 /// Artifact is a OpenHCL IGVM file
60 pub trait IsOpenhclIgvm: IsLoadable + ArtifactId {}
61
62 /// Artifact is a bootable test VHD file
63 pub trait IsTestVhd: ArtifactId {
64 /// What [`OsFlavor`] this image boots into.
65 const OS_FLAVOR: OsFlavor;
66
67 /// What [`MachineArch`] this image supports.
68 const ARCH: MachineArch;
69
70 /// Declare any "quirks" needed to boot the image.
71 fn quirks() -> GuestQuirks {
72 GuestQuirks::default()
73 }
74 }
75
76 /// Artifact is a bootable test ISO file
77 pub trait IsTestIso: ArtifactId {
78 /// What [`OsFlavor`] this image boots into.
79 const OS_FLAVOR: OsFlavor;
80
81 /// What [`MachineArch`] this image supports.
82 const ARCH: MachineArch;
83
84 /// Declare any "quirks" needed to boot the image.
85 fn quirks() -> GuestQuirks {
86 GuestQuirks::default()
87 }
88 }
89
90 /// Artifact is a binary that can be loaded into a VM
91 pub trait IsLoadable: ArtifactId {
92 /// What [`MachineArch`] this artifact supports.
93 const ARCH: MachineArch;
94 }
95}
96