summaryrefslogtreecommitdiff
path: root/subplotlib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-05-30 21:39:58 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-12-27 14:28:14 +0000
commitd1f336e141c3533c5e4dda049f03dfe168f99470 (patch)
tree24ad151c5a86c0e981c0fd649b70487bd0f9e1bf /subplotlib
parent32bc1e9aaa2b8a6a08c27d8b8fda838d741766b9 (diff)
downloadsubplot-d1f336e141c3533c5e4dda049f03dfe168f99470.tar.gz
subplotlib: Add some scenario running output to make it easier to work out what broke
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r--subplotlib/src/scenario.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/subplotlib/src/scenario.rs b/subplotlib/src/scenario.rs
index b239883..c0f3e87 100644
--- a/subplotlib/src/scenario.rs
+++ b/subplotlib/src/scenario.rs
@@ -284,6 +284,7 @@ impl Scenario {
// Firstly, we start all the contexts
let mut ret = Ok(());
let mut highest_start = None;
+ println!("Scenario Start: {}", self.contexts.title());
for (i, hook) in self.contexts.hooks.borrow().iter().enumerate() {
let res = hook.scenario_starts(&self.contexts);
if res.is_err() {
@@ -292,10 +293,14 @@ impl Scenario {
}
highest_start = Some(i);
}
-
+ println!(
+ "*** Context hooks returned {}",
+ if ret.is_ok() { "OK" } else { "Failure" }
+ );
if ret.is_ok() {
let mut highest = None;
for (i, step) in self.steps.iter().map(|(step, _)| step).enumerate() {
+ 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());
@@ -305,8 +310,17 @@ impl Scenario {
}
highest_prep = Some(i);
}
+ println!(
+ " *** Context hooks returned {}",
+ if ret.is_ok() { "OK" } else { "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;
@@ -314,6 +328,7 @@ 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)
@@ -321,9 +336,15 @@ 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());
let res = cleanup.call(&self.contexts, true);
+ println!(
+ " Cleanup returned {}",
+ if res.is_ok() { "OK" } else { "Failure" }
+ );
ret = ret.and(res);
}
}
@@ -331,11 +352,16 @@ 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" }
+ );
ret
}
}