Skip to content

Commit

Permalink
Turn dependency tests from xtask subcommand into #[test]s (gfx-rs…
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Feb 27, 2025
1 parent 6f0c243 commit 99437e7
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 258 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -809,22 +809,3 @@ jobs:
command: check bans licenses sources
arguments: --all-features --workspace
rust-version: ${{ env.REPO_MSRV }}

check-feature-dependencies:
# runtime is normally 1 minute
timeout-minutes: 5

name: "Feature Dependencies"
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install repo MSRV toolchain
run: |
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal
rustup override set ${{ env.REPO_MSRV }}
cargo -V
- name: Run `cargo feature-dependencies`
run: cargo xtask check-feature-dependencies
44 changes: 43 additions & 1 deletion 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 @@ -93,6 +93,7 @@ bytemuck = { version = "1.21", features = [
"extern_crate_alloc",
"min_const_generics",
] }
cargo_metadata = "0.19"
cfg_aliases = "0.2.1"
cfg-if = "1"
criterion = "0.5"
Expand Down
13 changes: 13 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ This is a table of contents, in the form of the repository's directory structure
- [tests](#player-tests)
- tests
- [compile-tests](#wgpu-compile-tests)
- [dependency-tests](#wgpu-dependency-tests)
- [gpu-tests](#wgpu-gpu-tests)
- [validation-tests](#wgpu-validation-tests)

Expand Down Expand Up @@ -169,6 +170,18 @@ the `wgpu` crate is expected to fail to compile. This mainly
revolves around ensuring lifetimes are properly handled when
dropping passes, etc.

## `wgpu` Dependency Tests

- Located in: `tests/dependency-tests`
- Run with `cargo nextest run --test wgpu-dependency-test`
- Tests against `cargo tree`.

These tests ensure that the `wgpu` crate has the correct dependency
tree on all platforms. It's super easy to subtly mess up the dependencies
which can cause issues or extra dependencies to be pulled in.

This provides a way to ensure that our `toml` files are correct.

## `wgpu` GPU Tests

- Located in: `tests/gpu-tests`
Expand Down
6 changes: 6 additions & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ name = "wgpu-compile-test"
path = "compile-tests/root.rs"
harness = true

[[test]]
name = "wgpu-dependency-test"
path = "dependency-tests/root.rs"
harness = true

[[test]]
name = "wgpu-gpu-test"
path = "gpu-tests/root.rs"
Expand All @@ -39,6 +44,7 @@ arrayvec.workspace = true
approx.workspace = true
bitflags.workspace = true
bytemuck.workspace = true
cargo_metadata.workspace = true
cfg-if.workspace = true
ctor.workspace = true
futures-lite.workspace = true
Expand Down
Loading

0 comments on commit 99437e7

Please sign in to comment.