Skip to content

Commit ccccffd

Browse files
test: migrate tests for specific validation err. msgs.
1 parent 3b1e8da commit ccccffd

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

tests/tests/buffer.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,15 @@ static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfi
354354

355355
let out_of_bounds = size.checked_add(wgpu::COPY_BUFFER_ALIGNMENT).unwrap();
356356

357-
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
358-
ctx.device
359-
.create_command_encoder(&Default::default())
360-
.clear_buffer(&buffer, out_of_bounds, None);
361-
let err_msg = pollster::block_on(ctx.device.pop_error_scope())
362-
.unwrap()
363-
.to_string();
364-
assert!(err_msg.contains(
365-
"Clear of 20..20 would end up overrunning the bounds of the buffer of size 16"
366-
));
357+
wgpu_test::fail(
358+
&ctx.device,
359+
|| {
360+
ctx.device
361+
.create_command_encoder(&Default::default())
362+
.clear_buffer(&buffer, out_of_bounds, None)
363+
},
364+
Some("Clear of 20..20 would end up overrunning the bounds of the buffer of size 16"),
365+
);
367366
});
368367

369368
#[gpu_test]
@@ -381,19 +380,20 @@ static CLEAR_OFFSET_PLUS_SIZE_OUTSIDE_U64_BOUNDS: GpuTestConfiguration =
381380
let max_valid_offset = u64::MAX - (u64::MAX % wgpu::COPY_BUFFER_ALIGNMENT);
382381
let smallest_aligned_invalid_size = wgpu::COPY_BUFFER_ALIGNMENT;
383382

384-
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
385-
ctx.device
386-
.create_command_encoder(&Default::default())
387-
.clear_buffer(
388-
&buffer,
389-
max_valid_offset,
390-
Some(smallest_aligned_invalid_size),
391-
);
392-
let err_msg = pollster::block_on(ctx.device.pop_error_scope())
393-
.unwrap()
394-
.to_string();
395-
assert!(err_msg.contains(concat!(
396-
"Clear starts at offset 18446744073709551612 with size of 4, ",
397-
"but these added together exceed `u64::MAX`"
398-
)));
383+
wgpu_test::fail(
384+
&ctx.device,
385+
|| {
386+
ctx.device
387+
.create_command_encoder(&Default::default())
388+
.clear_buffer(
389+
&buffer,
390+
max_valid_offset,
391+
Some(smallest_aligned_invalid_size),
392+
)
393+
},
394+
Some(concat!(
395+
"Clear starts at offset 18446744073709551612 with size of 4, ",
396+
"but these added together exceed `u64::MAX`"
397+
)),
398+
);
399399
});

tests/tests/pipeline.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ static NO_TARGETLESS_RENDER: GpuTestConfiguration = GpuTestConfiguration::new()
8282
});
8383
}
8484
},
85-
None,
85+
Some(concat!(
86+
"At least one color attachment or depth-stencil attachment was expected, ",
87+
"but no render target for the pipeline was specified."
88+
)),
8689
)
87-
// TODO: concrete error message:
88-
// At least one color attachment or depth-stencil attachment was expected, but no
89-
// render target for the pipeline was specified.
9090
});

0 commit comments

Comments
 (0)