Skip to content

Commit

Permalink
Add test case for #4167, marked as an expected failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblandy committed Sep 22, 2023
1 parent 85e2141 commit f81c3c5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/tests/pipeline.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use wasm_bindgen_test::*;
use wgpu_test::{fail, initialize_test, FailureCase, TestParameters};

#[test]
#[wasm_bindgen_test]
fn pipeline_default_layout_bad_module() {
// Create an invalid shader and a compute pipeline using it with a
// default bindgroup layout, and then ask for its layout.
// Validation should fail but there should be not panic.
let parameters = TestParameters::default()
// https://github.com/gfx-rs/wgpu/issues/4167
.expect_fail(FailureCase::always());
initialize_test(parameters, |ctx| {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);

fail(&ctx.device, || {
let module = ctx
.device
.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl("not valid wgsl".into()),
});

let pipeline = ctx
.device
.create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
label: Some("mandelbrot compute pipeline"),
layout: None,
module: &module,
entry_point: "doesn't exist",
});

pipeline.get_bind_group_layout(0);
});
});
}
1 change: 1 addition & 0 deletions tests/tests/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod external_texture;
mod instance;
mod occlusion_query;
mod partially_bounded_arrays;
mod pipeline;
mod poll;
mod query_set;
mod queue_transfer;
Expand Down

0 comments on commit f81c3c5

Please sign in to comment.