wgpu/tests/tests/wgpu-gpu/query_set.rs
Kevin Reid 02700ab162
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.
2025-03-31 21:17:05 -04:00

24 lines
902 B
Rust

use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters};
#[gpu_test]
static DROP_FAILED_TIMESTAMP_QUERY_SET: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.run_sync(|ctx| {
// Enter an error scope, so the validation catch-all doesn't
// report the error too early.
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
// Creating this query set should fail, since we didn't include
// TIMESTAMP_QUERY in our required features.
let bad_query_set = ctx.device.create_query_set(&wgpu::QuerySetDescriptor {
label: Some("doomed query set"),
ty: wgpu::QueryType::Timestamp,
count: 1,
});
// Dropping this should not panic.
drop(bad_query_set);
assert!(pollster::block_on(ctx.device.pop_error_scope()).is_some());
});