Update tests stream func

This commit is contained in:
Omar Abdulla
2025-08-28 16:44:09 +03:00
parent 31f69de3cb
commit 453fcca4d6
2 changed files with 10 additions and 25 deletions
+8 -7
View File
@@ -255,26 +255,28 @@ where
} }
stream::iter(tests.into_iter()) stream::iter(tests.into_iter())
.map(Ok::<_, anyhow::Error>) .filter_map(
.try_filter_map(
move |(metadata_file, case_idx, case, mode, reporter)| async move { move |(metadata_file, case_idx, case, mode, reporter)| async move {
let leader_compiler = <L::Compiler as SolidityCompiler>::new( let leader_compiler = <L::Compiler as SolidityCompiler>::new(
args, args,
mode.version.clone().map(Into::into), mode.version.clone().map(Into::into),
) )
.await .await
.inspect_err(|err| error!(?err, "Failed to instantiate the leader compiler"))?; .inspect_err(|err| error!(?err, "Failed to instantiate the leader compiler"))
.ok()?;
let follower_compiler = <F::Compiler as SolidityCompiler>::new( let follower_compiler = <F::Compiler as SolidityCompiler>::new(
args, args,
mode.version.clone().map(Into::into), mode.version.clone().map(Into::into),
) )
.await .await
.inspect_err(|err| error!(?err, "Failed to instantiate the follower compiler"))?; .inspect_err(|err| error!(?err, "Failed to instantiate the follower compiler"))
.ok()?;
let leader_node = leader_node_pool.round_robbin(); let leader_node = leader_node_pool.round_robbin();
let follower_node = follower_node_pool.round_robbin(); let follower_node = follower_node_pool.round_robbin();
Ok(Some(Test::<L, F> { Some(Test::<L, F> {
metadata: metadata_file, metadata: metadata_file,
metadata_file_path: metadata_file.metadata_file_path.as_path(), metadata_file_path: metadata_file.metadata_file_path.as_path(),
mode: mode.clone(), mode: mode.clone(),
@@ -285,10 +287,9 @@ where
leader_compiler, leader_compiler,
follower_compiler, follower_compiler,
reporter, reporter,
})) })
}, },
) )
.filter_map(|result| async move { result.ok() })
.filter_map(move |test| async move { .filter_map(move |test| async move {
match test.check_compatibility() { match test.check_compatibility() {
Ok(()) => Some(test), Ok(()) => Some(test),
+2 -18
View File
@@ -340,21 +340,13 @@ impl ReportAggregator {
&mut self, &mut self,
event: PreLinkContractsCompilationFailedEvent, event: PreLinkContractsCompilationFailedEvent,
) { ) {
let include_input = self.report.config.report_include_compiler_input;
let execution_information = self.execution_information(&event.execution_specifier); let execution_information = self.execution_information(&event.execution_specifier);
let compiler_input = if include_input {
event.compiler_input
} else {
None
};
execution_information.pre_link_compilation_status = Some(CompilationStatus::Failure { execution_information.pre_link_compilation_status = Some(CompilationStatus::Failure {
reason: event.reason, reason: event.reason,
compiler_version: event.compiler_version, compiler_version: event.compiler_version,
compiler_path: event.compiler_path, compiler_path: event.compiler_path,
compiler_input, compiler_input: event.compiler_input,
}); });
} }
@@ -362,21 +354,13 @@ impl ReportAggregator {
&mut self, &mut self,
event: PostLinkContractsCompilationFailedEvent, event: PostLinkContractsCompilationFailedEvent,
) { ) {
let include_input = self.report.config.report_include_compiler_input;
let execution_information = self.execution_information(&event.execution_specifier); let execution_information = self.execution_information(&event.execution_specifier);
let compiler_input = if include_input {
event.compiler_input
} else {
None
};
execution_information.post_link_compilation_status = Some(CompilationStatus::Failure { execution_information.post_link_compilation_status = Some(CompilationStatus::Failure {
reason: event.reason, reason: event.reason,
compiler_version: event.compiler_version, compiler_version: event.compiler_version,
compiler_path: event.compiler_path, compiler_path: event.compiler_path,
compiler_input, compiler_input: event.compiler_input,
}); });
} }