Skip to content

Commit a9261c0

Browse files
feat(update_expected): add --on-skip-only (#171)
2 parents 9135afa + fa8c3ec commit a9261c0

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
@@ -122,6 +122,9 @@ enum Subcommand {
122122
/// `implementation-status`es that changes should be applied to.
123123
#[clap(value_enum, long, default_value = "backlog")]
124124
implementation_status: Vec<ImplementationStatus>,
125+
/// What do when only `SKIP` outcomes are found for tests and subtests.
126+
#[clap(value_enum, long, default_value_t = OnSkipOnly::Reconcile)]
127+
on_skip_only: OnSkipOnly,
125128
},
126129
/// Parse test metadata, apply automated fixups, and re-emit it in normalized form.
127130
#[clap(name = "fixup", alias = "fmt")]
@@ -196,6 +199,24 @@ impl From<UpdateExpectedPreset> for process_reports::ReportProcessingPreset {
196199
}
197200
}
198201

202+
/// See [`Subcommand::UpdateExpected::on_skip_only`].
203+
#[derive(Clone, Copy, Debug, ValueEnum)]
204+
pub(crate) enum OnSkipOnly {
205+
/// Use reconcilation from the provided `--preset` with `SKIP` outcomes.
206+
Reconcile,
207+
/// Do not change metadata.
208+
Ignore,
209+
}
210+
211+
impl From<OnSkipOnly> for process_reports::OnSkipOnly {
212+
fn from(value: OnSkipOnly) -> Self {
213+
match value {
214+
OnSkipOnly::Ignore => Self::Ignore,
215+
OnSkipOnly::Reconcile => Self::Reconcile,
216+
}
217+
}
218+
}
219+
199220
#[derive(Clone, Copy, Debug, Default, ValueEnum)]
200221
enum OnZeroItem {
201222
Show,
@@ -263,6 +284,7 @@ fn run(cli: Cli) -> ExitCode {
263284
exec_report_spec,
264285
process_reports::ReportProcessingPreset::MigrateTestStructure,
265286
&mut should_update_expected::NeverUpdateExpected,
287+
OnSkipOnly::Reconcile.into(),
266288
) {
267289
Ok(()) => ExitCode::SUCCESS,
268290
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
@@ -271,6 +293,7 @@ fn run(cli: Cli) -> ExitCode {
271293
exec_report_spec,
272294
preset,
273295
implementation_status,
296+
on_skip_only,
274297
} => {
275298
assert!(
276299
!implementation_status.is_empty(),
@@ -288,6 +311,7 @@ fn run(cli: Cli) -> ExitCode {
288311
&mut should_update_expected::ImplementationStatusFilter {
289312
allowed: allowed_implementation_statuses,
290313
},
314+
on_skip_only.into(),
291315
) {
292316
Ok(()) => ExitCode::SUCCESS,
293317
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
@@ -1322,6 +1346,7 @@ fn process_reports(
13221346
exec_report_spec: ExecReportSpec,
13231347
preset: process_reports::ReportProcessingPreset,
13241348
should_update_expected: &mut dyn ShouldUpdateExpected,
1349+
on_skip_only: process_reports::OnSkipOnly,
13251350
) -> Result<(), AlreadyReportedToCommandline> {
13261351
let exec_report_paths = exec_report_spec.paths()?;
13271352

@@ -1335,6 +1360,7 @@ fn process_reports(
13351360
preset,
13361361
should_update_expected,
13371362
meta_files_by_path,
1363+
on_skip_only,
13381364
})?;
13391365

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