mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-13 23:21:04 +00:00
Update the report processor
This commit is contained in:
@@ -21,7 +21,7 @@ inputs:
|
|||||||
resolc-version:
|
resolc-version:
|
||||||
description: "The version of resolc to install and use in tests."
|
description: "The version of resolc to install and use in tests."
|
||||||
required: false
|
required: false
|
||||||
default: "0.6.0"
|
default: "0.5.0"
|
||||||
type: string
|
type: string
|
||||||
use-compilation-caches:
|
use-compilation-caches:
|
||||||
description: "Controls if the compilation caches will be used for the test run or not."
|
description: "Controls if the compilation caches will be used for the test run or not."
|
||||||
@@ -130,7 +130,7 @@ runs:
|
|||||||
"${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
|
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
|
||||||
- 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
+1
@@ -5886,6 +5886,7 @@ dependencies = [
|
|||||||
"revive-dt-report",
|
"revive-dt-report",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"strum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ 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},
|
collections::{BTreeMap, BTreeSet, HashSet},
|
||||||
fmt::Display,
|
fmt::Display,
|
||||||
fs::{File, OpenOptions},
|
fs::{File, OpenOptions},
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
@@ -9,11 +9,12 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{Context as _, Error, Result, bail};
|
use anyhow::{Context as _, Error, Result, bail};
|
||||||
use clap::Parser;
|
use clap::{Parser, ValueEnum};
|
||||||
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")?;
|
||||||
@@ -23,11 +24,14 @@ 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
|
||||||
@@ -73,7 +77,12 @@ fn main() -> Result<()> {
|
|||||||
Status::from(status),
|
Status::from(status),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.filter(|(_, status)| *status == Status::Failed)
|
.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()
|
||||||
@@ -143,6 +152,11 @@ 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.
|
||||||
@@ -157,7 +171,21 @@ pub enum Cli {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
#[derive(
|
||||||
|
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user