Skip to content

Commit ff4f81b

Browse files
committed
fix(statetest): force progress rendering
1 parent a6ebd0c commit ff4f81b

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/revmc-statetest/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ revm-statetest-types.workspace = true
3030

3131
alloy-rlp = { version = "0.3", features = ["arrayvec", "derive"] }
3232
alloy-trie = { version = "0.9", features = ["ethereum"] }
33+
console = "0.16"
3334
dashmap = "6"
3435
eyre.workspace = true
3536
indicatif = "0.18"

crates/revmc-statetest/src/runner.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Keep in sync with upstream; revmc-specific code lives in `compiled.rs`.
33

44
use crate::merkle_trie::{TestValidationResult, compute_test_roots};
5-
use indicatif::{ProgressBar, ProgressDrawTarget};
5+
use console::Term;
6+
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle};
67
use revm_context::{Context, block::BlockEnv, cfg::CfgEnv, tx::TxEnv};
78
use revm_context_interface::result::{EVMError, ExecutionResult, HaltReason, InvalidTransaction};
89
use revm_database::{self as database, bal::EvmDatabaseError};
@@ -388,15 +389,28 @@ pub(crate) struct TestRunnerState {
388389
pub(crate) stop: Arc<AtomicBool>,
389390
}
390391

392+
fn console_bar(n_files: usize) -> ProgressBar {
393+
let bar = ProgressBar::with_draw_target(
394+
Some(n_files as u64),
395+
ProgressDrawTarget::term_like_with_hz(Box::new(Term::buffered_stderr()), 1),
396+
);
397+
bar.set_style(
398+
ProgressStyle::with_template(
399+
"[{elapsed_precise}] {wide_bar} {pos}/{len} ({per_sec}, eta {eta})",
400+
)
401+
.unwrap()
402+
.progress_chars("=>-"),
403+
);
404+
bar.enable_steady_tick(Duration::from_secs(1));
405+
bar
406+
}
407+
391408
impl TestRunnerState {
392409
pub(crate) fn new(test_files: Vec<PathBuf>) -> Self {
393410
let n_files = test_files.len();
394411
Self {
395412
n_errors: Arc::new(AtomicUsize::new(0)),
396-
console_bar: Arc::new(ProgressBar::with_draw_target(
397-
Some(n_files as u64),
398-
ProgressDrawTarget::stdout(),
399-
)),
413+
console_bar: Arc::new(console_bar(n_files)),
400414
queue: Arc::new(Mutex::new((0usize, test_files))),
401415
elapsed: Arc::new(Mutex::new(Duration::ZERO)),
402416
stop: Arc::new(AtomicBool::new(false)),

0 commit comments

Comments
 (0)