fuzzers: Don't drop writter errors on the floor
A writer shouldn't error. If the input is invalid, then this should be caught by the parser or resolver. Fail the test if the writer errors. Change-Id: I89da602dc96fa7be2a8efa288a90310a61745124 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58389 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Vasyl Teliman <vasniktel@gmail.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
86dc88725a
commit
50b6d024d6
|
@ -326,8 +326,8 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||||
auto result = writer::wgsl::Generate(&program, options);
|
auto result = writer::wgsl::Generate(&program, options);
|
||||||
generated_wgsl_ = std::move(result.wgsl);
|
generated_wgsl_ = std::move(result.wgsl);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errors_ = result.error;
|
FatalError(program.Diagnostics(),
|
||||||
return 0;
|
"WGSL writer failed: " + result.error);
|
||||||
}
|
}
|
||||||
#endif // TINT_BUILD_WGSL_WRITER
|
#endif // TINT_BUILD_WGSL_WRITER
|
||||||
break;
|
break;
|
||||||
|
@ -338,8 +338,8 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||||
auto result = writer::spirv::Generate(&program, options);
|
auto result = writer::spirv::Generate(&program, options);
|
||||||
generated_spirv_ = std::move(result.spirv);
|
generated_spirv_ = std::move(result.spirv);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errors_ = result.error;
|
FatalError(program.Diagnostics(),
|
||||||
return 0;
|
"SPIR-V writer failed: " + result.error);
|
||||||
}
|
}
|
||||||
if (!SPIRVToolsValidationCheck(program, generated_spirv_)) {
|
if (!SPIRVToolsValidationCheck(program, generated_spirv_)) {
|
||||||
FatalError(program.Diagnostics(),
|
FatalError(program.Diagnostics(),
|
||||||
|
@ -355,8 +355,8 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||||
auto result = writer::hlsl::Generate(&program, options);
|
auto result = writer::hlsl::Generate(&program, options);
|
||||||
generated_hlsl_ = std::move(result.hlsl);
|
generated_hlsl_ = std::move(result.hlsl);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errors_ = result.error;
|
FatalError(program.Diagnostics(),
|
||||||
return 0;
|
"HLSL writer failed: " + result.error);
|
||||||
}
|
}
|
||||||
#endif // TINT_BUILD_HLSL_WRITER
|
#endif // TINT_BUILD_HLSL_WRITER
|
||||||
break;
|
break;
|
||||||
|
@ -367,8 +367,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||||
auto result = writer::msl::Generate(&program, options);
|
auto result = writer::msl::Generate(&program, options);
|
||||||
generated_msl_ = std::move(result.msl);
|
generated_msl_ = std::move(result.msl);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errors_ = result.error;
|
FatalError(program.Diagnostics(), "MSL writer failed: " + result.error);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif // TINT_BUILD_MSL_WRITER
|
#endif // TINT_BUILD_MSL_WRITER
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue