Skip to content

Commit

Permalink
Merge pull request #33 from ErichDonGubler/normalize-exps-more
Browse files Browse the repository at this point in the history
feat(cli)!: normalize exps. in meta. to be: by platform, by build profile
  • Loading branch information
ErichDonGubler authored Oct 27, 2023
2 parents dac82d5 + 6b87b4c commit 70857f9
Show file tree
Hide file tree
Showing 5 changed files with 341 additions and 114 deletions.
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ miette = { version = "5.10.0", features = ["fancy"] }
natord = "1.0.9"
path-dsl = "0.6.1"
regex = "1.9.5"
strum = { version = "0.25.0", features = ["derive"] }
thiserror = "1.0.49"
wax = "0.6.0"

Expand Down
103 changes: 61 additions & 42 deletions src/bin/moz-webgpu-cts/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mod metadata;
mod shared;

use self::metadata::{
AnalyzeableProps, Applicability, Expectation, Platform, SubtestOutcome, Test, TestOutcome,
use self::{
metadata::{AnalyzeableProps, Platform, SubtestOutcome, Test, TestOutcome},
shared::{Expectation, MaybeCollapsed},
};

use std::{
Expand All @@ -22,10 +24,7 @@ use path_dsl::path;
use regex::Regex;
use wax::Glob;
use whippit::{
metadata::{
properties::{ConditionalValue, PropertyValue},
SectionHeader, Subtest,
},
metadata::{SectionHeader, Subtest},
reexport::chumsky::prelude::Rich,
};

Expand Down Expand Up @@ -381,27 +380,35 @@ fn run(cli: Cli) -> ExitCode {
})
})
};
match expectations {
PropertyValue::Unconditional(exp) => {
apply_to_all_platforms(&mut analysis, exp)
}
PropertyValue::Conditional(ConditionalValue {
conditions,
fallback,
}) => {
for (condition, exp) in conditions {
let Applicability {
platform,
build_profile: _,
} = condition;
if let Some(platform) = platform {
apply_to_specific_platforms(&mut analysis, platform, exp)
} else {

match expectations.into_inner() {
MaybeCollapsed::Collapsed(exps) => match exps {
MaybeCollapsed::Collapsed(exp) => {
apply_to_all_platforms(&mut analysis, exp)
}
MaybeCollapsed::Expanded(by_build_profile) => {
for (_build_profile, exp) in by_build_profile {
apply_to_all_platforms(&mut analysis, exp)
}
}
if let Some(fallback) = fallback {
apply_to_all_platforms(&mut analysis, fallback)
},
MaybeCollapsed::Expanded(by_platform) => {
for (platform, exp_by_build_profile) in by_platform {
// TODO: has a lot in common with above cases. Refactor out?
match exp_by_build_profile {
MaybeCollapsed::Collapsed(exp) => {
apply_to_specific_platforms(&mut analysis, platform, exp)
}
MaybeCollapsed::Expanded(by_build_profile) => {
for (_build_profile, exp) in by_build_profile {
apply_to_specific_platforms(
&mut analysis,
platform,
exp,
)
}
}
}
}
}
}
Expand Down Expand Up @@ -474,27 +481,39 @@ fn run(cli: Cli) -> ExitCode {
)
})
};
match expectations {
PropertyValue::Unconditional(exp) => {
apply_to_all_platforms(&mut analysis, exp)
}
PropertyValue::Conditional(ConditionalValue {
conditions,
fallback,
}) => {
for (condition, exp) in conditions {
let Applicability {
platform,
build_profile: _,
} = condition;
if let Some(platform) = platform {
apply_to_specific_platforms(&mut analysis, platform, exp)
} else {

match expectations.into_inner() {
MaybeCollapsed::Collapsed(exps) => match exps {
MaybeCollapsed::Collapsed(exp) => {
apply_to_all_platforms(&mut analysis, exp)
}
MaybeCollapsed::Expanded(by_build_profile) => {
for (_build_profile, exp) in by_build_profile {
apply_to_all_platforms(&mut analysis, exp)
}
}
if let Some(fallback) = fallback {
apply_to_all_platforms(&mut analysis, fallback)
},
MaybeCollapsed::Expanded(by_platform) => {
for (platform, exp_by_build_profile) in by_platform {
// TODO: has a lot in common with above cases. Refactor out?
match exp_by_build_profile {
MaybeCollapsed::Collapsed(exp) => {
apply_to_specific_platforms(
&mut analysis,
platform,
exp,
)
}
MaybeCollapsed::Expanded(by_build_profile) => {
for (_build_profile, exp) in by_build_profile {
apply_to_specific_platforms(
&mut analysis,
platform,
exp,
)
}
}
}
}
}
}
Expand Down
Loading

0 comments on commit 70857f9

Please sign in to comment.