Skip to content

Commit fb783be

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

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ 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+
/// Assumptions about report coverage that affect cases where tests are present in
122+
/// metadata, but not in reports.
123+
#[clap(value_enum, long, default_value_t = OnSkipOnly::Reconcile)]
124+
on_skip_only: OnSkipOnly,
121125
},
122126
/// Parse test metadata, apply automated fixups, and re-emit it in normalized form.
123127
#[clap(name = "fixup", alias = "fmt")]
@@ -283,6 +287,24 @@ impl From<UpdateExpectedPreset> for process_reports::ReportProcessingPreset {
283287
}
284288
}
285289

290+
/// See [`Subcommand::UpdateExpected::on_skip_only`].
291+
#[derive(Clone, Copy, Debug, ValueEnum)]
292+
pub(crate) enum OnSkipOnly {
293+
/// Use reconcilation from the provided `--preset` with `SKIP` outcomes.
294+
Reconcile,
295+
/// Do not change metadata.
296+
Ignore,
297+
}
298+
299+
impl From<OnSkipOnly> for process_reports::OnSkipOnly {
300+
fn from(value: OnSkipOnly) -> Self {
301+
match value {
302+
OnSkipOnly::Ignore => Self::Ignore,
303+
OnSkipOnly::Reconcile => Self::Reconcile,
304+
}
305+
}
306+
}
307+
286308
#[derive(Clone, Copy, Debug, Default, ValueEnum)]
287309
enum OnZeroItem {
288310
Show,
@@ -350,6 +372,7 @@ fn run(cli: Cli) -> ExitCode {
350372
exec_report_spec,
351373
process_reports::ReportProcessingPreset::MigrateTestStructure,
352374
&mut should_update_expected::NeverUpdateExpected,
375+
OnSkipOnly::Reconcile.into(),
353376
) {
354377
Ok(()) => ExitCode::SUCCESS,
355378
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
@@ -358,6 +381,7 @@ fn run(cli: Cli) -> ExitCode {
358381
exec_report_spec,
359382
preset,
360383
implementation_status,
384+
on_skip_only,
361385
} => {
362386
assert!(
363387
!implementation_status.is_empty(),
@@ -375,6 +399,7 @@ fn run(cli: Cli) -> ExitCode {
375399
&mut should_update_expected::ImplementationStatusFilter {
376400
allowed: allowed_implementation_statuses,
377401
},
402+
on_skip_only.into(),
378403
) {
379404
Ok(()) => ExitCode::SUCCESS,
380405
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
@@ -1417,6 +1442,7 @@ fn process_reports(
14171442
exec_report_spec: ExecReportSpec,
14181443
preset: process_reports::ReportProcessingPreset,
14191444
should_update_expected: &mut dyn ShouldUpdateExpected,
1445+
on_skip_only: process_reports::OnSkipOnly,
14201446
) -> Result<(), AlreadyReportedToCommandline> {
14211447
let exec_report_paths = exec_report_spec.paths()?;
14221448

@@ -1430,6 +1456,7 @@ fn process_reports(
14301456
preset,
14311457
should_update_expected,
14321458
meta_files_by_path,
1459+
on_skip_only,
14331460
})?;
14341461

14351462
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)