Skip to content

Commit 2498fa9

Browse files
feat(process_reports): add --on-skip-only
1 parent d5d97bf commit 2498fa9

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ enum Subcommand {
118118
/// `implementation-status`es that changes should be applied to.
119119
#[clap(value_enum, long, default_value = "backlog")]
120120
implementation_status: Vec<ImplementationStatus>,
121+
/// What do when only `SKIP` outcomes are found for tests and subtests.
122+
#[clap(value_enum, long, default_value_t = OnSkipOnly::Reconcile)]
123+
on_skip_only: OnSkipOnly,
121124
},
122125
/// Parse test metadata, apply automated fixups, and re-emit it in normalized form.
123126
#[clap(name = "fixup", alias = "fmt")]
@@ -283,6 +286,24 @@ impl From<UpdateExpectedPreset> for process_reports::ReportProcessingPreset {
283286
}
284287
}
285288

289+
/// See [`Subcommand::UpdateExpected::on_skip_only`].
290+
#[derive(Clone, Copy, Debug, ValueEnum)]
291+
pub(crate) enum OnSkipOnly {
292+
/// Use reconcilation from the provided `--preset` with `SKIP` outcomes.
293+
Reconcile,
294+
/// Do not change metadata.
295+
Ignore,
296+
}
297+
298+
impl From<OnSkipOnly> for process_reports::OnSkipOnly {
299+
fn from(value: OnSkipOnly) -> Self {
300+
match value {
301+
OnSkipOnly::Ignore => Self::Ignore,
302+
OnSkipOnly::Reconcile => Self::Reconcile,
303+
}
304+
}
305+
}
306+
286307
#[derive(Clone, Copy, Debug, Default, ValueEnum)]
287308
enum OnZeroItem {
288309
Show,
@@ -350,6 +371,7 @@ fn run(cli: Cli) -> ExitCode {
350371
exec_report_spec,
351372
process_reports::ReportProcessingPreset::MigrateTestStructure,
352373
&mut should_update_expected::NeverUpdateExpected,
374+
OnSkipOnly::Reconcile.into(),
353375
) {
354376
Ok(()) => ExitCode::SUCCESS,
355377
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
@@ -358,6 +380,7 @@ fn run(cli: Cli) -> ExitCode {
358380
exec_report_spec,
359381
preset,
360382
implementation_status,
383+
on_skip_only,
361384
} => {
362385
assert!(
363386
!implementation_status.is_empty(),
@@ -375,6 +398,7 @@ fn run(cli: Cli) -> ExitCode {
375398
&mut should_update_expected::ImplementationStatusFilter {
376399
allowed: allowed_implementation_statuses,
377400
},
401+
on_skip_only.into(),
378402
) {
379403
Ok(()) => ExitCode::SUCCESS,
380404
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
@@ -1417,6 +1441,7 @@ fn process_reports(
14171441
exec_report_spec: ExecReportSpec,
14181442
preset: process_reports::ReportProcessingPreset,
14191443
should_update_expected: &mut dyn ShouldUpdateExpected,
1444+
on_skip_only: process_reports::OnSkipOnly,
14201445
) -> Result<(), AlreadyReportedToCommandline> {
14211446
let exec_report_paths = exec_report_spec.paths()?;
14221447

@@ -1430,6 +1455,7 @@ fn process_reports(
14301455
preset,
14311456
should_update_expected,
14321457
meta_files_by_path,
1458+
on_skip_only,
14331459
})?;
14341460

14351461
log::debug!("processing complete, writing new metadata to file system…");

moz-webgpu-cts/src/process_reports.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ pub(crate) struct ProcessReportsArgs<'a> {
5757
pub preset: ReportProcessingPreset,
5858
pub should_update_expected: &'a mut dyn should_update_expected::ShouldUpdateExpected,
5959
pub meta_files_by_path: IndexMap<Arc<PathBuf>, File>,
60+
pub on_skip_only: OnSkipOnly,
6061
}
6162

6263
#[derive(Clone, Copy, Debug)]
@@ -67,6 +68,14 @@ pub(crate) enum ReportProcessingPreset {
6768
MigrateTestStructure,
6869
}
6970

71+
#[derive(Clone, Copy, Debug)]
72+
pub(crate) enum OnSkipOnly {
73+
/// Do not change metadata.
74+
Ignore,
75+
/// Apply reconcilation with `SKIP` outcomes.
76+
Reconcile,
77+
}
78+
7079
#[derive(Debug, Default)]
7180
struct EntryByCtsPath<'a> {
7281
metadata_path: Option<TestEntryPath<'a>>,
@@ -161,6 +170,7 @@ pub(crate) fn process_reports(
161170
preset,
162171
should_update_expected,
163172
meta_files_by_path,
173+
on_skip_only,
164174
} = args;
165175

166176
if exec_report_paths.is_empty() {
@@ -469,14 +479,14 @@ pub(crate) fn process_reports(
469479

470480
let mut properties = properties.unwrap_or_default();
471481

482+
let skip = TestOutcome::Skip;
472483
for (platform, build_profile, reported) in
473484
test_reported.iter_mut().flat_map(|(p, by_bp)| {
474485
by_bp
475486
.iter_mut()
476487
.map(move |(bp, reported)| (p, bp, reported))
477488
})
478489
{
479-
let skip = TestOutcome::Skip;
480490
// Ignore `SKIP` outcomes if we have non-`SKIP` outcomes here.
481491
//
482492
// Do this so that test runs whose coverage _in aggregate_ includes actual
@@ -509,7 +519,11 @@ pub(crate) fn process_reports(
509519
test_reported,
510520
preset,
511521
&mut |meta_props, reported, key| {
512-
should_update_expected.test(meta_props, reported, key)
522+
let (platform, build_profile) = key;
523+
(match on_skip_only {
524+
OnSkipOnly::Ignore => reported[&platform][&build_profile] != skip,
525+
OnSkipOnly::Reconcile => true,
526+
}) && should_update_expected.test(meta_props, reported, key)
513527
},
514528
);
515529

0 commit comments

Comments
 (0)