diff --git a/tests/tests/buffer.rs b/tests/tests/buffer.rs index b0e264e8f9a..e2316daadce 100644 --- a/tests/tests/buffer.rs +++ b/tests/tests/buffer.rs @@ -354,16 +354,15 @@ static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfi let out_of_bounds = size.checked_add(wgpu::COPY_BUFFER_ALIGNMENT).unwrap(); - ctx.device.push_error_scope(wgpu::ErrorFilter::Validation); - ctx.device - .create_command_encoder(&Default::default()) - .clear_buffer(&buffer, out_of_bounds, None); - let err_msg = pollster::block_on(ctx.device.pop_error_scope()) - .unwrap() - .to_string(); - assert!(err_msg.contains( - "Clear of 20..20 would end up overrunning the bounds of the buffer of size 16" - )); + wgpu_test::fail( + &ctx.device, + || { + ctx.device + .create_command_encoder(&Default::default()) + .clear_buffer(&buffer, out_of_bounds, None) + }, + Some("Clear of 20..20 would end up overrunning the bounds of the buffer of size 16"), + ); }); #[gpu_test] @@ -381,19 +380,20 @@ static CLEAR_OFFSET_PLUS_SIZE_OUTSIDE_U64_BOUNDS: GpuTestConfiguration = let max_valid_offset = u64::MAX - (u64::MAX % wgpu::COPY_BUFFER_ALIGNMENT); let smallest_aligned_invalid_size = wgpu::COPY_BUFFER_ALIGNMENT; - ctx.device.push_error_scope(wgpu::ErrorFilter::Validation); - ctx.device - .create_command_encoder(&Default::default()) - .clear_buffer( - &buffer, - max_valid_offset, - Some(smallest_aligned_invalid_size), - ); - let err_msg = pollster::block_on(ctx.device.pop_error_scope()) - .unwrap() - .to_string(); - assert!(err_msg.contains(concat!( - "Clear starts at offset 18446744073709551612 with size of 4, ", - "but these added together exceed `u64::MAX`" - ))); + wgpu_test::fail( + &ctx.device, + || { + ctx.device + .create_command_encoder(&Default::default()) + .clear_buffer( + &buffer, + max_valid_offset, + Some(smallest_aligned_invalid_size), + ) + }, + Some(concat!( + "Clear starts at offset 18446744073709551612 with size of 4, ", + "but these added together exceed `u64::MAX`" + )), + ); });