Wire up the cleaned up driver implementation

This commit is contained in:
Omar Abdulla committed 2025-09-30 13:39:25 +03:00
1 parent c3c7203af8
commit 8762702560
12 files changed
+450 -827

No files matched your search

+22 -4
View File
@@ -5,7 +5,7 @@ use std::{
borrow::Cow,
collections::HashMap,
path::{Path, PathBuf},
sync::Arc,
sync::{Arc, LazyLock},
};
use futures::FutureExt;
@@ -19,7 +19,7 @@ use anyhow::{Context as _, Error, Result};
use revive_dt_report::ExecutionSpecificReporter;
use semver::Version;
use serde::{Deserialize, Serialize};
use tokio::sync::{Mutex, RwLock};
use tokio::sync::{Mutex, RwLock, Semaphore};
use tracing::{Instrument, debug, debug_span, instrument};
pub struct CachedCompiler<'a> {
@@ -165,10 +165,22 @@ impl<'a> CachedCompiler<'a> {
cache_value.compiler_output
}
None => {
compilation_callback()
let compiler_output = compilation_callback()
.await
.context("Compilation callback failed (cache miss path)")?
.compiler_output
.compiler_output;
self.artifacts_cache
.insert(
&cache_key,
&CacheValue {
compiler_output: compiler_output.clone(),
},
)
.await
.context(
"Failed to write the cached value of the compilation artifacts",
)?;
compiler_output
}
}
}
@@ -186,6 +198,12 @@ async fn compile_contracts(
compiler: &dyn SolidityCompiler,
reporter: &ExecutionSpecificReporter,
) -> Result<CompilerOutput> {
// Puts a limit on how many compilations we can perform at any given instance which helps us
// with some of the errors we've been seeing with high concurrency on MacOS (we have not tried
// it on Linux so we don't know if these issues also persist there or not.)
static SPAWN_GATE: LazyLock<Semaphore> = LazyLock::new(|| Semaphore::new(100));
let _permit = SPAWN_GATE.acquire().await?;
let all_sources_in_dir = FilesWithExtensionIterator::new(metadata_directory.as_ref())
.with_allowed_extension("sol")
.with_use_cached_fs(true)
+12 -11
View File
@@ -19,12 +19,12 @@ use revive_dt_format::{
use revive_dt_node_interaction::EthereumNode;
use revive_dt_report::{ExecutionSpecificReporter, Reporter};
use revive_dt_report::{TestSpecificReporter, TestSpecifier};
use tracing::{debug, error};
use tracing::{debug, error, info};
use crate::Platform;
use crate::helpers::NodePool;
async fn create_test_definitions_stream<'a>(
pub async fn create_test_definitions_stream<'a>(
// This is only required for creating the compiler objects and is not used anywhere else in the
// function.
context: &Context,
@@ -165,6 +165,14 @@ async fn create_test_definitions_stream<'a>(
}
}
})
.inspect(|test| {
info!(
metadata_file_path = %test.metadata_file_path.display(),
case_idx = %test.case_idx,
mode = %test.mode,
"Created a test case definition"
);
})
}
/// This is a full description of a differential test to run alongside the full metadata file, the
@@ -228,15 +236,8 @@ impl<'a> TestDefinition<'a> {
for (_, platform_information) in self.platforms.iter() {
let is_allowed_for_platform = match self.metadata.targets.as_ref() {
None => true,
Some(targets) => {
let mut target_matches = false;
for target in targets.iter() {
if &platform_information.platform.vm_identifier() == target {
target_matches = true;
break;
}
}
target_matches
Some(required_vm_identifiers) => {
required_vm_identifiers.contains(&platform_information.platform.vm_identifier())
}
};
is_allowed &= is_allowed_for_platform;