Compare commits

...

2 Commits

Author SHA1 Message Date
Omar Abdulla 1e68d19d60 Add revert reason to the assertion logs 2025-10-30 04:26:17 +03:00
Omar fefea17c8e Require test argument (#196)
* Require test argument

* Increase tx timeout and channel limits

* Add default arguments for tests

* Fix tests

* Fix tests
2025-10-27 00:17:47 +00:00
8 changed files with 41 additions and 15 deletions
Generated
+11
View File
@@ -1920,6 +1920,7 @@ dependencies = [
"anstyle",
"clap_lex",
"strsim",
"terminal_size",
]
[[package]]
@@ -7838,6 +7839,16 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "terminal_size"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed"
dependencies = [
"rustix",
"windows-sys 0.59.0",
]
[[package]]
name = "thiserror"
version = "1.0.69"
+1 -1
View File
@@ -26,7 +26,7 @@ ansi_term = "0.12.1"
anyhow = "1.0"
bson = { version = "2.15.0" }
cacache = { version = "13.1.0" }
clap = { version = "4", features = ["derive"] }
clap = { version = "4", features = ["derive", "wrap_help"] }
dashmap = { version = "6.1.0" }
foundry-compilers-artifacts = { version = "0.18.0" }
futures = { version = "0.3.31" }
+4 -4
View File
@@ -24,7 +24,7 @@ use strum::{AsRefStr, Display, EnumString, IntoStaticStr};
use temp_dir::TempDir;
#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
#[command(name = "retester")]
#[command(name = "retester", term_width = 100)]
pub enum Context {
/// Executes tests in the MatterLabs format differentially on multiple targets concurrently.
Test(Box<TestExecutionContext>),
@@ -510,7 +510,7 @@ pub struct ExportGenesisContext {
impl Default for TestExecutionContext {
fn default() -> Self {
Self::parse_from(["execution-context"])
Self::parse_from(["execution-context", "--test", "."])
}
}
@@ -612,7 +612,7 @@ impl AsRef<IgnoreSuccessConfiguration> for TestExecutionContext {
impl Default for BenchmarkingContext {
fn default() -> Self {
Self::parse_from(["benchmarking-context"])
Self::parse_from(["benchmarking-context", "--test", "."])
}
}
@@ -759,7 +759,7 @@ pub struct CorpusConfiguration {
/// - `{metadata_file_path}::{case_idx}::{mode}`: This is very similar to the above specifier
/// with the exception that in this case the mode is specified and will be used in the test.
#[serde_as(as = "Vec<serde_with::DisplayFromStr>")]
#[arg(short = 't', long = "test")]
#[arg(short = 't', long = "test", required = true)]
pub test_specifiers: Vec<ParsedTestSpecifier>,
}
+3 -1
View File
@@ -597,15 +597,17 @@ where
let expected = !assertion.exception;
let actual = receipt.status();
if actual != expected {
let revert_reason = tracing_result.revert_reason.as_ref();
tracing::error!(
expected,
actual,
?receipt,
?tracing_result,
?revert_reason,
"Transaction status assertion failed"
);
anyhow::bail!(
"Transaction status assertion failed - Expected {expected} but got {actual}",
"Transaction status assertion failed - Expected {expected} but got {actual}. Revert reason: {revert_reason:?}",
);
}
@@ -330,15 +330,18 @@ async fn start_cli_reporting_task(output_format: OutputFormat, reporter: Reporte
.unwrap();
writeln!(buf).unwrap();
buf = tokio::task::spawn_blocking(move || {
buf.flush().unwrap();
buf
})
.await
.unwrap();
if aggregator_events_rx.is_empty() {
buf = tokio::task::spawn_blocking(move || {
buf.flush().unwrap();
buf
})
.await
.unwrap();
}
}
}
}
info!("Aggregator Broadcast Channel Closed");
// Summary at the end.
match output_format {
+1 -1
View File
@@ -104,7 +104,7 @@ where
};
debug!(%tx_hash, "Submitted Transaction");
pending_transaction.set_timeout(Some(Duration::from_secs(120)));
pending_transaction.set_timeout(Some(Duration::from_secs(240)));
let tx_hash = pending_transaction.watch().await.context(format!(
"Transaction inclusion watching timeout for {tx_hash}"
))?;
+2 -2
View File
@@ -41,7 +41,7 @@ pub struct ReportAggregator {
impl ReportAggregator {
pub fn new(context: Context) -> Self {
let (runner_tx, runner_rx) = unbounded_channel::<RunnerEvent>();
let (listener_tx, _) = channel::<ReporterEvent>(1024);
let (listener_tx, _) = channel::<ReporterEvent>(0xFFFF);
Self {
report: Report::new(context),
remaining_cases: Default::default(),
@@ -64,7 +64,7 @@ impl ReportAggregator {
debug!("Starting to aggregate report");
while let Some(event) = self.runner_rx.recv().await {
debug!(?event, "Received Event");
debug!(event = event.variant_name(), "Received Event");
match event {
RunnerEvent::SubscribeToEvents(event) => {
self.handle_subscribe_to_events_event(*event);
+10
View File
@@ -347,6 +347,16 @@ macro_rules! define_event {
),*
}
impl $ident {
pub fn variant_name(&self) -> &'static str {
match self {
$(
Self::$variant_ident { .. } => stringify!($variant_ident)
),*
}
}
}
$(
#[derive(Debug)]
$(#[$variant_meta])*