Skip to content

Commit c8400cb

Browse files
committed
Error on empty output
1 parent 9c35c5d commit c8400cb

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/difftests/src/main.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ fn main() {
11751175
test_type: tester::TestType::UnitTest,
11761176
},
11771177
testfn: tester::TestFn::DynTestFn(Box::new(move || {
1178-
// Run WGSL test.
1178+
// Run WGSL side of the test.
11791179
let runner = get_runner(lib_clone.pipeline_type);
11801180
let out_wgsl = runner
11811181
.run(
@@ -1187,9 +1187,10 @@ fn main() {
11871187
&lib_clone.path,
11881188
)
11891189
.expect("WGSL run failed");
1190-
// Compile shaders to Rust (formerly spirv).
1190+
// Compile Rust to SpirV.
11911191
let rust_shaders =
11921192
compile_spirv_shaders(&lib_clone).expect("Failed to compile SPIR-V shaders");
1193+
// Run Rust side of the test.
11931194
let out_rust = runner
11941195
.run(
11951196
&device,
@@ -1202,6 +1203,17 @@ fn main() {
12021203
.expect("Rust run failed");
12031204
let data_wgsl = fs::read(&out_wgsl).expect("Failed to read WGSL output file");
12041205
let data_rust = fs::read(&out_rust).expect("Failed to read Rust output file");
1206+
1207+
// Fail if any output is empty.
1208+
if data_wgsl.is_empty() || data_rust.is_empty() {
1209+
panic!(
1210+
"Empty output for {}: WGSL: {} bytes, Rust: {} bytes. Likely a bug in the test or harness.",
1211+
test_name,
1212+
data_wgsl.len(),
1213+
data_rust.len()
1214+
);
1215+
}
1216+
12051217
if data_wgsl != data_rust {
12061218
panic!(
12071219
"Output mismatch for {}:\nWGSL output: {:?}\nRust output: {:?}",

0 commit comments

Comments
 (0)