summaryrefslogtreecommitdiff
path: root/subplotlib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2022-04-01 19:11:55 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2022-04-01 19:11:55 +0100
commitd2edcaed3ae20c0b6ebde1b9c6c778ef94cf157e (patch)
tree026d9ad93a6a955d729300c9eb47b5b23141dcfd /subplotlib
parenta258486420c7cc53a925d612465d9d55ffb81566 (diff)
downloadsubplot-d2edcaed3ae20c0b6ebde1b9c6c778ef94cf157e.tar.gz
(subplotlib): Make scenario run output a little closer to Python runner
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r--subplotlib/src/scenario.rs40
1 files changed, 13 insertions, 27 deletions
diff --git a/subplotlib/src/scenario.rs b/subplotlib/src/scenario.rs
index f382561..1200a99 100644
--- a/subplotlib/src/scenario.rs
+++ b/subplotlib/src/scenario.rs
@@ -299,7 +299,7 @@ impl Scenario {
// Firstly, we start all the contexts
let mut ret = Ok(());
let mut highest_start = None;
- println!("Scenario Start: {}", self.contexts.title());
+ println!("scenario: {}", self.contexts.title());
for (i, hook) in self.contexts.hooks.borrow().iter().enumerate() {
let res = hook.scenario_starts(&self.contexts);
if res.is_err() {
@@ -308,14 +308,13 @@ impl Scenario {
}
highest_start = Some(i);
}
- println!(
- "*** Context hooks returned {}",
- if ret.is_ok() { "OK" } else { "Failure" }
- );
+ if ret.is_err() {
+ println!("*** Context hooks returned failure",);
+ }
if ret.is_ok() {
let mut highest = None;
for (i, step) in self.steps.iter().map(|(step, _)| step).enumerate() {
- println!(" !!! Step {}", step.name());
+ println!(" step: {}", step.name());
let mut highest_prep = None;
for (i, prep) in self.contexts.hooks.borrow().iter().enumerate() {
let res = prep.step_starts(&self.contexts, step.name());
@@ -325,17 +324,11 @@ impl Scenario {
}
highest_prep = Some(i);
}
- println!(
- " *** Context hooks returned {}",
- if ret.is_ok() { "OK" } else { "Failure" }
- );
+ if ret.is_err() {
+ println!("*** Context hooks returned failure",);
+ }
if ret.is_ok() {
- println!(" >>> Run step function");
let res = step.call(&self.contexts, false);
- println!(
- " Step returned {}",
- if res.is_ok() { "OK" } else { "Failure" }
- );
if res.is_err() {
ret = res;
break;
@@ -343,7 +336,6 @@ impl Scenario {
highest = Some(i);
}
if let Some(n) = highest_prep {
- println!(" *** Unwinding step contexts");
for hookn in (0..=n).rev() {
let res = self.contexts.hooks.borrow()[hookn].step_stops(&self.contexts);
ret = ret.and(res)
@@ -351,15 +343,13 @@ impl Scenario {
}
}
if let Some(n) = highest {
- println!(" *** Running cleanup functions");
for stepn in (0..=n).rev() {
if let (_, Some(cleanup)) = &self.steps[stepn] {
- println!(" >>> Cleanup {}", cleanup.name());
+ println!(" cleanup: {}", cleanup.name());
let res = cleanup.call(&self.contexts, true);
- println!(
- " Cleanup returned {}",
- if res.is_ok() { "OK" } else { "Failure" }
- );
+ if res.is_err() {
+ println!("*** Cleanup returned failure",);
+ }
ret = ret.and(res);
}
}
@@ -367,16 +357,12 @@ impl Scenario {
}
if let Some(n) = highest_start {
- println!("*** Running scenario closedown");
for hookn in (0..=n).rev() {
let res = self.contexts.hooks.borrow()[hookn].scenario_stops(&self.contexts);
ret = ret.and(res);
}
}
- println!(
- "<<< Scenario returns {}",
- if ret.is_ok() { "OK" } else { "Failure" }
- );
+ println!(" return: {}", if ret.is_ok() { "OK" } else { "Failure" });
ret
}
}