From ccccffda1954485c6aab25d1cdfb360079ba0f72 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 17 May 2024 14:13:28 -0400 Subject: [PATCH] test: migrate tests for specific validation err. msgs. --- tests/tests/buffer.rs | 50 ++++++++++++++++++++--------------------- tests/tests/pipeline.rs | 8 +++---- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/tests/buffer.rs b/tests/tests/buffer.rs index b0e264e8f..e2316daad 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`" + )), + ); }); diff --git a/tests/tests/pipeline.rs b/tests/tests/pipeline.rs index 4d481ecbd..99d0e8da4 100644 --- a/tests/tests/pipeline.rs +++ b/tests/tests/pipeline.rs @@ -82,9 +82,9 @@ static NO_TARGETLESS_RENDER: GpuTestConfiguration = GpuTestConfiguration::new() }); } }, - None, + Some(concat!( + "At least one color attachment or depth-stencil attachment was expected, ", + "but no render target for the pipeline was specified." + )), ) - // TODO: concrete error message: - // At least one color attachment or depth-stencil attachment was expected, but no - // render target for the pipeline was specified. });