mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-11 00:21:02 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87dd5edeb1 | |||
| 996a64d500 | |||
| 2ce575bf72 | |||
| 659263b8c5 | |||
| e2d626d45b | |||
| 1231a9b6c5 | |||
| 73ee78a01e |
@@ -29,10 +29,6 @@ inputs:
|
|||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
# Test Execution Arguments
|
# Test Execution Arguments
|
||||||
# TODO: We need a better way for people to pass arguments to retester. This way is not very good
|
|
||||||
# because we need to add support for each argument separately and support defaults and all of that
|
|
||||||
# perhaps having people pass in a JSON String of the arguments is the better long term solution
|
|
||||||
# for this.
|
|
||||||
platform:
|
platform:
|
||||||
description: "The identifier of the platform to run the tests on (e.g., geth-evm-solc, revive-dev-node-revm-solc)"
|
description: "The identifier of the platform to run the tests on (e.g., geth-evm-solc, revive-dev-node-revm-solc)"
|
||||||
required: true
|
required: true
|
||||||
@@ -125,12 +121,10 @@ runs:
|
|||||||
--eth-rpc.path ${{ inputs['polkadot-sdk-path'] }}/target/release/eth-rpc \
|
--eth-rpc.path ${{ inputs['polkadot-sdk-path'] }}/target/release/eth-rpc \
|
||||||
--polkadot-omni-node.path ${{ inputs['polkadot-sdk-path'] }}/target/release/polkadot-omni-node \
|
--polkadot-omni-node.path ${{ inputs['polkadot-sdk-path'] }}/target/release/polkadot-omni-node \
|
||||||
--resolc.path ./resolc \
|
--resolc.path ./resolc \
|
||||||
--resolc.heap-size 128000 \
|
|
||||||
--resolc.stack-size 128000 \
|
|
||||||
"${OMNI_ARGS[@]}" || true
|
"${OMNI_ARGS[@]}" || true
|
||||||
- name: Generate the expectation file
|
- name: Generate the expectation file
|
||||||
shell: bash
|
shell: bash
|
||||||
run: report-processor generate-expectations-file --report-path ./workdir/report.json --output-path ./workdir/expectations.json --remove-prefix ./revive-differential-tests/resolc-compiler-tests --include-status failed
|
run: report-processor generate-expectations-file --report-path ./workdir/report.json --output-path ./workdir/expectations.json --remove-prefix ./revive-differential-tests/resolc-compiler-tests
|
||||||
- name: Upload the Report to the CI
|
- name: Upload the Report to the CI
|
||||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||||
with:
|
with:
|
||||||
|
|||||||
Generated
+1073
-1062
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -74,9 +74,9 @@ indexmap = { version = "2.10.0", default-features = false }
|
|||||||
itertools = { version = "0.14.0" }
|
itertools = { version = "0.14.0" }
|
||||||
|
|
||||||
# revive compiler
|
# revive compiler
|
||||||
revive-solc-json-interface = { version = "0.5.0" }
|
revive-solc-json-interface = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||||
revive-common = { version = "0.3.0" }
|
revive-common = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||||
revive-differential = { version = "0.3.0" }
|
revive-differential = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||||
|
|
||||||
zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev = "891f6554354ce466abd496366dbf8b4f82141241" }
|
zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev = "891f6554354ce466abd496366dbf8b4f82141241" }
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,9 @@ use dashmap::DashMap;
|
|||||||
use revive_dt_common::types::VersionOrRequirement;
|
use revive_dt_common::types::VersionOrRequirement;
|
||||||
use revive_dt_config::{ResolcConfiguration, SolcConfiguration, WorkingDirectoryConfiguration};
|
use revive_dt_config::{ResolcConfiguration, SolcConfiguration, WorkingDirectoryConfiguration};
|
||||||
use revive_solc_json_interface::{
|
use revive_solc_json_interface::{
|
||||||
PolkaVMDefaultHeapMemorySize, PolkaVMDefaultStackMemorySize, SolcStandardJsonInput,
|
SolcStandardJsonInput, SolcStandardJsonInputLanguage, SolcStandardJsonInputSettings,
|
||||||
SolcStandardJsonInputLanguage, SolcStandardJsonInputSettings,
|
SolcStandardJsonInputSettingsOptimizer, SolcStandardJsonInputSettingsSelection,
|
||||||
SolcStandardJsonInputSettingsLibraries, SolcStandardJsonInputSettingsMetadata,
|
SolcStandardJsonOutput,
|
||||||
SolcStandardJsonInputSettingsOptimizer, SolcStandardJsonInputSettingsPolkaVM,
|
|
||||||
SolcStandardJsonInputSettingsPolkaVMMemory, SolcStandardJsonInputSettingsSelection,
|
|
||||||
SolcStandardJsonOutput, standard_json::input::settings::optimizer::Optimizer,
|
|
||||||
standard_json::input::settings::optimizer::details::Details,
|
|
||||||
};
|
};
|
||||||
use tracing::{Span, field::display};
|
use tracing::{Span, field::display};
|
||||||
|
|
||||||
@@ -29,7 +25,6 @@ use crate::{
|
|||||||
use alloy::json_abi::JsonAbi;
|
use alloy::json_abi::JsonAbi;
|
||||||
use anyhow::{Context as _, Result};
|
use anyhow::{Context as _, Result};
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use std::collections::BTreeSet;
|
|
||||||
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
||||||
|
|
||||||
/// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode.
|
/// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode.
|
||||||
@@ -42,10 +37,6 @@ struct ResolcInner {
|
|||||||
solc: Solc,
|
solc: Solc,
|
||||||
/// Path to the `resolc` executable
|
/// Path to the `resolc` executable
|
||||||
resolc_path: PathBuf,
|
resolc_path: PathBuf,
|
||||||
/// The PVM heap size in bytes.
|
|
||||||
pvm_heap_size: u32,
|
|
||||||
/// The PVM stack size in bytes.
|
|
||||||
pvm_stack_size: u32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Resolc {
|
impl Resolc {
|
||||||
@@ -72,35 +63,10 @@ impl Resolc {
|
|||||||
Self(Arc::new(ResolcInner {
|
Self(Arc::new(ResolcInner {
|
||||||
solc,
|
solc,
|
||||||
resolc_path: resolc_configuration.path.clone(),
|
resolc_path: resolc_configuration.path.clone(),
|
||||||
pvm_heap_size: resolc_configuration
|
|
||||||
.heap_size
|
|
||||||
.unwrap_or(PolkaVMDefaultHeapMemorySize),
|
|
||||||
pvm_stack_size: resolc_configuration
|
|
||||||
.stack_size
|
|
||||||
.unwrap_or(PolkaVMDefaultStackMemorySize),
|
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.clone())
|
.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkavm_settings(&self) -> SolcStandardJsonInputSettingsPolkaVM {
|
|
||||||
SolcStandardJsonInputSettingsPolkaVM::new(
|
|
||||||
Some(SolcStandardJsonInputSettingsPolkaVMMemory::new(
|
|
||||||
Some(self.0.pvm_heap_size),
|
|
||||||
Some(self.0.pvm_stack_size),
|
|
||||||
)),
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn inject_polkavm_settings(&self, input: &SolcStandardJsonInput) -> Result<serde_json::Value> {
|
|
||||||
let mut input_value = serde_json::to_value(input)
|
|
||||||
.context("Failed to serialize Standard JSON input for resolc")?;
|
|
||||||
if let Some(settings) = input_value.get_mut("settings") {
|
|
||||||
settings["polkavm"] = serde_json::to_value(self.polkavm_settings()).unwrap();
|
|
||||||
}
|
|
||||||
Ok(input_value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SolidityCompiler for Resolc {
|
impl SolidityCompiler for Resolc {
|
||||||
@@ -155,8 +121,8 @@ impl SolidityCompiler for Resolc {
|
|||||||
.collect(),
|
.collect(),
|
||||||
settings: SolcStandardJsonInputSettings {
|
settings: SolcStandardJsonInputSettings {
|
||||||
evm_version,
|
evm_version,
|
||||||
libraries: SolcStandardJsonInputSettingsLibraries {
|
libraries: Some(
|
||||||
inner: libraries
|
libraries
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(source_code, libraries_map)| {
|
.map(|(source_code, libraries_map)| {
|
||||||
(
|
(
|
||||||
@@ -170,29 +136,23 @@ impl SolidityCompiler for Resolc {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
},
|
),
|
||||||
remappings: BTreeSet::<String>::new(),
|
remappings: None,
|
||||||
output_selection: SolcStandardJsonInputSettingsSelection::new_required(),
|
output_selection: Some(SolcStandardJsonInputSettingsSelection::new_required()),
|
||||||
via_ir: Some(true),
|
via_ir: Some(true),
|
||||||
optimizer: SolcStandardJsonInputSettingsOptimizer::new(
|
optimizer: SolcStandardJsonInputSettingsOptimizer::new(
|
||||||
optimization
|
optimization
|
||||||
.unwrap_or(ModeOptimizerSetting::M0)
|
.unwrap_or(ModeOptimizerSetting::M0)
|
||||||
.optimizations_enabled(),
|
.optimizations_enabled(),
|
||||||
Optimizer::default_mode(),
|
None,
|
||||||
Details::disabled(&Version::new(0, 0, 0)),
|
&Version::new(0, 0, 0),
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
polkavm: self.polkavm_settings(),
|
metadata: None,
|
||||||
metadata: SolcStandardJsonInputSettingsMetadata::default(),
|
polkavm: None,
|
||||||
detect_missing_libraries: false,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// Manually inject polkavm settings since it's marked skip_serializing in the upstream crate
|
Span::current().record("json_in", display(serde_json::to_string(&input).unwrap()));
|
||||||
let std_input_json = self.inject_polkavm_settings(&input)?;
|
|
||||||
|
|
||||||
Span::current().record(
|
|
||||||
"json_in",
|
|
||||||
display(serde_json::to_string(&std_input_json).unwrap()),
|
|
||||||
);
|
|
||||||
|
|
||||||
let path = &self.0.resolc_path;
|
let path = &self.0.resolc_path;
|
||||||
let mut command = AsyncCommand::new(path);
|
let mut command = AsyncCommand::new(path);
|
||||||
@@ -221,9 +181,8 @@ impl SolidityCompiler for Resolc {
|
|||||||
.with_context(|| format!("Failed to spawn resolc at {}", path.display()))?;
|
.with_context(|| format!("Failed to spawn resolc at {}", path.display()))?;
|
||||||
|
|
||||||
let stdin_pipe = child.stdin.as_mut().expect("stdin must be piped");
|
let stdin_pipe = child.stdin.as_mut().expect("stdin must be piped");
|
||||||
let serialized_input = serde_json::to_vec(&std_input_json)
|
let serialized_input = serde_json::to_vec(&input)
|
||||||
.context("Failed to serialize Standard JSON input for resolc")?;
|
.context("Failed to serialize Standard JSON input for resolc")?;
|
||||||
|
|
||||||
stdin_pipe
|
stdin_pipe
|
||||||
.write_all(&serialized_input)
|
.write_all(&serialized_input)
|
||||||
.await
|
.await
|
||||||
@@ -269,7 +228,7 @@ impl SolidityCompiler for Resolc {
|
|||||||
|
|
||||||
// Detecting if the compiler output contained errors and reporting them through logs and
|
// Detecting if the compiler output contained errors and reporting them through logs and
|
||||||
// errors instead of returning the compiler output that might contain errors.
|
// errors instead of returning the compiler output that might contain errors.
|
||||||
for error in parsed.errors.iter() {
|
for error in parsed.errors.iter().flatten() {
|
||||||
if error.severity == "error" {
|
if error.severity == "error" {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
?error,
|
?error,
|
||||||
@@ -281,12 +240,12 @@ impl SolidityCompiler for Resolc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if parsed.contracts.is_empty() {
|
let Some(contracts) = parsed.contracts else {
|
||||||
anyhow::bail!("Unexpected error - resolc output doesn't have a contracts section");
|
anyhow::bail!("Unexpected error - resolc output doesn't have a contracts section");
|
||||||
}
|
};
|
||||||
|
|
||||||
let mut compiler_output = CompilerOutput::default();
|
let mut compiler_output = CompilerOutput::default();
|
||||||
for (source_path, contracts) in parsed.contracts.into_iter() {
|
for (source_path, contracts) in contracts.into_iter() {
|
||||||
let src_for_msg = source_path.clone();
|
let src_for_msg = source_path.clone();
|
||||||
let source_path = PathBuf::from(source_path)
|
let source_path = PathBuf::from(source_path)
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
@@ -294,22 +253,15 @@ impl SolidityCompiler for Resolc {
|
|||||||
|
|
||||||
let map = compiler_output.contracts.entry(source_path).or_default();
|
let map = compiler_output.contracts.entry(source_path).or_default();
|
||||||
for (contract_name, contract_information) in contracts.into_iter() {
|
for (contract_name, contract_information) in contracts.into_iter() {
|
||||||
let Some(bytecode) = contract_information
|
let bytecode = contract_information
|
||||||
.evm
|
.evm
|
||||||
.and_then(|evm| evm.bytecode.clone())
|
.and_then(|evm| evm.bytecode.clone())
|
||||||
else {
|
.context("Unexpected - Contract compiled with resolc has no bytecode")?;
|
||||||
tracing::debug!(
|
|
||||||
"Skipping abstract or interface contract {} - no bytecode",
|
|
||||||
contract_name
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let abi = {
|
let abi = {
|
||||||
let metadata = &contract_information.metadata;
|
let metadata = contract_information
|
||||||
if metadata.is_null() {
|
.metadata
|
||||||
anyhow::bail!("No metadata found for the contract");
|
.as_ref()
|
||||||
}
|
.context("No metadata found for the contract")?;
|
||||||
|
|
||||||
let solc_metadata_str = match metadata {
|
let solc_metadata_str = match metadata {
|
||||||
serde_json::Value::String(solc_metadata_str) => {
|
serde_json::Value::String(solc_metadata_str) => {
|
||||||
solc_metadata_str.as_str()
|
solc_metadata_str.as_str()
|
||||||
|
|||||||
@@ -800,18 +800,6 @@ pub struct ResolcConfiguration {
|
|||||||
/// provided in the user's $PATH.
|
/// provided in the user's $PATH.
|
||||||
#[clap(id = "resolc.path", long = "resolc.path", default_value = "resolc")]
|
#[clap(id = "resolc.path", long = "resolc.path", default_value = "resolc")]
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
|
|
||||||
/// Specifies the PVM heap size in bytes.
|
|
||||||
///
|
|
||||||
/// If unspecified, the revive compiler default is used
|
|
||||||
#[clap(id = "resolc.heap-size", long = "resolc.heap-size")]
|
|
||||||
pub heap_size: Option<u32>,
|
|
||||||
|
|
||||||
/// Specifies the PVM stack size in bytes.
|
|
||||||
///
|
|
||||||
/// If unspecified, the revive compiler default is used
|
|
||||||
#[clap(id = "resolc.stack-size", long = "resolc.stack-size")]
|
|
||||||
pub stack_size: Option<u32>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of configuration parameters for Polkadot Parachain.
|
/// A set of configuration parameters for Polkadot Parachain.
|
||||||
|
|||||||
@@ -223,24 +223,17 @@ impl<'a> TestDefinition<'a> {
|
|||||||
|
|
||||||
/// Checks if the platforms all support the desired targets in the metadata file.
|
/// Checks if the platforms all support the desired targets in the metadata file.
|
||||||
fn check_target_compatibility(&self) -> TestCheckFunctionResult {
|
fn check_target_compatibility(&self) -> TestCheckFunctionResult {
|
||||||
// The case targets takes presence over the metadata targets.
|
|
||||||
let Some(targets) = self
|
|
||||||
.case
|
|
||||||
.targets
|
|
||||||
.as_ref()
|
|
||||||
.or(self.metadata.targets.as_ref())
|
|
||||||
else {
|
|
||||||
return Ok(());
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut error_map = indexmap! {
|
let mut error_map = indexmap! {
|
||||||
"test_desired_targets" => json!(targets),
|
"test_desired_targets" => json!(self.metadata.targets.as_ref()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut is_allowed = true;
|
let mut is_allowed = true;
|
||||||
for (_, platform_information) in self.platforms.iter() {
|
for (_, platform_information) in self.platforms.iter() {
|
||||||
let is_allowed_for_platform =
|
let is_allowed_for_platform = match self.metadata.targets.as_ref() {
|
||||||
targets.contains(&platform_information.platform.vm_identifier());
|
None => true,
|
||||||
|
Some(required_vm_identifiers) => {
|
||||||
|
required_vm_identifiers.contains(&platform_information.platform.vm_identifier())
|
||||||
|
}
|
||||||
|
};
|
||||||
is_allowed &= is_allowed_for_platform;
|
is_allowed &= is_allowed_for_platform;
|
||||||
error_map.insert(
|
error_map.insert(
|
||||||
platform_information.platform.platform_identifier().into(),
|
platform_information.platform.platform_identifier().into(),
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
use alloy::primitives::{Address, map::HashSet};
|
use alloy::primitives::Address;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use revive_dt_common::{
|
use revive_dt_common::{
|
||||||
macros::define_wrapper_type,
|
macros::define_wrapper_type,
|
||||||
types::{Mode, ParsedMode, VmIdentifier},
|
types::{Mode, ParsedMode},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::steps::*;
|
use crate::steps::*;
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, Clone, Eq, PartialEq, JsonSchema)]
|
#[derive(Debug, Default, Serialize, Deserialize, Clone, Eq, PartialEq, JsonSchema)]
|
||||||
pub struct Case {
|
pub struct Case {
|
||||||
/// An optional vector of targets that this Metadata file's cases can be executed on. As an
|
|
||||||
/// example, if we wish for the metadata file's cases to only be run on PolkaVM then we'd
|
|
||||||
/// specify a target of "PolkaVM" in here.
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub targets: Option<HashSet<VmIdentifier>>,
|
|
||||||
|
|
||||||
/// An optional name of the test case.
|
/// An optional name of the test case.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use std::{
|
|||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use alloy::primitives::map::HashSet;
|
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@@ -84,7 +83,7 @@ pub struct Metadata {
|
|||||||
/// example, if we wish for the metadata file's cases to only be run on PolkaVM then we'd
|
/// example, if we wish for the metadata file's cases to only be run on PolkaVM then we'd
|
||||||
/// specify a target of "PolkaVM" in here.
|
/// specify a target of "PolkaVM" in here.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub targets: Option<HashSet<VmIdentifier>>,
|
pub targets: Option<Vec<VmIdentifier>>,
|
||||||
|
|
||||||
/// A vector of the test cases and workloads contained within the metadata file. This is their
|
/// A vector of the test cases and workloads contained within the metadata file. This is their
|
||||||
/// primary description.
|
/// primary description.
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ revive-dt-common = { workspace = true }
|
|||||||
|
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
clap = { workspace = true }
|
clap = { workspace = true }
|
||||||
strum = { workspace = true }
|
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::{BTreeMap, BTreeSet, HashSet},
|
collections::{BTreeMap, BTreeSet},
|
||||||
fmt::Display,
|
fmt::Display,
|
||||||
fs::{File, OpenOptions},
|
fs::{File, OpenOptions},
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
@@ -9,12 +9,11 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{Context as _, Error, Result, bail};
|
use anyhow::{Context as _, Error, Result, bail};
|
||||||
use clap::{Parser, ValueEnum};
|
use clap::Parser;
|
||||||
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||||
|
|
||||||
use revive_dt_common::types::{Mode, ParsedTestSpecifier};
|
use revive_dt_common::types::{Mode, ParsedTestSpecifier};
|
||||||
use revive_dt_report::{Report, TestCaseStatus};
|
use revive_dt_report::{Report, TestCaseStatus};
|
||||||
use strum::EnumString;
|
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let cli = Cli::try_parse().context("Failed to parse the CLI arguments")?;
|
let cli = Cli::try_parse().context("Failed to parse the CLI arguments")?;
|
||||||
@@ -24,14 +23,11 @@ fn main() -> Result<()> {
|
|||||||
report_path,
|
report_path,
|
||||||
output_path: output_file,
|
output_path: output_file,
|
||||||
remove_prefix,
|
remove_prefix,
|
||||||
include_status,
|
|
||||||
} => {
|
} => {
|
||||||
let remove_prefix = remove_prefix
|
let remove_prefix = remove_prefix
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|path| path.canonicalize().context("Failed to canonicalize path"))
|
.map(|path| path.canonicalize().context("Failed to canonicalize path"))
|
||||||
.collect::<Result<Vec<_>>>()?;
|
.collect::<Result<Vec<_>>>()?;
|
||||||
let include_status =
|
|
||||||
include_status.map(|value| value.into_iter().collect::<HashSet<_>>());
|
|
||||||
|
|
||||||
let expectations = report_path
|
let expectations = report_path
|
||||||
.execution_information
|
.execution_information
|
||||||
@@ -77,12 +73,6 @@ fn main() -> Result<()> {
|
|||||||
Status::from(status),
|
Status::from(status),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.filter(|(_, status)| {
|
|
||||||
include_status
|
|
||||||
.as_ref()
|
|
||||||
.map(|allowed_status| allowed_status.contains(status))
|
|
||||||
.unwrap_or(true)
|
|
||||||
})
|
|
||||||
.collect::<Expectations>();
|
.collect::<Expectations>();
|
||||||
|
|
||||||
let output_file = OpenOptions::new()
|
let output_file = OpenOptions::new()
|
||||||
@@ -152,11 +142,6 @@ pub enum Cli {
|
|||||||
/// Prefix paths to remove from the paths in the final expectations file.
|
/// Prefix paths to remove from the paths in the final expectations file.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
remove_prefix: Vec<PathBuf>,
|
remove_prefix: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Controls which test case statuses are included in the generated expectations file. If
|
|
||||||
/// nothing is specified then it will include all of the test case status.
|
|
||||||
#[clap(long)]
|
|
||||||
include_status: Option<Vec<Status>>,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Compares two expectation files to ensure that they match each other.
|
/// Compares two expectation files to ensure that they match each other.
|
||||||
@@ -171,21 +156,7 @@ pub enum Cli {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||||
Clone,
|
|
||||||
Copy,
|
|
||||||
Debug,
|
|
||||||
PartialEq,
|
|
||||||
Eq,
|
|
||||||
PartialOrd,
|
|
||||||
Ord,
|
|
||||||
Hash,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
ValueEnum,
|
|
||||||
EnumString,
|
|
||||||
)]
|
|
||||||
#[strum(serialize_all = "kebab-case")]
|
|
||||||
pub enum Status {
|
pub enum Status {
|
||||||
Succeeded,
|
Succeeded,
|
||||||
Failed,
|
Failed,
|
||||||
|
|||||||
+1
-1
Submodule resolc-compiler-tests updated: d5185923e0...55da34c4f6
Reference in New Issue
Block a user