mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Move test and benchmark targets to standard Cargo autodiscovery layout. (#7436)
This will make it easier for contributors to understand the file layout,
at the cost of said layout containing several more nested directories.
I will personally appreciate not having to remember to look for
`root.rs` instead of `main.rs`.
I also renamed the test targets so that they do not *all* share the
superfluous suffix “-test” (test targets live in a different namespace
than other target types and packages, so the name can presume that it
is always known that they are tests).
The Naga snapshot data sets `naga/tests/{in,out}` have been left in
their original positions.
This commit is contained in:
parent
65fcacf683
commit
02700ab162
@ -9,13 +9,11 @@ repository.workspace = true
|
|||||||
keywords.workspace = true
|
keywords.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
autobenches = false
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "wgpu-benchmark"
|
name = "wgpu-benchmark"
|
||||||
harness = false
|
harness = false
|
||||||
path = "benches/root.rs"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Uncomment these features to enable tracy and superluminal profiling.
|
# Uncomment these features to enable tracy and superluminal profiling.
|
||||||
|
|||||||
@ -15,6 +15,7 @@ struct Inputs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Inputs {
|
impl Inputs {
|
||||||
|
#[track_caller]
|
||||||
fn from_dir(folder: &str, extension: &str) -> Self {
|
fn from_dir(folder: &str, extension: &str) -> Self {
|
||||||
let mut inputs = Vec::new();
|
let mut inputs = Vec::new();
|
||||||
let read_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
let read_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
@ -36,10 +36,10 @@ This is a table of contents, in the form of the repository's directory structure
|
|||||||
- player
|
- player
|
||||||
- [tests](#player-tests)
|
- [tests](#player-tests)
|
||||||
- tests
|
- tests
|
||||||
- [compile-tests](#wgpu-compile-tests)
|
- [compile](#wgpu-compile-tests)
|
||||||
- [dependency-tests](#wgpu-dependency-tests)
|
- [dependency](#wgpu-dependency-tests)
|
||||||
- [gpu-tests](#wgpu-gpu-tests)
|
- [gpu](#wgpu-gpu-tests)
|
||||||
- [validation-tests](#wgpu-validation-tests)
|
- [validation](#wgpu-validation-tests)
|
||||||
|
|
||||||
And where applicable [unit-tests](#unit-tests)
|
And where applicable [unit-tests](#unit-tests)
|
||||||
are scatteredthroughout the codebase.
|
are scatteredthroughout the codebase.
|
||||||
@ -84,16 +84,16 @@ they should be easy to copy into a standalone project.
|
|||||||
|
|
||||||
## `naga` Example Tests
|
## `naga` Example Tests
|
||||||
|
|
||||||
- Located in: `naga/tests/example_wgsl`
|
- Located in: `naga/tests/naga/example_wgsl`
|
||||||
- Run with `cargo nextest run --test naga-test example_wgsl`
|
- Run with `cargo nextest run --test naga example_wgsl`
|
||||||
|
|
||||||
This simple test ensures that all wgsl files in the `examples`
|
This simple test ensures that all wgsl files in the `examples`
|
||||||
directory can be parsed by `naga`'s `wgsl` parser and validate correctly.
|
directory can be parsed by `naga`'s `wgsl` parser and validate correctly.
|
||||||
|
|
||||||
## `naga` Snapshot Tests
|
## `naga` Snapshot Tests
|
||||||
|
|
||||||
- Located in: `naga/tests/snapshot`, `naga/tests/in`, and `naga/tests/out`
|
- Located in: `naga/tests/naga/snapshot`, `naga/tests/in`, and `naga/tests/out`
|
||||||
- Run with `cargo nextest run --test naga-test snapshots`
|
- Run with `cargo nextest run --test naga snapshots`
|
||||||
- Data driven snapshot tests for `naga`'s input/output.
|
- Data driven snapshot tests for `naga`'s input/output.
|
||||||
|
|
||||||
These tests are snapshot tests for `naga`s parsers and code generators.
|
These tests are snapshot tests for `naga`s parsers and code generators.
|
||||||
@ -118,8 +118,8 @@ will use the respective tool to validate the generated code.
|
|||||||
|
|
||||||
## `naga` SPIR-V Capabilities Tests
|
## `naga` SPIR-V Capabilities Tests
|
||||||
|
|
||||||
- Located in: `naga/tests/spirv_capabilities`
|
- Located in: `naga/tests/naga/spirv_capabilities`
|
||||||
- Run with `cargo nextest run --test naga-test spirv_capabilities`
|
- Run with `cargo nextest run --test naga spirv_capabilities`
|
||||||
- Uses the standard `#[test]` harness.
|
- Uses the standard `#[test]` harness.
|
||||||
|
|
||||||
These tests convert the given wgsl snippet to spirv and
|
These tests convert the given wgsl snippet to spirv and
|
||||||
@ -127,8 +127,8 @@ then assert that the spirv has enabled the expected capabilities.
|
|||||||
|
|
||||||
## `naga` Validation Tests
|
## `naga` Validation Tests
|
||||||
|
|
||||||
- Located in: `naga/tests/validation`
|
- Located in: `naga/tests/naga/validation`
|
||||||
- Run with `cargo nextest run --test naga-test validation`
|
- Run with `cargo nextest run --test naga validation`
|
||||||
|
|
||||||
These are hand rolled tests against the naga's validator.
|
These are hand rolled tests against the naga's validator.
|
||||||
If you don't need to test the validator with a custom module,
|
If you don't need to test the validator with a custom module,
|
||||||
@ -137,8 +137,8 @@ the [wgsl errors](#naga-wgsl-error-tests) tests.
|
|||||||
|
|
||||||
## `naga` WGSL Error Tests
|
## `naga` WGSL Error Tests
|
||||||
|
|
||||||
- Located in: `naga/tests/wgsl_errors`
|
- Located in: `naga/tests/naga/wgsl_errors`
|
||||||
- Run with `cargo nextest run --test naga-test wgsl_errors`
|
- Run with `cargo nextest run --test naga wgsl_errors`
|
||||||
|
|
||||||
These are tests for the error messages that the `wgsl` frontend
|
These are tests for the error messages that the `wgsl` frontend
|
||||||
produces. Additionally you can check that a given validation error
|
produces. Additionally you can check that a given validation error
|
||||||
@ -147,7 +147,7 @@ is produced by the validator from a given `wgsl` snippet.
|
|||||||
## `player` Tests
|
## `player` Tests
|
||||||
|
|
||||||
- Located in: `player/tests`
|
- Located in: `player/tests`
|
||||||
- Run with `cargo nextest run --test player-test`
|
- Run with `cargo nextest run --test player`
|
||||||
- Data driven tests using the `player`'s replay system.
|
- Data driven tests using the `player`'s replay system.
|
||||||
- `wgpu` integration tests.
|
- `wgpu` integration tests.
|
||||||
|
|
||||||
@ -161,9 +161,9 @@ These tests only run on your system's default GPU.
|
|||||||
|
|
||||||
## `wgpu` Compile Tests
|
## `wgpu` Compile Tests
|
||||||
|
|
||||||
- Located in: `tests/compile-tests`
|
- Located in: `tests/tests/wgpu-compile`
|
||||||
- Run with `cargo nextest run --test wgpu-compile-test`
|
- Run with `cargo nextest run --test wgpu-compile`
|
||||||
- `trybuild` tests of all rust files in `tests/compile-tests/fail` directory.
|
- `trybuild` tests of all rust files in `tests/tests/wgpu-compile/fail` directory.
|
||||||
|
|
||||||
These use the `trybuild` crate to test a few scenarios where
|
These use the `trybuild` crate to test a few scenarios where
|
||||||
the `wgpu` crate is expected to fail to compile. This mainly
|
the `wgpu` crate is expected to fail to compile. This mainly
|
||||||
@ -172,8 +172,8 @@ dropping passes, etc.
|
|||||||
|
|
||||||
## `wgpu` Dependency Tests
|
## `wgpu` Dependency Tests
|
||||||
|
|
||||||
- Located in: `tests/dependency-tests`
|
- Located in: `tests/tests/wgpu-dependency`
|
||||||
- Run with `cargo nextest run --test wgpu-dependency-test`
|
- Run with `cargo nextest run --test wgpu-dependency`
|
||||||
- Tests against `cargo tree`.
|
- Tests against `cargo tree`.
|
||||||
|
|
||||||
These tests ensure that the `wgpu` crate has the correct dependency
|
These tests ensure that the `wgpu` crate has the correct dependency
|
||||||
@ -184,8 +184,8 @@ This provides a way to ensure that our `toml` files are correct.
|
|||||||
|
|
||||||
## `wgpu` GPU Tests
|
## `wgpu` GPU Tests
|
||||||
|
|
||||||
- Located in: `tests/gpu-tests`
|
- Located in: `tests/tests/wgpu-gpu`
|
||||||
- Run with `cargo xtask test --test wgpu-gpu-test`
|
- Run with `cargo xtask test --test wgpu-gpu`
|
||||||
- Uses a custom `#[gpu_test]` harness.
|
- Uses a custom `#[gpu_test]` harness.
|
||||||
- `wgpu` integration tests, with access to `wgpu_test` helpers.
|
- `wgpu` integration tests, with access to `wgpu_test` helpers.
|
||||||
|
|
||||||
@ -209,8 +209,8 @@ See also the [example tests](#example-tests) for additional GPU tests.
|
|||||||
|
|
||||||
## `wgpu` Validation Tests
|
## `wgpu` Validation Tests
|
||||||
|
|
||||||
- Located in: `tests/validation-tests`
|
- Located in: `tests/tests/wgpu-validation`
|
||||||
- Run with `cargo nextest run --test wgpu-validation-test`
|
- Run with `cargo nextest run --test wgpu-validation`
|
||||||
- Use the standard `#[test]` harness.
|
- Use the standard `#[test]` harness.
|
||||||
- `wgpu` integration tests, with access to `wgpu_test` helpers.
|
- `wgpu` integration tests, with access to `wgpu_test` helpers.
|
||||||
|
|
||||||
|
|||||||
2
naga/.gitattributes
vendored
2
naga/.gitattributes
vendored
@ -1 +1 @@
|
|||||||
tests/out/**/* text eol=lf
|
tests/naga/out/**/* text eol=lf
|
||||||
|
|||||||
@ -9,7 +9,6 @@ keywords = ["shader", "SPIR-V", "GLSL", "MSL"]
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"]
|
exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
autotests = false
|
|
||||||
|
|
||||||
# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to
|
# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to
|
||||||
# copy the crates it actually uses out of the workspace, so it's meaningful for
|
# copy the crates it actually uses out of the workspace, so it's meaningful for
|
||||||
@ -17,10 +16,6 @@ autotests = false
|
|||||||
# whole, if their code permits. See `../README.md` for details.
|
# whole, if their code permits. See `../README.md` for details.
|
||||||
rust-version = "1.82.0"
|
rust-version = "1.82.0"
|
||||||
|
|
||||||
[[test]]
|
|
||||||
name = "naga-test"
|
|
||||||
path = "tests/root.rs"
|
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
|
|||||||
@ -12,19 +12,12 @@ rust-version.workspace = true
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "player"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
test = false
|
test = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "play"
|
name = "play"
|
||||||
path = "src/bin/play.rs"
|
|
||||||
test = false
|
test = false
|
||||||
|
|
||||||
[[test]]
|
|
||||||
name = "player-test"
|
|
||||||
path = "tests/root.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wgpu-types = { workspace = true, features = ["serde"] }
|
wgpu-types = { workspace = true, features = ["serde"] }
|
||||||
|
|
||||||
|
|||||||
@ -246,5 +246,5 @@ impl Corpus {
|
|||||||
fn test_api() {
|
fn test_api() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
Corpus::run_from(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/data/all.ron"))
|
Corpus::run_from(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/player/data/all.ron"))
|
||||||
}
|
}
|
||||||
@ -9,27 +9,22 @@ repository.workspace = true
|
|||||||
keywords.workspace = true
|
keywords.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
autotests = false
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "wgpu-compile-test"
|
name = "wgpu-compile"
|
||||||
path = "compile-tests/root.rs"
|
|
||||||
harness = true
|
harness = true
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "wgpu-dependency-test"
|
name = "wgpu-dependency"
|
||||||
path = "dependency-tests/root.rs"
|
|
||||||
harness = true
|
harness = true
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "wgpu-gpu-test"
|
name = "wgpu-gpu"
|
||||||
path = "gpu-tests/root.rs"
|
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "wgpu-validation-test"
|
name = "wgpu-validation"
|
||||||
path = "validation-tests/root.rs"
|
|
||||||
harness = true
|
harness = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 87 B After Width: | Height: | Size: 87 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user