Skip to content

Commit 7b9d7c3

Browse files
committed
Label no-op supporting tests
1 parent 92a2563 commit 7b9d7c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+682
-497
lines changed

naga/tests/naga/example_wgsl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{ffi::OsStr, fs, path::Path};
66
/// Runs through all example shaders and ensures they are valid wgsl.
77
// While we _can_ run this test under miri, it is extremely slow (>5 minutes),
88
// and naga isn't the primary target for miri testing, so we disable it.
9-
#[cfg(not(miri))]
9+
#[cfg_attr(miri, ignore)]
1010
#[test]
1111
pub fn parse_example_wgsl() {
1212
let example_path = Path::new(env!("CARGO_MANIFEST_DIR"))

naga/tests/naga/snapshots.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,8 @@ fn write_output_wgsl(
820820

821821
// While we _can_ run this test under miri, it is extremely slow (>5 minutes),
822822
// and naga isn't the primary target for miri testing, so we disable it.
823-
#[cfg(all(feature = "wgsl-in", not(miri)))]
823+
#[cfg(feature = "wgsl-in")]
824+
#[cfg_attr(miri, ignore)]
824825
#[test]
825826
fn convert_snapshots_wgsl() {
826827
let _ = env_logger::try_init();
@@ -846,7 +847,8 @@ fn convert_snapshots_wgsl() {
846847
}
847848

848849
// miri doesn't allow us to shell out to `spirv-as`
849-
#[cfg(all(feature = "spv-in", not(miri)))]
850+
#[cfg(feature = "spv-in")]
851+
#[cfg_attr(miri, ignore)]
850852
#[test]
851853
fn convert_snapshots_spv() {
852854
use std::process::Command;
@@ -897,7 +899,8 @@ fn convert_snapshots_spv() {
897899

898900
// While we _can_ run this test under miri, it is extremely slow (>5 minutes),
899901
// and naga isn't the primary target for miri testing, so we disable it.
900-
#[cfg(all(feature = "glsl-in", not(miri)))]
902+
#[cfg(feature = "glsl-in")]
903+
#[cfg_attr(miri, ignore)]
901904
#[allow(unused_variables)]
902905
#[test]
903906
fn convert_snapshots_glsl() {

player/tests/player/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl Corpus {
242242
}
243243
}
244244

245-
#[cfg(not(miri))]
245+
#[cfg_attr(miri, ignore)]
246246
#[test]
247247
fn test_api() {
248248
env_logger::init();

tests/tests/wgpu-compile/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#![cfg(not(miri))]
21
// Tests that ensure that various constructs that should not compile do not compile.
32

3+
#[cfg_attr(miri, ignore)]
44
#[test]
55
fn compile_fail() {
66
let t = trybuild::TestCases::new();

tests/tests/wgpu-gpu/bind_group_layout_dedup.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ const ENTRY: wgpu::BindGroupLayoutEntry = wgpu::BindGroupLayoutEntry {
4040

4141
#[gpu_test]
4242
static BIND_GROUP_LAYOUT_DEDUPLICATION: GpuTestConfiguration = GpuTestConfiguration::new()
43-
.parameters(TestParameters::default().test_features_limits())
43+
.parameters(
44+
TestParameters::default()
45+
.test_features_limits()
46+
.enable_noop(),
47+
)
4448
.run_async(bgl_dedupe);
4549

4650
async fn bgl_dedupe(ctx: TestingContext) {
@@ -120,7 +124,11 @@ async fn bgl_dedupe(ctx: TestingContext) {
120124
#[gpu_test]
121125
static BIND_GROUP_LAYOUT_DEDUPLICATION_WITH_DROPPED_USER_HANDLE: GpuTestConfiguration =
122126
GpuTestConfiguration::new()
123-
.parameters(TestParameters::default().test_features_limits())
127+
.parameters(
128+
TestParameters::default()
129+
.test_features_limits()
130+
.enable_noop(),
131+
)
124132
.run_sync(bgl_dedupe_with_dropped_user_handle);
125133

126134
// https://github.com/gfx-rs/wgpu/issues/4824
@@ -203,7 +211,11 @@ fn bgl_dedupe_with_dropped_user_handle(ctx: TestingContext) {
203211

204212
#[gpu_test]
205213
static GET_DERIVED_BGL: GpuTestConfiguration = GpuTestConfiguration::new()
206-
.parameters(TestParameters::default().test_features_limits())
214+
.parameters(
215+
TestParameters::default()
216+
.test_features_limits()
217+
.enable_noop(),
218+
)
207219
.run_sync(get_derived_bgl);
208220

209221
fn get_derived_bgl(ctx: TestingContext) {
@@ -277,7 +289,11 @@ fn get_derived_bgl(ctx: TestingContext) {
277289
#[gpu_test]
278290
static SEPARATE_PIPELINES_HAVE_INCOMPATIBLE_DERIVED_BGLS: GpuTestConfiguration =
279291
GpuTestConfiguration::new()
280-
.parameters(TestParameters::default().test_features_limits())
292+
.parameters(
293+
TestParameters::default()
294+
.test_features_limits()
295+
.enable_noop(),
296+
)
281297
.run_sync(separate_pipelines_have_incompatible_derived_bgls);
282298

283299
fn separate_pipelines_have_incompatible_derived_bgls(ctx: TestingContext) {
@@ -341,7 +357,11 @@ fn separate_pipelines_have_incompatible_derived_bgls(ctx: TestingContext) {
341357
#[gpu_test]
342358
static DERIVED_BGLS_INCOMPATIBLE_WITH_REGULAR_BGLS: GpuTestConfiguration =
343359
GpuTestConfiguration::new()
344-
.parameters(TestParameters::default().test_features_limits())
360+
.parameters(
361+
TestParameters::default()
362+
.test_features_limits()
363+
.enable_noop(),
364+
)
345365
.run_sync(derived_bgls_incompatible_with_regular_bgls);
346366

347367
fn derived_bgls_incompatible_with_regular_bgls(ctx: TestingContext) {
@@ -412,7 +432,11 @@ fn derived_bgls_incompatible_with_regular_bgls(ctx: TestingContext) {
412432

413433
#[gpu_test]
414434
static BIND_GROUP_LAYOUT_DEDUPLICATION_DERIVED: GpuTestConfiguration = GpuTestConfiguration::new()
415-
.parameters(TestParameters::default().test_features_limits())
435+
.parameters(
436+
TestParameters::default()
437+
.test_features_limits()
438+
.enable_noop(),
439+
)
416440
.run_sync(bgl_dedupe_derived);
417441

418442
fn bgl_dedupe_derived(ctx: TestingContext) {

tests/tests/wgpu-gpu/bind_groups.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,15 @@ static MULTIPLE_BINDINGS_WITH_DIFFERENT_SIZES: GpuTestConfiguration = GpuTestCon
176176
.parameters(
177177
TestParameters::default()
178178
.limits(wgpu::Limits::downlevel_defaults())
179-
.expect_fail(FailureCase::always()), // https://github.com/gfx-rs/wgpu/issues/7359
179+
.expect_fail(FailureCase::always())
180+
.enable_noop(), // https://github.com/gfx-rs/wgpu/issues/7359
180181
)
181182
.run_sync(multiple_bindings_with_differing_sizes);
182183

183184
#[gpu_test]
184185
static BIND_GROUP_NONFILTERING_LAYOUT_NONFILTERING_SAMPLER: GpuTestConfiguration =
185186
GpuTestConfiguration::new()
186-
.parameters(TestParameters::default())
187+
.parameters(TestParameters::default().enable_noop())
187188
.run_sync(|ctx| {
188189
try_sampler_nonfiltering_layout(
189190
ctx,
@@ -201,7 +202,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_NONFILTERING_SAMPLER: GpuTestConfiguration
201202
#[gpu_test]
202203
static BIND_GROUP_NONFILTERING_LAYOUT_MIN_SAMPLER: GpuTestConfiguration =
203204
GpuTestConfiguration::new()
204-
.parameters(TestParameters::default())
205+
.parameters(TestParameters::default().enable_noop())
205206
.run_sync(|ctx| {
206207
try_sampler_nonfiltering_layout(
207208
ctx,
@@ -219,7 +220,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MIN_SAMPLER: GpuTestConfiguration =
219220
#[gpu_test]
220221
static BIND_GROUP_NONFILTERING_LAYOUT_MAG_SAMPLER: GpuTestConfiguration =
221222
GpuTestConfiguration::new()
222-
.parameters(TestParameters::default())
223+
.parameters(TestParameters::default().enable_noop())
223224
.run_sync(|ctx| {
224225
try_sampler_nonfiltering_layout(
225226
ctx,
@@ -237,7 +238,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MAG_SAMPLER: GpuTestConfiguration =
237238
#[gpu_test]
238239
static BIND_GROUP_NONFILTERING_LAYOUT_MIPMAP_SAMPLER: GpuTestConfiguration =
239240
GpuTestConfiguration::new()
240-
.parameters(TestParameters::default())
241+
.parameters(TestParameters::default().enable_noop())
241242
.run_sync(|ctx| {
242243
try_sampler_nonfiltering_layout(
243244
ctx,

tests/tests/wgpu-gpu/buffer.rs

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -95,78 +95,84 @@ async fn test_empty_buffer_range(ctx: &TestingContext, buffer_size: u64, label:
9595

9696
#[gpu_test]
9797
static EMPTY_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new()
98-
.parameters(TestParameters::default().expect_fail(FailureCase::always()))
98+
.parameters(
99+
TestParameters::default()
100+
.expect_fail(FailureCase::always())
101+
.enable_noop(),
102+
)
99103
.run_async(|ctx| async move {
100104
test_empty_buffer_range(&ctx, 2048, "regular buffer").await;
101105
test_empty_buffer_range(&ctx, 0, "zero-sized buffer").await;
102106
});
103107

104108
#[gpu_test]
105-
static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move {
106-
// This test writes 16 bytes at the beginning of buffer mapped mapped with
107-
// an offset of 32 bytes. Then the buffer is copied into another buffer that
108-
// is read back and we check that the written bytes are correctly placed at
109-
// offset 32..48.
110-
// The goal is to check that get_mapped_range did not accidentally double-count
111-
// the mapped offset.
112-
113-
let write_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
114-
label: None,
115-
size: 256,
116-
usage: wgpu::BufferUsages::MAP_WRITE | wgpu::BufferUsages::COPY_SRC,
117-
mapped_at_creation: false,
118-
});
119-
let read_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
120-
label: None,
121-
size: 256,
122-
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST,
123-
mapped_at_creation: false,
124-
});
125-
126-
write_buf
127-
.slice(32..)
128-
.map_async(wgpu::MapMode::Write, move |result| {
129-
result.unwrap();
109+
static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new()
110+
.parameters(TestParameters::default().enable_noop())
111+
.run_async(|ctx| async move {
112+
// This test writes 16 bytes at the beginning of buffer mapped mapped with
113+
// an offset of 32 bytes. Then the buffer is copied into another buffer that
114+
// is read back and we check that the written bytes are correctly placed at
115+
// offset 32..48.
116+
// The goal is to check that get_mapped_range did not accidentally double-count
117+
// the mapped offset.
118+
119+
let write_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
120+
label: None,
121+
size: 256,
122+
usage: wgpu::BufferUsages::MAP_WRITE | wgpu::BufferUsages::COPY_SRC,
123+
mapped_at_creation: false,
124+
});
125+
let read_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
126+
label: None,
127+
size: 256,
128+
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST,
129+
mapped_at_creation: false,
130130
});
131131

132-
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
132+
write_buf
133+
.slice(32..)
134+
.map_async(wgpu::MapMode::Write, move |result| {
135+
result.unwrap();
136+
});
133137

134-
{
135-
let slice = write_buf.slice(32..48);
136-
let mut view = slice.get_mapped_range_mut();
137-
for byte in &mut view[..] {
138-
*byte = 2;
138+
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
139+
140+
{
141+
let slice = write_buf.slice(32..48);
142+
let mut view = slice.get_mapped_range_mut();
143+
for byte in &mut view[..] {
144+
*byte = 2;
145+
}
139146
}
140-
}
141147

142-
write_buf.unmap();
148+
write_buf.unmap();
143149

144-
let mut encoder = ctx
145-
.device
146-
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
150+
let mut encoder = ctx
151+
.device
152+
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
147153

148-
encoder.copy_buffer_to_buffer(&write_buf, 0, &read_buf, 0, 256);
154+
encoder.copy_buffer_to_buffer(&write_buf, 0, &read_buf, 0, 256);
149155

150-
ctx.queue.submit(Some(encoder.finish()));
156+
ctx.queue.submit(Some(encoder.finish()));
151157

152-
read_buf
153-
.slice(..)
154-
.map_async(wgpu::MapMode::Read, Result::unwrap);
158+
read_buf
159+
.slice(..)
160+
.map_async(wgpu::MapMode::Read, Result::unwrap);
155161

156-
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
162+
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
157163

158-
let slice = read_buf.slice(..);
159-
let view = slice.get_mapped_range();
160-
for byte in &view[0..32] {
161-
assert_eq!(*byte, 0);
162-
}
163-
for byte in &view[32..48] {
164-
assert_eq!(*byte, 2);
165-
}
166-
for byte in &view[48..] {
167-
assert_eq!(*byte, 0);
168-
}
169-
});
164+
let slice = read_buf.slice(..);
165+
let view = slice.get_mapped_range();
166+
for byte in &view[0..32] {
167+
assert_eq!(*byte, 0);
168+
}
169+
for byte in &view[32..48] {
170+
assert_eq!(*byte, 2);
171+
}
172+
for byte in &view[48..] {
173+
assert_eq!(*byte, 0);
174+
}
175+
});
170176

171177
/// The WebGPU algorithm [validating shader binding][vsb] requires
172178
/// implementations to check that buffer bindings are large enough to
@@ -177,7 +183,7 @@ static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new().run_async(
177183
/// 16 for that variable's group/index. Pipeline creation should fail.
178184
#[gpu_test]
179185
static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfiguration::new()
180-
.parameters(TestParameters::default().test_features_limits())
186+
.parameters(TestParameters::default().test_features_limits().enable_noop())
181187
.run_sync(|ctx| {
182188
// Create a shader module that statically uses a storage buffer.
183189
let shader_module = ctx
@@ -247,7 +253,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfigu
247253
/// binding. Command recording should fail.
248254
#[gpu_test]
249255
static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfiguration::new()
250-
.parameters(TestParameters::default().test_features_limits())
256+
.parameters(TestParameters::default().test_features_limits().enable_noop())
251257
.run_sync(|ctx| {
252258
// This test tries to use a bindgroup layout with a
253259
// min_binding_size of 16 to an index whose WGSL type requires 32
@@ -344,7 +350,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfi
344350

345351
#[gpu_test]
346352
static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfiguration::new()
347-
.parameters(TestParameters::default())
353+
.parameters(TestParameters::default().enable_noop())
348354
.run_sync(|ctx| {
349355
let size = 16;
350356

@@ -370,7 +376,7 @@ static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfi
370376
#[gpu_test]
371377
static CLEAR_OFFSET_PLUS_SIZE_OUTSIDE_U64_BOUNDS: GpuTestConfiguration =
372378
GpuTestConfiguration::new()
373-
.parameters(TestParameters::default())
379+
.parameters(TestParameters::default().enable_noop())
374380
.run_sync(|ctx| {
375381
let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
376382
label: None,

0 commit comments

Comments
 (0)