From 8d7989cc6ace060ddb706023b4ebe062346ae096 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 17 Apr 2025 17:02:00 +0300 Subject: [PATCH] Revert "fix: "cibtool run list" shows ids without loading run info" This reverts commit 900a457157da42eedcd5f7ebab48413a4406e27a. --- ci-broker.md | 2 +- ci-broker.yaml | 5 ----- src/bin/cibtoolcmd/run.rs | 15 +++++++-------- src/subplot.rs | 10 ---------- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/ci-broker.md b/ci-broker.md index edca365f..72458ab3 100644 --- a/ci-broker.md +++ b/ci-broker.md @@ -434,7 +434,7 @@ when I run cibtool --db ci-broker.db event list then stdout is empty when I run cibtool --db ci-broker.db run list -then stdout has 2 lines +then stdout has 2 lines containing "xyzzy" ~~~ diff --git a/ci-broker.yaml b/ci-broker.yaml index 055c32c1..40755884 100644 --- a/ci-broker.yaml +++ b/ci-broker.yaml @@ -25,11 +25,6 @@ rust: function: stdout_has_one_line -- then: "stdout has {n:uint} lines" - impl: - rust: - function: stdout_has_n_lines - - then: "stdout has {n:uint} lines containing \"{text:text}\"" impl: rust: diff --git a/src/bin/cibtoolcmd/run.rs b/src/bin/cibtoolcmd/run.rs index befc19ab..6d83d2f6 100644 --- a/src/bin/cibtoolcmd/run.rs +++ b/src/bin/cibtoolcmd/run.rs @@ -229,14 +229,18 @@ impl Leaf for ListRuns { fn run(&self, args: &Args) -> Result<(), CibToolError> { let db = args.open_db()?; + let runs = if let Some(wanted) = &self.adapter_run_id { + db.find_runs(wanted)? + } else { + db.get_all_runs()? + }; + if self.json { - let runs = db.get_all_runs()?; println!( "{}", serde_json::to_string_pretty(&runs).map_err(CibToolError::RunToJson)? ); - } else if let Some(wanted) = &self.adapter_run_id { - let runs = db.find_runs(wanted)?; + } else { for run in runs { println!( "{} {}", @@ -246,11 +250,6 @@ impl Leaf for ListRuns { .unwrap_or("unknown".into()) ); } - } else { - let run_ids = db.list_runs()?; - for run_id in run_ids { - println!("{}", run_id); - } } Ok(()) diff --git a/src/subplot.rs b/src/subplot.rs index 11a392ac..b834700f 100644 --- a/src/subplot.rs +++ b/src/subplot.rs @@ -395,16 +395,6 @@ fn stdout_has_one_line(runcmd: &Runcmd) { } } -#[step] -#[context(SubplotContext)] -#[context(Runcmd)] -fn stdout_has_n_lines(runcmd: &Runcmd, n: usize) { - let linecount = runcmd.stdout_as_string().lines().count(); - if linecount != n { - throw!(format!("stdout had {linecount} lines, expected {n}")); - } -} - #[step] #[context(SubplotContext)] #[context(Runcmd)]