test: migrate tests for specific validation err. msgs.

This commit is contained in:
Erich Gubler 2024-05-17 14:13:28 -04:00
parent 3b1e8da1b1
commit ccccffda19
2 changed files with 29 additions and 29 deletions

View File

@ -354,16 +354,15 @@ static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfi
let out_of_bounds = size.checked_add(wgpu::COPY_BUFFER_ALIGNMENT).unwrap(); let out_of_bounds = size.checked_add(wgpu::COPY_BUFFER_ALIGNMENT).unwrap();
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation); wgpu_test::fail(
&ctx.device,
|| {
ctx.device ctx.device
.create_command_encoder(&Default::default()) .create_command_encoder(&Default::default())
.clear_buffer(&buffer, out_of_bounds, None); .clear_buffer(&buffer, out_of_bounds, None)
let err_msg = pollster::block_on(ctx.device.pop_error_scope()) },
.unwrap() Some("Clear of 20..20 would end up overrunning the bounds of the buffer of size 16"),
.to_string(); );
assert!(err_msg.contains(
"Clear of 20..20 would end up overrunning the bounds of the buffer of size 16"
));
}); });
#[gpu_test] #[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 max_valid_offset = u64::MAX - (u64::MAX % wgpu::COPY_BUFFER_ALIGNMENT);
let smallest_aligned_invalid_size = wgpu::COPY_BUFFER_ALIGNMENT; let smallest_aligned_invalid_size = wgpu::COPY_BUFFER_ALIGNMENT;
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation); wgpu_test::fail(
&ctx.device,
|| {
ctx.device ctx.device
.create_command_encoder(&Default::default()) .create_command_encoder(&Default::default())
.clear_buffer( .clear_buffer(
&buffer, &buffer,
max_valid_offset, max_valid_offset,
Some(smallest_aligned_invalid_size), Some(smallest_aligned_invalid_size),
); )
let err_msg = pollster::block_on(ctx.device.pop_error_scope()) },
.unwrap() Some(concat!(
.to_string();
assert!(err_msg.contains(concat!(
"Clear starts at offset 18446744073709551612 with size of 4, ", "Clear starts at offset 18446744073709551612 with size of 4, ",
"but these added together exceed `u64::MAX`" "but these added together exceed `u64::MAX`"
))); )),
);
}); });

View File

@ -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.
}); });