Skip to content

Commit

Permalink
fixup! WIP: feat(cli): add moz-webgpu-cts process-reports subcmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Oct 27, 2023
1 parent d0c5978 commit 454a4db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
15 changes: 6 additions & 9 deletions src/bin/moz-webgpu-cts/main.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
mod metadata;
mod process_reports;
mod report;
pub(crate) mod shared;

mod process_reports;

use crate::{
metadata::{BuildProfile, File},
process_reports::{MaybeDisabled, TestOutcomes},
process_reports::{MaybeDisabled, OutcomesForComparison, TestOutcomes},
report::{RunInfo, SubtestExecutionResult, TestExecutionEntry, TestExecutionResult},
shared::TestPath,
shared::{Expectation, MaybeCollapsed, NormalizedExpectationPropertyValue, TestPath},
};

use self::{
metadata::{
AnalyzeableProps, Applicability, Expectation, Platform, SubtestOutcome, Test, TestOutcome,
},
metadata::{AnalyzeableProps, Platform, SubtestOutcome, Test, TestOutcome},
report::ExecutionReport,
};

Expand Down Expand Up @@ -433,7 +430,7 @@ fn run(cli: Cli) -> ExitCode {
fn count<Out>(
recorded: &mut BTreeMap<
Platform,
BTreeMap<BuildProfile, HashMap<Out, NonZeroU64>>,
BTreeMap<BuildProfile, IndexMap<Out, NonZeroU64>>,
>,
platform: Platform,
build_profile: BuildProfile,
Expand All @@ -442,7 +439,7 @@ fn run(cli: Cli) -> ExitCode {
Out: Copy,
Out: Hash + Eq,
{
use std::collections::hash_map::Entry;
use indexmap::map::Entry;

match recorded
.entry(platform)
Expand Down
24 changes: 11 additions & 13 deletions src/bin/moz-webgpu-cts/process_reports.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
use std::{
collections::{BTreeMap, HashMap},
num::NonZeroU64,
};
use std::{collections::BTreeMap, num::NonZeroU64};

use whippit::metadata::properties::PropertyValue;
use indexmap::IndexMap;

use crate::metadata::{
Applicability, BuildProfile, Expectation, Platform, SubtestOutcome, TestOutcome,
use crate::{
metadata::{BuildProfile, Platform, SubtestOutcome, TestOutcome},
shared::NormalizedExpectationPropertyValue,
};

#[derive(Debug)]
pub(crate) struct Outcomes<Out> {
pub metadata: Option<MaybeDisabled<Option<PropertyValue<Applicability, Expectation<Out>>>>>,
pub reported: BTreeMap<Platform, BTreeMap<BuildProfile, HashMap<Out, NonZeroU64>>>,
pub(crate) struct OutcomesForComparison<Out> {
pub metadata: Option<MaybeDisabled<Option<NormalizedExpectationPropertyValue<Out>>>>,
pub reported: BTreeMap<Platform, BTreeMap<BuildProfile, IndexMap<Out, NonZeroU64>>>,
}

impl<Out> Default for Outcomes<Out> {
impl<Out> Default for OutcomesForComparison<Out> {
fn default() -> Self {
Self {
metadata: None,
Expand All @@ -41,6 +39,6 @@ where

#[derive(Debug, Default)]
pub(crate) struct TestOutcomes {
pub test_outcomes: Outcomes<TestOutcome>,
pub subtests: BTreeMap<String, Outcomes<SubtestOutcome>>,
pub test_outcomes: OutcomesForComparison<TestOutcome>,
pub subtests: BTreeMap<String, OutcomesForComparison<SubtestOutcome>>,
}
5 changes: 4 additions & 1 deletion src/bin/moz-webgpu-cts/shared.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::{borrow::Cow, fmt::Display, path::Path};
use std::{borrow::Cow, collections::BTreeMap, fmt::Display, path::Path};

use camino::{Utf8Component, Utf8Path};

use crate::metadata::{BuildProfile, Platform};

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Expectation<Out> {
Permanent(Out),
Expand Down Expand Up @@ -273,6 +275,7 @@ fn report_meta_reject() {
"cts.https.html?stuff=things"
);
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum MaybeCollapsed<C, E> {
Collapsed(C),
Expand Down

0 comments on commit 454a4db

Please sign in to comment.