Skip to content

Commit 184132f

Browse files
refactor(process_reports): change terms. "outcome" to "entry"
We're about to change these things to have an entire set of properties at the file, test, and subtest level, where calling them "outcomes" will no longer be accurate. Use a more generic term as prep. for this change.
1 parent cb11f87 commit 184132f

2 files changed

Lines changed: 35 additions & 37 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use self::{
88
BuildProfile, File, FileProps, Platform, Subtest, SubtestOutcome, Test, TestOutcome,
99
TestProps,
1010
},
11-
process_reports::{MaybeDisabled, OutcomesForComparison, TestOutcomes},
11+
process_reports::{Entry, MaybeDisabled, TestEntry},
1212
report::{
1313
ExecutionReport, RunInfo, SubtestExecutionResult, TestExecutionEntry, TestExecutionResult,
1414
},
@@ -325,7 +325,7 @@ fn run(cli: Cli) -> ExitCode {
325325
};
326326

327327
let mut file_props_by_file = IndexMap::<Utf8PathBuf, FileProps>::default();
328-
let mut outcomes_by_test = IndexMap::<TestPath<'_>, TestOutcomes>::default();
328+
let mut entries_by_test = IndexMap::<TestPath<'_>, TestEntry>::default();
329329

330330
log::info!("loading metadata for comparison to reports…");
331331
for (path, file) in meta_files_by_path {
@@ -354,10 +354,10 @@ fn run(cli: Cli) -> ExitCode {
354354
log::error!("hoo boy, not sure what to do yet: {what}")
355355
};
356356

357-
let TestOutcomes {
358-
test_outcomes: recorded_test_outcomes,
359-
subtests: recorded_subtests,
360-
} = outcomes_by_test
357+
let TestEntry {
358+
entry: test_entry,
359+
subtests: subtest_entries,
360+
} = entries_by_test
361361
.entry(test_path.clone().into_owned())
362362
.or_default();
363363

@@ -369,7 +369,7 @@ fn run(cli: Cli) -> ExitCode {
369369
} else {
370370
MaybeDisabled::Enabled(expectations)
371371
};
372-
if let Some(_old) = recorded_test_outcomes.metadata.replace(maybe_disabled) {
372+
if let Some(_old) = test_entry.metadata.replace(maybe_disabled) {
373373
freak_out_do_nothing(
374374
&lazy_format!(
375375
"duplicate entry for {test_path:?}, discarding previous entries with this and further dupes"
@@ -386,16 +386,14 @@ fn run(cli: Cli) -> ExitCode {
386386
expectations,
387387
},
388388
} = subtest;
389-
let recorded_subtest_outcomes =
390-
recorded_subtests.entry(subtest_name.clone()).or_default();
389+
let subtest_entry =
390+
subtest_entries.entry(subtest_name.clone()).or_default();
391391
let maybe_disabled = if is_disabled {
392392
MaybeDisabled::Disabled
393393
} else {
394394
MaybeDisabled::Enabled(expectations)
395395
};
396-
if let Some(_old) =
397-
recorded_subtest_outcomes.metadata.replace(maybe_disabled)
398-
{
396+
if let Some(_old) = subtest_entry.metadata.replace(maybe_disabled) {
399397
if !reported_dupe_already {
400398
freak_out_do_nothing(&lazy_format!(
401399
"duplicate subtest in {test_path:?} named {subtest_name:?}, discarding previous entries with this and further dupes"
@@ -454,10 +452,10 @@ fn run(cli: Cli) -> ExitCode {
454452
let TestExecutionEntry { test_name, result } = entry;
455453

456454
let test_path = TestPath::from_execution_report(&test_name).unwrap();
457-
let TestOutcomes {
458-
test_outcomes: recorded_test_outcomes,
459-
subtests: recorded_subtests,
460-
} = outcomes_by_test
455+
let TestEntry {
456+
entry: test_entry,
457+
subtests: subtest_entries,
458+
} = entries_by_test
461459
.entry(test_path.clone().into_owned())
462460
.or_default();
463461

@@ -496,26 +494,26 @@ fn run(cli: Cli) -> ExitCode {
496494
}
497495
}
498496
accumulate(
499-
&mut recorded_test_outcomes.reported,
497+
&mut test_entry.reported,
500498
platform,
501499
build_profile,
502500
reported_outcome,
503501
);
504502

505503
for reported_subtest in reported_subtests {
506504
let SubtestExecutionResult {
507-
subtest_name: reported_subtest_name,
508-
outcome: reported_outcome,
505+
subtest_name,
506+
outcome,
509507
} = reported_subtest;
510508

511509
accumulate(
512-
&mut recorded_subtests
513-
.entry(reported_subtest_name.clone())
510+
&mut subtest_entries
511+
.entry(subtest_name.clone())
514512
.or_default()
515513
.reported,
516514
platform,
517515
build_profile,
518-
reported_outcome,
516+
outcome,
519517
);
520518
}
521519
}
@@ -525,17 +523,17 @@ fn run(cli: Cli) -> ExitCode {
525523

526524
let mut found_reconciliation_err = false;
527525
let recombined_tests_iter =
528-
outcomes_by_test
526+
entries_by_test
529527
.into_iter()
530-
.filter_map(|(test_path, outcomes)| {
528+
.filter_map(|(test_path, test_entry)| {
531529
fn reconcile<Out>(
532-
outcomes: OutcomesForComparison<Out>,
530+
entry: Entry<Out>,
533531
preset: ReportProcessingPreset,
534532
) -> TestProps<Out>
535533
where
536534
Out: Debug + Default + EnumSetType,
537535
{
538-
let OutcomesForComparison { metadata, reported } = outcomes;
536+
let Entry { metadata, reported } = entry;
539537

540538
let metadata = metadata
541539
.map(|maybe_disabled| {
@@ -596,15 +594,15 @@ fn run(cli: Cli) -> ExitCode {
596594
}
597595
}
598596

599-
let TestOutcomes {
600-
test_outcomes,
601-
subtests: recorded_subtests,
602-
} = outcomes;
597+
let TestEntry {
598+
entry: test_entry,
599+
subtests: subtest_entries,
600+
} = test_entry;
603601

604-
let properties = reconcile(test_outcomes, preset);
602+
let properties = reconcile(test_entry, preset);
605603

606604
let mut subtests = BTreeMap::new();
607-
for (subtest_name, subtest) in recorded_subtests {
605+
for (subtest_name, subtest) in subtest_entries {
608606
let subtest_name = SectionHeader(subtest_name);
609607
if subtests.get(&subtest_name).is_some() {
610608
found_reconciliation_err = true;

moz-webgpu-cts/src/process_reports.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ use crate::{
88
};
99

1010
#[derive(Debug)]
11-
pub(crate) struct OutcomesForComparison<Out>
11+
pub(crate) struct Entry<Out>
1212
where
1313
Out: EnumSetType,
1414
{
1515
pub metadata: Option<MaybeDisabled<Option<NormalizedExpectationPropertyValue<Out>>>>,
1616
pub reported: BTreeMap<Platform, BTreeMap<BuildProfile, Expectation<Out>>>,
1717
}
1818

19-
impl<Out> Default for OutcomesForComparison<Out>
19+
impl<Out> Default for Entry<Out>
2020
where
2121
Out: EnumSetType,
2222
{
@@ -56,7 +56,7 @@ impl<T> MaybeDisabled<T> {
5656
}
5757

5858
#[derive(Debug, Default)]
59-
pub(crate) struct TestOutcomes {
60-
pub test_outcomes: OutcomesForComparison<TestOutcome>,
61-
pub subtests: BTreeMap<String, OutcomesForComparison<SubtestOutcome>>,
59+
pub(crate) struct TestEntry {
60+
pub entry: Entry<TestOutcome>,
61+
pub subtests: BTreeMap<String, Entry<SubtestOutcome>>,
6262
}

0 commit comments

Comments
 (0)