Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(cap-test): add compat-matrix command with gate option

Richie McIlroy7d0038b02754
diff --git a/crates/cap-test/src/main.rs b/crates/cap-test/src/main.rs
index 4a06df992..57e657ef1 100644
--- a/crates/cap-test/src/main.rs
+++ b/crates/cap-test/src/main.rs
@@ -11,7 +11,7 @@ mod suites;
use config::TestConfig;
use discovery::DiscoveredHardware;
-use matrix::MatrixRunner;
+use matrix::{CompatMatrixRunner, MatrixRunner};
#[allow(unused_imports)]
use results::{ResultsSummary, TestResults};
@@ -76,6 +76,20 @@ enum Commands {
output: Option<PathBuf>,
},
+ CompatMatrix {
+ #[arg(short, long)]
+ config: Option<PathBuf>,
+
+ #[arg(short, long)]
+ output: Option<PathBuf>,
+
+ #[arg(long)]
+ interactive: bool,
+
+ #[arg(long)]
+ gate: bool,
+ },
+
Validate {
path: PathBuf,
@@ -136,6 +150,18 @@ async fn main() -> Result<()> {
cmd_benchmark(duration, warmup, output).await?;
}
+ Commands::CompatMatrix {
+ config,
+ output,
+ interactive,
+ gate,
+ } => {
+ let passed = cmd_compat_matrix(config, output, interactive).await?;
+ if gate && !passed {
+ std::process::exit(1);
+ }
+ }
+
Commands::Validate { path, json } => {
cmd_validate(path, json).await?;
}
@@ -251,6 +277,31 @@ async fn cmd_benchmark(duration: u64, warmup: u64, output: Option<PathBuf>) -> R
Ok(())
}
+async fn cmd_compat_matrix(
+ config_path: Option<PathBuf>,
+ output: Option<PathBuf>,
+ interactive: bool,
+) -> Result<bool> {
+ let config = if let Some(path) = config_path {
+ TestConfig::load(&path)?
+ } else {
+ TestConfig::compatibility()
+ };
+
+ let hardware = DiscoveredHardware::discover().await?;
+ let runner = CompatMatrixRunner::new(config, hardware, interactive);
+ let report = runner.run().await?;
+
+ report.print_summary();
+
+ if let Some(path) = output {
+ report.save_json(&path)?;
+ println!("Compatibility report saved to: {}", path.display());
+ }
+
+ Ok(report.release_gate_passed)
+}
+
async fn cmd_validate(path: PathBuf, json_output: bool) -> Result<()> {
let validation = suites::validate_recording(&path).await?;