Skip to content

Commit 5054166

Browse files
Merge pull request #125 from ErichDonGubler/promote-passing-per-applicability
Add `--only-across-all-platforms` to `update-backlog`
2 parents 3a5fb7e + 36a60fb commit 5054166

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ enum Subcommand {
115115
/// status.
116116
UpdateBacklog {
117117
/// The mode to use for updating tests.
118-
preset: UpdateBacklogPreset,
118+
#[clap(subcommand)]
119+
preset: UpdateBacklogSubcommand,
119120
},
120121
/// Dump all metadata as JSON. Do so at your own risk; no guarantees are made about the
121122
/// schema of this JSON, for now.
@@ -142,10 +143,13 @@ enum OnZeroItem {
142143
Hide,
143144
}
144145

145-
#[derive(Clone, Copy, Debug, ValueEnum)]
146-
enum UpdateBacklogPreset {
146+
#[derive(Clone, Copy, Debug, Parser)]
147+
enum UpdateBacklogSubcommand {
147148
/// Remove tests that expect only `PASS` outcomes on all platforms from `backlog`.
148-
PromotePermaPassing,
149+
PromotePermaPassing {
150+
#[clap(long, default_value_t = true)]
151+
only_across_all_platforms: bool,
152+
},
149153
}
150154

151155
fn main() -> ExitCode {
@@ -1509,9 +1513,17 @@ fn run(cli: Cli) -> ExitCode {
15091513
let value_across_all_platforms =
15101514
|| cases.into_iter().map(|(_, case)| case).all_equal_value();
15111515
match preset {
1512-
UpdateBacklogPreset::PromotePermaPassing => {
1516+
UpdateBacklogSubcommand::PromotePermaPassing {
1517+
only_across_all_platforms,
1518+
} => {
15131519
if matches!(value_across_all_platforms(), Ok(Case::PermaPass)) {
15141520
properties.implementation_status = None;
1521+
} else if !only_across_all_platforms {
1522+
properties.implementation_status =
1523+
Some(cases.map(|case| match case {
1524+
Case::PermaPass => ImplementationStatus::Implementing,
1525+
Case::Other => ImplementationStatus::Backlog,
1526+
}));
15151527
}
15161528
}
15171529
}

moz-webgpu-cts/src/wpt/metadata/properties.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,22 @@ impl<T> ExpandedPropertyValue<T> {
265265
})
266266
}
267267

268+
pub(crate) fn map<U, F>(self, f: F) -> ExpandedPropertyValue<U>
269+
where
270+
F: FnMut(T) -> U,
271+
{
272+
let mut f = f;
273+
ExpandedPropertyValue(
274+
self.into_inner()
275+
.map(|_platform, by_build_profile| by_build_profile.map(|_build_profile, t| f(t))),
276+
)
277+
}
278+
279+
fn into_inner(self) -> ExpandedPropertyValueData<T> {
280+
let Self(inner) = self;
281+
inner
282+
}
283+
268284
pub(crate) fn inner(&self) -> &ExpandedPropertyValueData<T> {
269285
let Self(inner) = self;
270286
inner

0 commit comments

Comments
 (0)