Skip to content

Commit 39144b0

Browse files
authored
petri: use generics instead of Box for backends (#1669)
Refactors petri to use generics instead of Box for backends. This should reduce duplicate code going forward and makes it possible to use generics in backend-agnostic configuration functions.
1 parent 1106b02 commit 39144b0

File tree

24 files changed

+1958
-1748
lines changed

24 files changed

+1958
-1748
lines changed

flowey/flowey_hvlite/src/pipelines/vmm_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct VmmTestsCli {
4545
///
4646
/// Available flags with default values:
4747
///
48-
/// `-tdx,-hyperv_vbs,+windows,+ubuntu,+freebsd,+openhcl,+openvmm,+hyperv,+uefi,+pcat,+tmk,+guest_test_uefi`
48+
/// `-tdx,-hyperv_vbs,+windows,+ubuntu,+freebsd,+linux,+openhcl,+openvmm,+hyperv,+uefi,+pcat,+tmk,+guest_test_uefi`
4949
// TODO: Automatically generate the list of possible flags
5050
#[clap(long)]
5151
flags: Option<VmmTestSelectionFlags>,

flowey/flowey_lib_hvlite/src/_jobs/local_build_and_run_nextest_vmm_tests.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ define_vmm_test_selection_flags! {
8989
windows: true,
9090
ubuntu: true,
9191
freebsd: true,
92+
linux: true,
9293
openhcl: true,
9394
openvmm: true,
9495
hyperv: true,
@@ -215,6 +216,7 @@ impl SimpleFlowNode for Node {
215216
windows,
216217
mut ubuntu,
217218
freebsd,
219+
linux,
218220
mut openhcl,
219221
openvmm,
220222
hyperv,
@@ -250,7 +252,6 @@ impl SimpleFlowNode for Node {
250252
}
251253
if !ubuntu {
252254
filter.push_str(" & !test(ubuntu)");
253-
build.pipette_linux = false;
254255
}
255256
if !windows {
256257
filter.push_str(" & !test(windows)");
@@ -259,6 +260,12 @@ impl SimpleFlowNode for Node {
259260
if !freebsd {
260261
filter.push_str(" & !test(freebsd)");
261262
}
263+
if !linux {
264+
filter.push_str(" & !test(linux)");
265+
}
266+
if !linux && !ubuntu {
267+
build.pipette_linux = false;
268+
}
262269
if !openhcl {
263270
filter.push_str(" & !test(openhcl)");
264271
build.openhcl = false;
@@ -297,13 +304,13 @@ impl SimpleFlowNode for Node {
297304
if ubuntu {
298305
artifacts.push(KnownTestArtifacts::Ubuntu2204ServerX64Vhd);
299306
}
300-
if windows {
301-
artifacts.extend_from_slice(&[
302-
KnownTestArtifacts::Gen1WindowsDataCenterCore2022X64Vhd,
303-
KnownTestArtifacts::Gen2WindowsDataCenterCore2022X64Vhd,
304-
]);
307+
if windows && uefi {
308+
artifacts.push(KnownTestArtifacts::Gen2WindowsDataCenterCore2022X64Vhd);
309+
}
310+
if windows && pcat {
311+
artifacts.push(KnownTestArtifacts::Gen1WindowsDataCenterCore2022X64Vhd);
305312
}
306-
if freebsd {
313+
if freebsd && pcat {
307314
artifacts.extend_from_slice(&[
308315
KnownTestArtifacts::FreeBsd13_2X64Vhd,
309316
KnownTestArtifacts::FreeBsd13_2X64Iso,

openvmm/openvmm_entry/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ fn vm_config_from_command_line(
974974
get_resources::ged::GuestSecureBootTemplateType::MicrosoftWindows
975975
},
976976
Some(SecureBootTemplateCli::UefiCa) => {
977-
get_resources::ged::GuestSecureBootTemplateType::MicrosoftUefiCertificateAuthoritiy
977+
get_resources::ged::GuestSecureBootTemplateType::MicrosoftUefiCertificateAuthority
978978
}
979979
None => {
980980
get_resources::ged::GuestSecureBootTemplateType::None

petri/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
pub mod disk_image;
1212
mod linux_direct_serial_agent;
13-
mod openhcl_diag;
13+
// TODO: Add docs and maybe a trait interface for this, or maybe this can
14+
// remain crate-local somehow without violating interface privacy.
15+
#[expect(missing_docs)]
16+
pub mod openhcl_diag;
1417
mod test;
1518
mod tracing;
1619
mod vm;

petri/src/openhcl_diag.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ use diag_client::kmsg_stream::KmsgStream;
88
use futures::io::AllowStdIo;
99
use std::io::Read;
1010

11-
pub(crate) struct OpenHclDiagHandler(DiagClient);
11+
pub struct OpenHclDiagHandler(DiagClient);
1212

1313
/// The result of running a VTL2 command.
1414
#[derive(Debug)]
15-
#[expect(dead_code)] // Fields output via Debug for debugging purposes.
16-
pub(crate) struct Vtl2CommandResult {
15+
pub struct Vtl2CommandResult {
1716
/// The stdout of the command.
1817
pub stdout: String,
1918
/// The stderr of the command.
@@ -74,7 +73,7 @@ impl OpenHclDiagHandler {
7473
})
7574
}
7675

77-
pub(crate) async fn core_dump(&self, name: &str, path: &std::path::Path) -> anyhow::Result<()> {
76+
pub async fn core_dump(&self, name: &str, path: &std::path::Path) -> anyhow::Result<()> {
7877
let client = self.diag_client().await?;
7978
let pid = client.get_pid(name).await?;
8079
client
@@ -87,21 +86,21 @@ impl OpenHclDiagHandler {
8786
.await
8887
}
8988

90-
pub(crate) async fn crash(&self, name: &str) -> anyhow::Result<()> {
89+
pub async fn crash(&self, name: &str) -> anyhow::Result<()> {
9190
let client = self.diag_client().await?;
9291
let pid = client.get_pid(name).await?;
9392
client.crash(pid).await
9493
}
9594

96-
pub(crate) async fn test_inspect(&self) -> anyhow::Result<()> {
95+
pub async fn test_inspect(&self) -> anyhow::Result<()> {
9796
self.diag_client()
9897
.await?
9998
.inspect("", None, None)
10099
.await
101100
.map(|_| ())
102101
}
103102

104-
pub(crate) async fn kmsg(&self) -> anyhow::Result<KmsgStream> {
103+
pub async fn kmsg(&self) -> anyhow::Result<KmsgStream> {
105104
self.diag_client().await?.kmsg(false).await
106105
}
107106

0 commit comments

Comments
 (0)