diff --git a/.gitignore b/.gitignore index e8ccf9a302..97f24b9b5a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,10 @@ __pycache__/ /plans/ /workspace/ /e2e-consolidated-report.md +# Default outputs of the rocm-dash-tui gen_cast and gen_screenshots examples when +# run from the repository root. +/rocm-dash.cast +/screenshots/ # Sphinx docs: _toc.yml is generated from _toc.yml.in at build time docs/rocm-docs/sphinx/_toc.yml diff --git a/crates/rocm-dash-collectors/Cargo.toml b/crates/rocm-dash-collectors/Cargo.toml index 440eef13fd..5926adb3d0 100644 --- a/crates/rocm-dash-collectors/Cargo.toml +++ b/crates/rocm-dash-collectors/Cargo.toml @@ -27,11 +27,6 @@ tokio = { version = "1", features = ["full"] } reqwest = { version = "0.12", default-features = false } [dev-dependencies] -# Test-only: `write_fake_executable` plants the fake `amd-smi` the timeout tests -# run without the intermittent "Text file busy" failure that `std::fs::write` -# followed by a chmod hits. `rocm-core` is also a normal dependency above -# (`amd_smi.rs` uses `device_readable_bounded`), so this entry only restates it. -rocm-core = { path = "../rocm-core" } tokio = { version = "1", features = ["full"] } tempfile = "3" wiremock = "0.6" diff --git a/crates/rocm-dash-tui/examples/gen_cast.rs b/crates/rocm-dash-tui/examples/gen_cast.rs index 6468caabf6..36e6a706b0 100644 --- a/crates/rocm-dash-tui/examples/gen_cast.rs +++ b/crates/rocm-dash-tui/examples/gen_cast.rs @@ -50,12 +50,14 @@ const DEFAULT_BG: (u8, u8, u8) = (13, 15, 18); )] struct Args { /// Session NDJSON recording to render (`PersistedEntry` lines). - #[arg(long, default_value = "/tmp/mi355x-demo.ndjson")] + #[arg(long)] input: PathBuf, /// Output cast file. Parent dir created if absent. The default is relative - /// to the working directory. - #[arg(long, default_value = "../marketing/asciinema/rocm-dash.cast")] + /// to the working directory. It is git-ignored only when produced at the + /// repository root; a run from elsewhere writes the file there instead, + /// uncovered by that rule. + #[arg(long, default_value = "rocm-dash.cast")] output: PathBuf, /// Terminal grid (cols × rows) the cast is rendered at. @@ -370,6 +372,17 @@ const fn resolve_color(c: Option, default: (u8, u8, u8)) -> (u8, u8, u8) mod tests { use super::*; + #[test] + fn input_is_required_and_output_defaults_to_the_working_directory() { + let err = Args::try_parse_from(["gen_cast"]) + .err() + .expect("no recording is produced at a fixed path, so --input has no default"); + assert_eq!(err.kind(), clap::error::ErrorKind::MissingRequiredArgument); + let args = Args::try_parse_from(["gen_cast", "--input", "session.ndjson"]) + .expect("--input alone is enough"); + assert_eq!(args.output, PathBuf::from("rocm-dash.cast")); + } + #[test] fn generated_cast_is_marked_simulated() { let mut state = build_state(); diff --git a/crates/rocm-dash-tui/examples/gen_screenshots.rs b/crates/rocm-dash-tui/examples/gen_screenshots.rs index 9677b39984..fb77942d69 100644 --- a/crates/rocm-dash-tui/examples/gen_screenshots.rs +++ b/crates/rocm-dash-tui/examples/gen_screenshots.rs @@ -34,18 +34,17 @@ use rocm_dash_tui::app::{ActiveTab, AppState, ConnState, Modal}; use rocm_dash_tui::ui; #[derive(Parser)] -#[command( - name = "gen_screenshots", - about = "Render TUI views to SVG for marketing" -)] +#[command(name = "gen_screenshots", about = "Render TUI views to SVG")] struct Args { /// Session NDJSON recording to render (`PersistedEntry` lines). - #[arg(long, default_value = "/tmp/mi355x-demo.ndjson")] + #[arg(long)] input: PathBuf, /// Output directory. Created if absent. SVGs are named per view. The - /// default is relative to the working directory. - #[arg(long, default_value = "../marketing/screenshots")] + /// default is relative to the working directory. It is git-ignored only + /// when produced at the repository root; a run from elsewhere writes the + /// files there instead, uncovered by that rule. + #[arg(long, default_value = "screenshots")] output_dir: PathBuf, /// How many snapshots to replay before capturing. Higher = fuller @@ -450,6 +449,17 @@ fn xml_escape(s: &str) -> String { mod tests { use super::*; + #[test] + fn input_is_required_and_output_dir_defaults_to_the_working_directory() { + let err = Args::try_parse_from(["gen_screenshots"]) + .err() + .expect("no recording is produced at a fixed path, so --input has no default"); + assert_eq!(err.kind(), clap::error::ErrorKind::MissingRequiredArgument); + let args = Args::try_parse_from(["gen_screenshots", "--input", "session.ndjson"]) + .expect("--input alone is enough"); + assert_eq!(args.output_dir, PathBuf::from("screenshots")); + } + #[test] fn generated_screenshot_is_marked_simulated() { let mut state = build_state("default-dark", &[], 0);