Skip to content

Commit 710956c

Browse files
author
niklas
committed
tests: add pretest/nested variant fixture matrix
Expand the loop-continue shortcut regression to a wider fixture set: pre-test while (const/len), nested pre-test while (const/len), and two control variants (post-test loop and no-loop). The reproducer assertion now reports all offending fixtures, while control fixtures are asserted non-matching to guard detector specificity.
1 parent 81f6060 commit 710956c

5 files changed

Lines changed: 29 additions & 6 deletions
1.52 KB
Binary file not shown.
1.57 KB
Binary file not shown.
1.83 KB
Binary file not shown.
1.65 KB
Binary file not shown.

tests/regression_loop_continue_shortcut.rs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,23 @@ fn find_bad_loop_continue_shortcut_shape(blocks: &[Block]) -> bool {
180180

181181
#[test]
182182
fn no_loop_continue_shortcut_shape_after_lift() {
183-
let fixtures: [(&str, &[u8]); 2] = [
183+
let fixtures: [(&str, &[u8]); 4] = [
184184
(
185185
"loop-continue-shortcut.repro",
186186
include_bytes!("data/loop-continue-shortcut.repro.spvbin"),
187187
),
188+
(
189+
"loop-continue-shortcut-pretest-len.repro",
190+
include_bytes!("data/loop-continue-shortcut-pretest-len.repro.spvbin"),
191+
),
188192
(
189193
"loop-continue-shortcut-nested.repro",
190194
include_bytes!("data/loop-continue-shortcut-nested.repro.spvbin"),
191195
),
196+
(
197+
"loop-continue-shortcut-nested-len.repro",
198+
include_bytes!("data/loop-continue-shortcut-nested-len.repro.spvbin"),
199+
),
192200
];
193201

194202
let mut offenders = Vec::new();
@@ -207,10 +215,25 @@ fn no_loop_continue_shortcut_shape_after_lift() {
207215

208216
#[test]
209217
fn detector_does_not_trigger_on_non_loop_fixture() {
210-
let blocks = lifted_blocks_from_spv_fixture(include_bytes!("data/basic.frag.glsl.dbg.spvbin"));
218+
let fixtures: [(&str, &[u8]); 3] = [
219+
("basic.frag.glsl.dbg", include_bytes!("data/basic.frag.glsl.dbg.spvbin")),
220+
(
221+
"loop-continue-shortcut-control-posttest",
222+
include_bytes!("data/loop-continue-shortcut-control-posttest.spvbin"),
223+
),
224+
(
225+
"loop-continue-shortcut-control-noloop",
226+
include_bytes!("data/loop-continue-shortcut-control-noloop.spvbin"),
227+
),
228+
];
211229

212-
assert!(
213-
!find_bad_loop_continue_shortcut_shape(&blocks),
214-
"detector matched a non-loop fixture unexpectedly"
215-
);
230+
let mut offenders = Vec::new();
231+
for (name, spv_bytes) in fixtures {
232+
let blocks = lifted_blocks_from_spv_fixture(spv_bytes);
233+
if find_bad_loop_continue_shortcut_shape(&blocks) {
234+
offenders.push(name);
235+
}
236+
}
237+
238+
assert!(offenders.is_empty(), "detector matched control fixtures unexpectedly: {offenders:?}");
216239
}

0 commit comments

Comments
 (0)