Skip to content

Commit 189c255

Browse files
feat(process_reports): allow spec. of zero reports
This allows us to perform tainting without having to have reports on hand.
1 parent 1a3841f commit 189c255

1 file changed

Lines changed: 26 additions & 15 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ struct Cli {
5656

5757
#[derive(Debug, Parser)]
5858
enum Subcommand {
59-
/// Adjust test expectations in metadata using `wptreport.json` reports from CI runs covering
60-
/// Firefox's implementation of WebGPU.
59+
/// Adjust test expectations in metadata, optionally using `wptreport.json` reports from CI
60+
/// runs covering Firefox's implementation of WebGPU.
6161
///
6262
/// As Firefox's behavior changes, one generally expects CTS test outcomes to change. When you
6363
/// are testing your own changes in CI, you can use this subcommand to update expectations
@@ -84,8 +84,7 @@ enum Subcommand {
8484
/// forward slashes (`/`) are the only valid path separator for these globs.
8585
#[clap(long = "glob", value_name = "REPORT_GLOB")]
8686
report_globs: Vec<String>,
87-
/// The heuristic for resolving differences between current metadata and processed reports
88-
/// for this report processing run.
87+
/// The heuristic for resolving differences between current metadata and processed reports.
8988
#[clap(long)]
9089
preset: ReportProcessingPreset,
9190
},
@@ -227,12 +226,7 @@ fn run(cli: Cli) -> ExitCode {
227226
globs
228227
};
229228

230-
if report_paths.is_empty() && report_globs.is_empty() {
231-
log::error!("no report paths specified, bailing");
232-
return ExitCode::FAILURE;
233-
}
234-
235-
let exec_report_paths = {
229+
let report_paths_from_glob = {
236230
let mut found_glob_walk_err = false;
237231
let files = report_globs
238232
.iter()
@@ -258,7 +252,6 @@ fn run(cli: Cli) -> ExitCode {
258252
})
259253
.collect::<Vec<_>>() // OPT: Can we get rid of this somehow?
260254
})
261-
.chain(report_paths)
262255
.collect::<Vec<_>>();
263256

264257
if found_glob_walk_err {
@@ -272,11 +265,27 @@ fn run(cli: Cli) -> ExitCode {
272265
files
273266
};
274267

275-
if exec_report_paths.is_empty() {
276-
log::error!("no WPT report files found, bailing");
277-
return ExitCode::FAILURE;
268+
if report_paths_from_glob.is_empty() && !report_globs.is_empty() {
269+
if report_paths.is_empty() {
270+
log::error!(concat!(
271+
"reports were specified exclusively via glob search, ",
272+
"but none were found; bailing"
273+
));
274+
return ExitCode::FAILURE;
275+
} else {
276+
log::warn!(concat!(
277+
"report were specified via path and glob search, ",
278+
"but none were found via glob; ",
279+
"continuing with report paths"
280+
))
281+
}
278282
}
279283

284+
let exec_report_paths = report_paths
285+
.into_iter()
286+
.chain(report_paths_from_glob)
287+
.collect::<Vec<_>>();
288+
280289
log::trace!("working with the following WPT report files: {exec_report_paths:#?}");
281290
log::info!("working with {} WPT report files", exec_report_paths.len());
282291

@@ -419,6 +428,8 @@ fn run(cli: Cli) -> ExitCode {
419428

420429
log::info!("gathering reported test outcomes for reconciliation with metadata…");
421430

431+
let using_reports = !exec_report_paths.is_empty();
432+
422433
let (exec_reports_sender, exec_reports_receiver) = channel();
423434
exec_report_paths
424435
.into_par_iter()
@@ -663,7 +674,7 @@ fn run(cli: Cli) -> ExitCode {
663674
log::info!("new test entry: {test_path:?}")
664675
}
665676

666-
if test_entry.reported.is_empty() {
677+
if test_entry.reported.is_empty() && using_reports {
667678
let test_path = &test_path;
668679
let msg = lazy_format!("no entries found in reports for {:?}", test_path);
669680
match preset {

0 commit comments

Comments
 (0)