summaryrefslogtreecommitdiff
path: root/instrumentation/src/main.rs
diff options
context:
space:
mode:
authorAntoine A <>2023-11-21 00:47:30 +0100
committerAntoine A <>2023-11-21 00:47:30 +0100
commit42ba478f5dc26e0e2654112d3dba33e61ffdc1fa (patch)
treebf1779667ccffbdc396a7029c7c700de2a7e76ad /instrumentation/src/main.rs
parentc3f80619983e4eb80897c87add51bc70594e4b54 (diff)
downloaddepolymerization-42ba478f5dc26e0e2654112d3dba33e61ffdc1fa.tar.gz
depolymerization-42ba478f5dc26e0e2654112d3dba33e61ffdc1fa.tar.bz2
depolymerization-42ba478f5dc26e0e2654112d3dba33e61ffdc1fa.zip
Support ethereum 1.13.5
Use POA ethereum network for tests Improve test runner Update dependencies
Diffstat (limited to 'instrumentation/src/main.rs')
-rw-r--r--instrumentation/src/main.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/instrumentation/src/main.rs b/instrumentation/src/main.rs
index f196d7d..12971ad 100644
--- a/instrumentation/src/main.rs
+++ b/instrumentation/src/main.rs
@@ -17,7 +17,7 @@
use std::{
panic::catch_unwind,
path::PathBuf,
- time::{Duration, Instant},
+ time::{Duration, Instant}, sync::{Arc, Mutex},
};
use clap::Parser;
@@ -110,34 +110,34 @@ pub fn main() {
let pb = m.add(ProgressBar::new_spinner());
pb.set_style(start_style.clone());
pb.set_prefix(*name);
- pb.set_message("RUN");
+ pb.set_message("Init");
pb.enable_steady_tick(Duration::from_millis(1000));
let join = s.spawn(move || {
let start = Instant::now();
- let ctx = TestCtx::new(name);
- let tmp = ctx.clone();
+ let ctx: TestCtx = TestCtx::new(name, pb.clone());
+ let out = Arc::new(Mutex::new(String::new()));
+ let tmp = out.clone();
set_hook(Box::new(move |info| {
let mut buf = Vec::new();
color_backtrace::BacktracePrinter::new()
.print_panic_info(info, &mut NoColor::new(&mut buf))
.ok();
let str = String::from_utf8(buf).unwrap_or_default();
- tmp.out.lock().unwrap().push_str(&str);
+ tmp.lock().unwrap().push_str(&str);
}));
let tmp = ctx.clone();
let result = catch_unwind(|| {
action(tmp);
});
- let lock = ctx.out.lock().unwrap();
if result.is_ok() {
pb.set_style(ok_style.clone());
pb.finish_with_message("OK");
} else {
pb.set_style(err_style.clone());
- pb.finish_with_message("ERR");
+ pb.finish();
}
-
- (result, start.elapsed(), lock.clone())
+ let out: String = out.lock().unwrap().clone();
+ (result, start.elapsed(), out)
});
(join, name)
})