flowey_lib_hvlite/
test_nextest_vmm_tests_archive.rsuse crate::build_nextest_vmm_tests::NextestVmmTestsArchive;
use crate::run_cargo_nextest_run::NextestProfile;
use flowey::node::prelude::*;
use flowey_lib_common::run_cargo_nextest_run::TestResults;
use std::collections::BTreeMap;
flowey_request! {
pub struct Request {
pub nextest_archive_file: ReadVar<NextestVmmTestsArchive>,
pub nextest_filter_expr: Option<String>,
pub nextest_profile: NextestProfile,
pub extra_env: ReadVar<BTreeMap<String, String>>,
pub pre_run_deps: Vec<ReadVar<SideEffect>>,
pub results: WriteVar<TestResults>,
}
}
new_simple_flow_node!(struct Node);
impl SimpleFlowNode for Node {
type Request = Request;
fn imports(ctx: &mut ImportCtx<'_>) {
ctx.import::<crate::run_cargo_nextest_run::Node>();
}
fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
let Request {
nextest_archive_file,
nextest_filter_expr,
nextest_profile,
extra_env,
mut pre_run_deps,
results,
} = request;
if !matches!(ctx.backend(), FlowBackend::Local)
&& matches!(ctx.platform(), FlowPlatform::Linux(_))
{
pre_run_deps.push({
ctx.emit_rust_step("ensure /dev/kvm is accessible", |_| {
|_| {
let sh = xshell::Shell::new()?;
xshell::cmd!(sh, "sudo chmod a+rw /dev/kvm").run()?;
Ok(())
}
})
});
}
let nextest_archive = nextest_archive_file.map(ctx, |x| x.0);
ctx.req(crate::run_cargo_nextest_run::Request {
friendly_name: "vmm_tests".into(),
run_kind: flowey_lib_common::run_cargo_nextest_run::NextestRunKind::RunFromArchive(
nextest_archive,
),
nextest_profile,
nextest_filter_expr,
run_ignored: false,
extra_env: Some(extra_env),
pre_run_deps,
results,
});
Ok(())
}
}