Skip to content

Commit 15fa979

Browse files
feat(process_reports): add --on-skip-only
1 parent 3e59762 commit 15fa979

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)]
@@ -68,6 +69,14 @@ pub(crate) enum ReportProcessingPreset {
6869
MigrateTestStructure,
6970
}
7071

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

167177
if exec_report_paths.is_empty() {
@@ -470,14 +480,14 @@ pub(crate) fn process_reports(
470480

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

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

0 commit comments

Comments
 (0)