From 97e4f0d12fe53825b89216ef6f6afb7e0461486e Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 27 Oct 2023 13:38:25 -0400 Subject: [PATCH 1/4] chore: `allow(unused)` on `TaggedTest::orig_path` --- src/bin/moz-webgpu-cts/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/moz-webgpu-cts/main.rs b/src/bin/moz-webgpu-cts/main.rs index e039132..fabd1b2 100644 --- a/src/bin/moz-webgpu-cts/main.rs +++ b/src/bin/moz-webgpu-cts/main.rs @@ -182,6 +182,7 @@ fn run(cli: Cli) -> ExitCode { Subcommand::Triage => { #[derive(Debug)] struct TaggedTest { + #[allow(unused)] orig_path: Arc, inner: metadata::Test, } From 967e003b2e8bf737d595e4eeebb0f118c6f1f744 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 27 Oct 2023 13:39:04 -0400 Subject: [PATCH 2/4] fix(cli): don't panic, emit errors on dupe props. --- src/bin/moz-webgpu-cts/metadata.rs | 38 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/bin/moz-webgpu-cts/metadata.rs b/src/bin/moz-webgpu-cts/metadata.rs index 3aa1869..c689227 100644 --- a/src/bin/moz-webgpu-cts/metadata.rs +++ b/src/bin/moz-webgpu-cts/metadata.rs @@ -8,6 +8,7 @@ use chumsky::{ input::Emitter, prelude::Rich, primitive::{choice, just}, + span::SimpleSpan, text::{inline_whitespace, keyword}, Boxed, IterParser, Parser, }; @@ -226,13 +227,12 @@ where expectations, } = self; - match prop { - AnalyzeableProp::Expected(val) => { + let AnalyzeableProp { kind, span } = prop; + + match kind { + AnalyzeablePropKind::Expected(val) => { if expectations.is_some() { - emitter.emit(Rich::custom( - todo!("duplicate `expected` key detected"), - "duplicate `expected` key detected", - )); + emitter.emit(Rich::custom(span, "duplicate `expected` key detected")); return; } expectations.replace(match val { @@ -287,12 +287,9 @@ where } }); } - AnalyzeableProp::Disabled => { + AnalyzeablePropKind::Disabled => { if *is_disabled { - emitter.emit(Rich::custom( - todo!("duplicate `expected` key detected"), - "duplicate `disabled` key detected", - )) + emitter.emit(Rich::custom(span, "duplicate `disabled` key detected")) } *is_disabled = true; } @@ -360,7 +357,13 @@ pub struct Applicability { } #[derive(Clone, Debug)] -pub enum AnalyzeableProp { +pub struct AnalyzeableProp { + span: SimpleSpan, + kind: AnalyzeablePropKind, +} + +#[derive(Clone, Debug)] +enum AnalyzeablePropKind { Expected(PropertyValue>), Disabled, } @@ -502,8 +505,10 @@ impl AnalyzeableProp { )) .padded_by(inline_whitespace()), ) - .map(|((), val)| val) - .map(AnalyzeableProp::Expected), + .map_with(|((), val), e| AnalyzeableProp { + span: e.span(), + kind: AnalyzeablePropKind::Expected(val), + }), helper .parser( just("disabled").to(()), @@ -520,7 +525,10 @@ impl AnalyzeableProp { )); } } - AnalyzeableProp::Disabled + AnalyzeableProp { + span: e.span(), + kind: AnalyzeablePropKind::Disabled, + } }), )) } From 83c3ccb2602a69f7cb7e7514dc0d122b7678eab0 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 27 Oct 2023 13:09:17 -0400 Subject: [PATCH 3/4] chore: whoops, fix test snaps., `clippy` lints, fmt. in `shared` mod. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was unfortunately introduced with `NormalizedExpectationPropertyValue`. That's, uh…why I'm prioritizing CI now. 😅 --- src/bin/moz-webgpu-cts/metadata.rs | 139 +++++++++++++++++------------ src/bin/moz-webgpu-cts/shared.rs | 10 +-- 2 files changed, 82 insertions(+), 67 deletions(-) diff --git a/src/bin/moz-webgpu-cts/metadata.rs b/src/bin/moz-webgpu-cts/metadata.rs index c689227..655f18b 100644 --- a/src/bin/moz-webgpu-cts/metadata.rs +++ b/src/bin/moz-webgpu-cts/metadata.rs @@ -344,9 +344,9 @@ where } } - return Some(NormalizedExpectationPropertyValue( + Some(NormalizedExpectationPropertyValue( MaybeCollapsed::Collapsed(first_normalized_by_build_profile), - )); + )) } } @@ -755,9 +755,13 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Unconditional( - Permanent( - Pass, + NormalizedExpectationPropertyValue( + Collapsed( + Collapsed( + Permanent( + Pass, + ), + ), ), ), ), @@ -821,12 +825,16 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Unconditional( - Intermittent( - { - Pass, - Fail, - }, + NormalizedExpectationPropertyValue( + Collapsed( + Collapsed( + Intermittent( + [ + Pass, + Fail, + ], + ), + ), ), ), ), @@ -858,9 +866,13 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Unconditional( - Permanent( - Ok, + NormalizedExpectationPropertyValue( + Collapsed( + Collapsed( + Permanent( + Ok, + ), + ), ), ), ), @@ -870,9 +882,13 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Unconditional( - Permanent( - Pass, + NormalizedExpectationPropertyValue( + Collapsed( + Collapsed( + Permanent( + Pass, + ), + ), ), ), ), @@ -910,23 +926,26 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Conditional( - ConditionalValue { - conditions: [ - ( - Applicability { - platform: Some( - Linux, - ), - build_profile: None, - }, + NormalizedExpectationPropertyValue( + Expanded( + { + Windows: Collapsed( + Permanent( + Pass, + ), + ), + Linux: Collapsed( Permanent( Fail, ), ), - ], - fallback: None, - }, + MacOs: Collapsed( + Permanent( + Pass, + ), + ), + }, + ), ), ), }, @@ -964,27 +983,26 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Conditional( - ConditionalValue { - conditions: [ - ( - Applicability { - platform: Some( - Linux, - ), - build_profile: None, - }, + NormalizedExpectationPropertyValue( + Expanded( + { + Windows: Collapsed( + Permanent( + Timeout, + ), + ), + Linux: Collapsed( Permanent( Fail, ), ), - ], - fallback: Some( - Permanent( - Timeout, + MacOs: Collapsed( + Permanent( + Timeout, + ), ), - ), - }, + }, + ), ), ), }, @@ -1020,23 +1038,26 @@ r#" properties: AnalyzeableProps { is_disabled: false, expectations: Some( - Conditional( - ConditionalValue { - conditions: [ - ( - Applicability { - platform: Some( - MacOs, - ), - build_profile: None, - }, + NormalizedExpectationPropertyValue( + Expanded( + { + Windows: Collapsed( + Permanent( + Pass, + ), + ), + Linux: Collapsed( + Permanent( + Pass, + ), + ), + MacOs: Collapsed( Permanent( Fail, ), ), - ], - fallback: None, - }, + }, + ), ), ), }, diff --git a/src/bin/moz-webgpu-cts/shared.rs b/src/bin/moz-webgpu-cts/shared.rs index 20b05d2..81c2920 100644 --- a/src/bin/moz-webgpu-cts/shared.rs +++ b/src/bin/moz-webgpu-cts/shared.rs @@ -1,4 +1,4 @@ -use std::{collections::BTreeMap}; +use std::collections::BTreeMap; use crate::metadata::{BuildProfile, Platform}; @@ -36,13 +36,7 @@ pub enum MaybeCollapsed { /// [`AnalyzeableProps`]: crate::metadata::AnalyzeableProps #[derive(Clone, Debug)] pub struct NormalizedExpectationPropertyValue( - pub(crate) MaybeCollapsed< - MaybeCollapsed, BTreeMap>>, - BTreeMap< - Platform, - MaybeCollapsed, BTreeMap>>, - >, - >, + pub(crate) NormalizedExpectationPropertyValueData, ); /// Data from a [`NormalizedExpectationPropertyValue`]. From 574b1c7053853825d2248b567e203bcb40260b24 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 27 Oct 2023 13:15:27 -0400 Subject: [PATCH 4/4] build(ci): add some simple CI for `cargo {check,deny,fmt,test}` --- .github/workflows/pr.yml | 11 ++++ .github/workflows/push.yml | 112 +++++++++++++++++++++++++++++++++++++ deny.toml | 8 +++ 3 files changed, 131 insertions(+) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/push.yml create mode 100644 deny.toml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c70a57e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,11 @@ +name: CI (PR) + +on: [pull_request] +jobs: + block-autosquash-commits: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.0.0 + - name: Block merging fixup commits + uses: ErichDonGubler/block-fixup-merge-action@patch-1 + diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..023bc25 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,112 @@ +name: CI (push) + +on: [push] + +jobs: + check: + name: Check + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: + - stable + - beta + steps: + - name: Checkout sources + uses: actions/checkout@v1 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: "Run `cargo check`" + uses: actions-rs/cargo@v1 + with: + command: check + + test: + name: Test Suite + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: + - stable + - beta + steps: + - name: Checkout sources + uses: actions/checkout@v1 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: "Run `cargo test`" + uses: actions-rs/cargo@v1 + with: + command: test + + fmt: + name: Rustfmt + runs-on: ${{ matrix.os }} + strategy: + matrix: + rust: + - stable + steps: + - name: Checkout sources + uses: actions/checkout@v1 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + components: rustfmt + + - name: "Run `cargo fmt`" + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: + - stable + - beta + steps: + - name: Checkout sources + uses: actions/checkout@v1 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + components: clippy + + - name: "Run `cargo clippy`" + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + + cargo-deny: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.0.0 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + log-level: warn + command: check + arguments: --all-features diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..d1e94da --- /dev/null +++ b/deny.toml @@ -0,0 +1,8 @@ +[licenses] +allow = [ + "Apache-2.0", + "ISC", + "MIT", + "Unicode-DFS-2016", + "Zlib", +]