From 2e73e486570e62171058bbfe88a69f2de50997ad Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 28 Sep 2021 10:42:26 -0700 Subject: [PATCH] When writing snapshots, reliably identify which writer has failed. (#1427) --- tests/snapshots.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/snapshots.rs b/tests/snapshots.rs index cecf8a4fc7..102a4864f9 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -130,7 +130,7 @@ fn check_targets(module: &naga::Module, name: &str, targets: Targets) { let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all(), capabilities) .validate(module) - .unwrap(); + .expect("Naga module validation failed"); #[cfg(feature = "serialize")] { @@ -193,6 +193,7 @@ fn write_output_spv( use naga::back::spv; use rspirv::binary::Disassemble; + println!("writing SPIR-V"); let mut flags = spv::WriterFlags::LABEL_VARYINGS; flags.set(spv::WriterFlags::DEBUG, params.spv.debug); flags.set( @@ -257,6 +258,8 @@ fn write_output_msl( ) { use naga::back::msl; + println!("writing MSL"); + #[cfg_attr(feature = "deserialize", allow(unused_variables))] let default_options = msl::Options::default(); #[cfg(feature = "deserialize")] @@ -297,6 +300,8 @@ fn write_output_glsl( ) { use naga::back::glsl; + println!("writing GLSL"); + #[cfg_attr(feature = "deserialize", allow(unused_variables))] let default_options = glsl::Options::default(); #[cfg(feature = "deserialize")] @@ -337,6 +342,8 @@ fn write_output_hlsl( use naga::back::hlsl; use std::fmt::Write; + println!("writing HLSL"); + #[cfg_attr(feature = "deserialize", allow(unused_variables))] let default_options = hlsl::Options::default(); #[cfg(feature = "deserialize")] @@ -424,6 +431,8 @@ fn write_output_wgsl( ) { use naga::back::wgsl; + println!("writing WGSL"); + let string = wgsl::write_string(module, info).expect("WGSL write failed"); fs::write(destination.join(format!("wgsl/{}.wgsl", file_name)), string).unwrap();