flowey_lib_hvlite/_jobs/
build_and_run_doc_tests.rs1use crate::run_cargo_build::common::CommonProfile;
10use flowey::node::prelude::*;
11
12flowey_request! {
13 pub struct Params {
14 pub target: target_lexicon::Triple,
16 pub profile: CommonProfile,
18 pub done: WriteVar<SideEffect>,
19 }
20}
21
22new_simple_flow_node!(struct Node);
23
24impl SimpleFlowNode for Node {
25 type Request = Params;
26
27 fn imports(ctx: &mut ImportCtx<'_>) {
28 ctx.import::<crate::git_checkout_openvmm_repo::Node>();
29 ctx.import::<crate::install_openvmm_rust_build_essential::Node>();
30 }
31
32 fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
33 let Params {
34 target,
35 profile,
36 done,
37 } = request;
38
39 let rust_installed = ctx.reqv(crate::install_openvmm_rust_build_essential::Request);
40 let openvmm_repo_path = ctx.reqv(crate::git_checkout_openvmm_repo::req::GetRepoDir);
41
42 ctx.emit_rust_step(format!("run doctests for {target}"), |ctx| {
43 done.claim(ctx);
44 rust_installed.claim(ctx);
45 let openvmm_repo_path = openvmm_repo_path.claim(ctx);
46 move |rt| {
47 let sh = xshell::Shell::new()?;
48
49 let target = target.to_string();
50 let profile = match profile {
51 CommonProfile::Release => "release",
52 CommonProfile::Debug => "dev",
53 };
54
55 sh.change_dir(rt.read(openvmm_repo_path));
56 xshell::cmd!(sh, "cargo test --locked --doc --workspace --no-fail-fast --target {target} --profile {profile}").run()?;
57
58 Ok(())
59 }
60 });
61
62 Ok(())
63 }
64}