Skip to content

Commit c4a011f

Browse files
Merge pull request #96 from ErichDonGubler/filter-skip-outcomes
`update-expected`: ignore aggregated `SKIP` outcomes in tests if other outcomes are also reported
2 parents 7ed6b85 + b34f4ed commit c4a011f

3 files changed

Lines changed: 76 additions & 17 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -532,18 +532,12 @@ fn run(cli: Cli) -> ExitCode {
532532
.chain(other_entries_by_test)
533533
.filter_map(|(test_path, test_entry)| {
534534
fn reconcile<Out>(
535-
entry: Entry<Out>,
535+
meta_props: &mut TestProps<Out>,
536+
reported: BTreeMap<Platform, BTreeMap<BuildProfile, Expected<Out>>>,
536537
preset: ReportProcessingPreset,
537-
) -> TestProps<Out>
538-
where
538+
) where
539539
Out: Debug + Default + EnumSetType,
540540
{
541-
let Entry {
542-
meta_props,
543-
reported,
544-
} = entry;
545-
546-
let mut meta_props = meta_props.unwrap_or_default();
547541
let reconciled = 'resolve: {
548542
let reported = |platform, build_profile| {
549543
reported
@@ -587,19 +581,22 @@ fn run(cli: Cli) -> ExitCode {
587581
}
588582
};
589583
meta_props.expected = Some(reconciled);
590-
meta_props
591584
}
592585

593586
let TestEntry {
594-
entry: test_entry,
587+
entry:
588+
Entry {
589+
meta_props: properties,
590+
reported: mut test_reported,
591+
},
595592
subtests: subtest_entries,
596593
} = test_entry;
597594

598-
if test_entry.meta_props.is_none() {
595+
if properties.is_none() {
599596
log::info!("new test entry: {test_path:?}")
600597
}
601598

602-
if test_entry.reported.is_empty() && using_reports {
599+
if test_reported.is_empty() && using_reports {
603600
let test_path = &test_path;
604601
let msg = lazy_format!("no entries found in reports for {:?}", test_path);
605602
match preset {
@@ -612,7 +609,44 @@ fn run(cli: Cli) -> ExitCode {
612609
}
613610
}
614611

615-
let properties = reconcile(test_entry, preset);
612+
let mut properties = properties.unwrap_or_default();
613+
614+
for (platform, build_profile, reported) in
615+
test_reported.iter_mut().flat_map(|(p, by_bp)| {
616+
by_bp
617+
.iter_mut()
618+
.map(move |(bp, reported)| (p, bp, reported))
619+
})
620+
{
621+
let skip = TestOutcome::Skip;
622+
// Ignore `SKIP` outcomes if we have non-`SKIP` outcomes here.
623+
//
624+
// Do this so that test runs whose coverage _in aggregate_ includes actual
625+
// runs on this test are viable for processing. Otherwise, we'd have `SKIP`
626+
// outcomes be included that aren't actually wanted.
627+
if *reported != skip {
628+
let skip = skip.into();
629+
if reported.inner().is_superset(skip) {
630+
log::debug!(
631+
concat!(
632+
"encountered `{}` among other outcomes ",
633+
"in aggregation of reported test outcomes ",
634+
"for {:?} with platform {:?} and build profile {:?}, ",
635+
" removing with the assumption that ",
636+
"this is an artifact of disjoint test runs"
637+
),
638+
skip,
639+
test_path,
640+
platform,
641+
build_profile,
642+
);
643+
*reported = Expected::new(reported.inner() & !skip)
644+
.expect("internal error: empty non-`SKIP` superset");
645+
}
646+
}
647+
}
648+
649+
reconcile(&mut properties, test_reported, preset);
616650

617651
let mut subtests = BTreeMap::new();
618652
for (subtest_name, subtest) in subtest_entries {
@@ -622,8 +656,13 @@ fn run(cli: Cli) -> ExitCode {
622656
log::error!("internal error: duplicate test path {test_path:?}");
623657
}
624658

625-
let mut properties = reconcile(subtest, preset);
659+
let Entry {
660+
meta_props: properties,
661+
reported: subtest_reported,
662+
} = subtest;
626663

664+
let mut properties = properties.unwrap_or_default();
665+
reconcile(&mut properties, subtest_reported, preset);
627666
for (_, expected) in properties.expected.as_mut().unwrap().iter_mut() {
628667
taint_subtest_timeouts_by_suspicion(expected);
629668
}

moz-webgpu-cts/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ where
745745
where
746746
Out: Default + EnumSetType + Eq + PartialEq,
747747
{
748-
if exp != &Default::default() {
748+
if exp != &Out::default() {
749749
f()
750750
} else {
751751
Ok(())

moz-webgpu-cts/src/shared.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::metadata::{BuildProfile, Platform};
2424
///
2525
/// [`Test`]: crate::metadata::Test
2626
/// [`Subtest`]: crate::metadata::Subtest
27-
#[derive(Clone, Copy, Eq, PartialEq)]
27+
#[derive(Clone, Copy)]
2828
pub struct Expected<Out>(EnumSet<Out>)
2929
where
3030
Out: EnumSetType;
@@ -191,6 +191,26 @@ where
191191
}
192192
}
193193

194+
impl<Out> PartialEq for Expected<Out>
195+
where
196+
Out: EnumSetType + Eq,
197+
{
198+
fn eq(&self, other: &Self) -> bool {
199+
self.inner() == other.inner()
200+
}
201+
}
202+
203+
impl<Out> PartialEq<Out> for Expected<Out>
204+
where
205+
Out: EnumSetType + Eq,
206+
{
207+
fn eq(&self, other: &Out) -> bool {
208+
self.inner() == *other
209+
}
210+
}
211+
212+
impl<Out> Eq for Expected<Out> where Out: EnumSetType + Eq {}
213+
194214
/// Similar to the ubiquitous `enum Either`, but with the implication that `Collapsed` values are
195215
/// abbreviations of equivalent `Expanded` values.
196216
#[derive(Clone, Debug, Eq, PartialEq)]

0 commit comments

Comments
 (0)