Skip to content
Open
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
14 changes: 14 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3062,6 +3062,7 @@ dependencies = [
name = "hcl"
version = "0.0.0"
dependencies = [
"aarch64defs",
"anyhow",
"arrayvec",
"bitfield-struct 0.11.0",
Expand All @@ -3079,6 +3080,7 @@ dependencies = [
"open_enum",
"pal",
"parking_lot",
"rsi",
"safe_intrinsics",
"sidecar_client",
"signal-hook",
Expand Down Expand Up @@ -3224,6 +3226,7 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
name = "hv1_emulator"
version = "0.0.0"
dependencies = [
"aarch64defs",
"build_rs_guest_arch",
"guestmem",
"hv1_structs",
Expand Down Expand Up @@ -6580,6 +6583,13 @@ dependencies = [
"zeroize",
]

[[package]]
name = "rsi"
version = "0.0.0"
dependencies = [
"zerocopy",
]

[[package]]
name = "rusqlite"
version = "0.37.0"
Expand Down Expand Up @@ -7816,6 +7826,7 @@ dependencies = [
"guestmem",
"hvdef",
"loader",
"memory_range",
"mesh",
"object 0.37.3",
"page_table",
Expand All @@ -7826,6 +7837,7 @@ dependencies = [
"tracing-subscriber",
"tracing_helpers",
"underhill_mem",
"user_driver",
"virt",
"virt_hvf",
"virt_kvm",
Expand Down Expand Up @@ -8567,6 +8579,7 @@ dependencies = [
"memory_range",
"pal_async",
"parking_lot",
"rsi",
"sparse_mmap",
"thiserror 2.0.16",
"tracelimit",
Expand Down Expand Up @@ -9049,6 +9062,7 @@ dependencies = [
"pal_uring",
"parking_lot",
"pci_core",
"rsi",
"safe_intrinsics",
"safeatomic",
"sidecar_client",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ tmk_tests = { path = "tmk/tmk_tests" }

aarch64defs = { path = "vm/aarch64/aarch64defs" }
aarch64emu = { path = "vm/aarch64/aarch64emu" }
rsi = { path = "vm/aarch64/rsi" }
acpi = { path = "vm/acpi" }
acpi_spec = { path = "vm/acpi_spec" }
chipset_arc_mutex_device = { path = "vm/chipset_arc_mutex_device" }
Expand Down
1 change: 1 addition & 0 deletions Guide/src/dev_guide/dev_tools/xflowey.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Some particularly notable pipelines:
- `cargo xflowey build-igvm` - primarily dev-tool used to build OpenHCL IGVM files locally
- `cargo xflowey restore-packages` - restores external packages needed to compile and run OpenVMM / OpenHCL
- `cargo xflowey vmm-tests-run` - build and run VMM tests with automatic artifact discovery. Use `--filter "test(name)"` to run specific tests
- `cargo xflowey cca-tests` - build and run ARM64 CCA tests using software emulator
Comment on lines 12 to +15

## `xflowey` vs `xtask`

Expand Down
198 changes: 198 additions & 0 deletions flowey/flowey_hvlite/src/pipelines/cca_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use flowey::node::prelude::ReadVar;
use flowey::pipeline::prelude::*;
use std::path::PathBuf;

/// CCA test flows, including installing, updating CCA emulation environment and run OpenVMM tests
#[derive(clap::Args)]
pub struct CcaTestsCli {
/// Root directory for holding all CCA test related stuff
#[clap(long, default_value = "target/cca-test")]
pub test_root: PathBuf,

/// Install CCA emulation environment, including downloading emulator and building all needed firmware
#[clap(long)]
pub install_emu: bool,

/// Update CCA emulation environment by rebuilding firmwares, support a few sub-commands
#[clap(long)]
pub update_emu: bool,

/// Verbose pipeline output
#[clap(long)]
pub verbose: bool,

#[clap(flatten)]
pub update_emu_subcmds: CcaTestsUpdateEmuSubCmds,
}

#[derive(clap::Args)]
#[clap(next_help_heading = "--update_emu subcommands")]
pub struct CcaTestsUpdateEmuSubCmds {
/// Rebuild the plane0 Linux image from the existing source tree.
#[clap(long)]
pub rebuild_plane0_linux: bool,

/// Rebuild the shrinkwrap-generated rootfs image.
#[clap(long)]
pub rebuild_rootfs: bool,

/// Update TF-A to specified revision and rebuild.
#[clap(long)]
pub tfa_rev: Option<String>,

/// Update TF-RMM to specified revision and rebuild.
#[clap(long)]
pub tfrmm_rev: Option<String>,

/// Update plane0 Linux to specified revision and rebuild.
#[clap(long)]
pub plane0_linux_rev: Option<String>,
}

impl IntoPipeline for CcaTestsCli {
fn into_pipeline(self, backend_hint: PipelineBackendHint) -> anyhow::Result<Pipeline> {
let Self {
test_root,
install_emu,
update_emu,
verbose,
update_emu_subcmds:
CcaTestsUpdateEmuSubCmds {
rebuild_plane0_linux,
rebuild_rootfs,
tfa_rev,
tfrmm_rev,
plane0_linux_rev,
},
} = self;

let openvmm_repo = flowey_lib_common::git_checkout::RepoSource::ExistingClone(
ReadVar::from_static(crate::repo_root()),
);

// Absolute path is expected across cca_tests infrastructure. Relative
// paths are resolved from repo root.
let test_root = if test_root.is_absolute() {
test_root
} else {
crate::repo_root().join(test_root)
};

let mut pipeline = Pipeline::new();

if install_emu {
let check_job = pipeline
.new_job(
FlowPlatform::host(backend_hint),
FlowArch::host(backend_hint),
"cca-tests: check existence of emulation environment needed tools",
)
.dep_on(
|ctx| flowey_lib_hvlite::_jobs::local_check_cca_emu_prereq::Params {
done: ctx.new_done_handle(),
},
)
.finish();

let install_job = pipeline
.new_job(
FlowPlatform::host(backend_hint),
FlowArch::host(backend_hint),
"cca-tests: install emulation environment",
)
.dep_on(|_| flowey_lib_hvlite::_jobs::cfg_versions::Request::Init)
.dep_on(
|_| flowey_lib_hvlite::_jobs::cfg_hvlite_reposource::Params {
hvlite_repo_source: openvmm_repo.clone(),
},
)
.dep_on(|_| flowey_lib_hvlite::_jobs::cfg_common::Params {
local_only: Some(flowey_lib_hvlite::_jobs::cfg_common::LocalOnlyParams {
interactive: true,
auto_install: true,
ignore_rust_version: true,
}),
verbose: ReadVar::from_static(verbose),
locked: false,
deny_warnings: false,
no_incremental: false,
})
.dep_on(
|ctx| flowey_lib_hvlite::_jobs::local_install_cca_emu::Params {
test_root: test_root.clone(),
done: ctx.new_done_handle(),
},
)
.finish();

pipeline.non_artifact_dep(&install_job, &check_job);
return Ok(pipeline);
}

let update_job = if update_emu {
Some(
pipeline
.new_job(
FlowPlatform::host(backend_hint),
FlowArch::host(backend_hint),
"cca-tests: update emulation environment",
)
.dep_on(
|ctx| flowey_lib_hvlite::_jobs::local_update_cca_emu::Params {
test_root: test_root.clone(),
sub_cmds: flowey_lib_hvlite::_jobs::local_update_cca_emu::SubCmds {
rebuild_plane0_linux,
rebuild_rootfs,
tfa_rev,
tfrmm_rev,
plane0_linux_rev,
},
done: ctx.new_done_handle(),
},
)
.finish(),
)
} else {
None
};

let test_job = pipeline
.new_job(
FlowPlatform::host(backend_hint),
FlowArch::host(backend_hint),
"cca-tests: run cca tests",
)
.dep_on(|_| flowey_lib_hvlite::_jobs::cfg_versions::Request::Init)
.dep_on(
|_| flowey_lib_hvlite::_jobs::cfg_hvlite_reposource::Params {
hvlite_repo_source: openvmm_repo.clone(),
},
)
.dep_on(|_| flowey_lib_hvlite::_jobs::cfg_common::Params {
local_only: Some(flowey_lib_hvlite::_jobs::cfg_common::LocalOnlyParams {
interactive: true,
auto_install: true,
ignore_rust_version: true,
}),
verbose: ReadVar::from_static(verbose),
locked: false,
deny_warnings: false,
no_incremental: false,
})
.dep_on(|ctx| flowey_lib_hvlite::_jobs::local_run_cca_test::Params {
test_root: test_root.clone(),
done: ctx.new_done_handle(),
})
.finish();

// Only add dependency if update_job exists
if let Some(update_job) = &update_job {
pipeline.non_artifact_dep(&test_job, update_job);
}

Ok(pipeline)
}
}
6 changes: 6 additions & 0 deletions flowey/flowey_hvlite/src/pipelines/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use cca_tests::CcaTestsCli;
use flowey::pipeline::prelude::*;
use restore_packages::RestorePackagesCli;
use vmm_tests_run::VmmTestsRunCli;

pub mod build_docs;
pub mod build_igvm;
pub mod build_reproducible;
pub mod cca_tests;
pub mod checkin_gates;
pub mod custom_vmfirmwareigvm_dll;
pub mod restore_packages;
Expand Down Expand Up @@ -36,6 +38,9 @@ pub enum OpenvmmPipelines {

/// Build and run VMM tests with automatic artifact discovery
VmmTestsRun(VmmTestsRunCli),

/// Build and run CCA tests with installation of emulation environment supported
CcaTests(CcaTestsCli),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this have to be a whole separate command? Would this not be considered a TMK for VMM test?

}

#[derive(clap::Subcommand)]
Expand Down Expand Up @@ -64,6 +69,7 @@ impl IntoPipeline for OpenvmmPipelines {
},
OpenvmmPipelines::RestorePackages(cmd) => cmd.into_pipeline(pipeline_hint),
OpenvmmPipelines::VmmTestsRun(cmd) => cmd.into_pipeline(pipeline_hint),
OpenvmmPipelines::CcaTests(cmd) => cmd.into_pipeline(pipeline_hint),
}
}
}
Loading
Loading