Skip to content

Commit be448d7

Browse files
committed
Update the report processor
1 parent 523557b commit be448d7

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

.github/actions/run-differential-tests/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
resolc-version:
2222
description: "The version of resolc to install and use in tests."
2323
required: false
24-
default: "0.6.0"
24+
default: "0.5.0"
2525
type: string
2626
use-compilation-caches:
2727
description: "Controls if the compilation caches will be used for the test run or not."
@@ -130,7 +130,7 @@ runs:
130130
"${OMNI_ARGS[@]}" || true
131131
- name: Generate the expectation file
132132
shell: bash
133-
run: report-processor generate-expectations-file --report-path ./workdir/report.json --output-path ./workdir/expectations.json --remove-prefix ./revive-differential-tests/resolc-compiler-tests
133+
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
134134
- name: Upload the Report to the CI
135135
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
136136
with:

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/report-processor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ revive-dt-common = { workspace = true }
1818

1919
anyhow = { workspace = true }
2020
clap = { workspace = true }
21+
strum = { workspace = true }
2122
serde = { workspace = true }
2223
serde_json = { workspace = true }
2324

crates/report-processor/src/main.rs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
borrow::Cow,
3-
collections::{BTreeMap, BTreeSet},
3+
collections::{BTreeMap, BTreeSet, HashSet},
44
fmt::Display,
55
fs::{File, OpenOptions},
66
ops::{Deref, DerefMut},
@@ -9,11 +9,12 @@ use std::{
99
};
1010

1111
use anyhow::{Context as _, Error, Result, bail};
12-
use clap::Parser;
12+
use clap::{Parser, ValueEnum};
1313
use serde::{Deserialize, Serialize, de::DeserializeOwned};
1414

1515
use revive_dt_common::types::{Mode, ParsedTestSpecifier};
1616
use revive_dt_report::{Report, TestCaseStatus};
17+
use strum::EnumString;
1718

1819
fn main() -> Result<()> {
1920
let cli = Cli::try_parse().context("Failed to parse the CLI arguments")?;
@@ -23,11 +24,14 @@ fn main() -> Result<()> {
2324
report_path,
2425
output_path: output_file,
2526
remove_prefix,
27+
include_status,
2628
} => {
2729
let remove_prefix = remove_prefix
2830
.into_iter()
2931
.map(|path| path.canonicalize().context("Failed to canonicalize path"))
3032
.collect::<Result<Vec<_>>>()?;
33+
let include_status =
34+
include_status.map(|value| value.into_iter().collect::<HashSet<_>>());
3135

3236
let expectations = report_path
3337
.execution_information
@@ -73,7 +77,12 @@ fn main() -> Result<()> {
7377
Status::from(status),
7478
)
7579
})
76-
.filter(|(_, status)| *status == Status::Failed)
80+
.filter(|(_, status)| {
81+
include_status
82+
.as_ref()
83+
.map(|allowed_status| allowed_status.contains(status))
84+
.unwrap_or(true)
85+
})
7786
.collect::<Expectations>();
7887

7988
let output_file = OpenOptions::new()
@@ -143,6 +152,11 @@ pub enum Cli {
143152
/// Prefix paths to remove from the paths in the final expectations file.
144153
#[clap(long)]
145154
remove_prefix: Vec<PathBuf>,
155+
156+
/// Controls which test case statuses are included in the generated expectations file. If
157+
/// nothing is specified then it will include all of the test case status.
158+
#[clap(long)]
159+
include_status: Option<Vec<Status>>,
146160
},
147161

148162
/// Compares two expectation files to ensure that they match each other.
@@ -157,7 +171,21 @@ pub enum Cli {
157171
},
158172
}
159173

160-
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
174+
#[derive(
175+
Clone,
176+
Copy,
177+
Debug,
178+
PartialEq,
179+
Eq,
180+
PartialOrd,
181+
Ord,
182+
Hash,
183+
Serialize,
184+
Deserialize,
185+
ValueEnum,
186+
EnumString,
187+
)]
188+
#[strum(serialize_all = "kebab-case")]
161189
pub enum Status {
162190
Succeeded,
163191
Failed,

0 commit comments

Comments
 (0)