Skip to main content

flowey_lib_hvlite/
resolve_vmm_tests_pipeline_artifacts.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Resolve artifacts from the test content dir used as parts of the pipeline
5//! to run VMM tests.
6
7use crate::init_vmm_tests_content_dir::VmmTestsBuiltArtifactsWrite;
8use flowey::node::prelude::*;
9
10flowey_request! {
11    pub struct Request {
12        /// Directory to symlink / copy test contents into. Does not need to be
13        /// empty.
14        pub test_content_dir: ReadVar<PathBuf>,
15        /// Artifacts to resolve
16        pub built_artifacts_write: VmmTestsBuiltArtifactsWrite,
17    }
18}
19
20new_simple_flow_node!(struct Node);
21
22impl SimpleFlowNode for Node {
23    type Request = Request;
24
25    fn imports(_ctx: &mut ImportCtx<'_>) {}
26
27    fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
28        let Request {
29            test_content_dir,
30            built_artifacts_write,
31        } = request;
32
33        ctx.emit_rust_step("resolving vmm tests pipeline artifacts", |ctx| {
34            claim_vars!(ctx, (test_content_dir, built_artifacts_write));
35
36            move |rt| {
37                let test_content_dir = rt.read(test_content_dir);
38
39                built_artifacts_write.resolve(rt, test_content_dir)?;
40
41                Ok(())
42            }
43        });
44
45        Ok(())
46    }
47}