writer/spirv: Return error message in Disassemble Instead of printf-ing and returning an empty string. When there's a lot of other test output, it can be really hard to actually spot the error message. With the error being returned, this will likely appear in a EXPECT_EQ() style error message. Change-Id: I733741a68de4843e986037c5e309c5a4c3d66124 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49522 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/writer/spirv/spv_dump.cc b/src/writer/spirv/spv_dump.cc index 1b7f5ed..1f343bb 100644 --- a/src/writer/spirv/spv_dump.cc +++ b/src/writer/spirv/spv_dump.cc
@@ -54,7 +54,7 @@ std::string result; if (!tools.Disassemble(data, &result, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)) { - printf("%s\n", spv_errors.c_str()); + return "*** Invalid SPIR-V ***\n" + spv_errors; } return result; }