Update remaining fuzzers to use TransforBuilder

Missed some fuzzers in my last fix, because I was trying to git grep
between repos...

This should fix any outstanding issues with
NULL being passed into SetTransformManager in TintCommonFuzzer.

BUG=chromium:1255313

Change-Id: Idf71bc34bb75041accec303df3da0bc6f9cd15cc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65940
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ryan Harrison 2021-10-05 19:19:26 +00:00 committed by Tint LUCI CQ
parent ceab140a8b
commit 71763c84c2
3 changed files with 12 additions and 11 deletions

View File

@ -20,6 +20,7 @@
#include "fuzzers/tint_ast_fuzzer/mutator.h" #include "fuzzers/tint_ast_fuzzer/mutator.h"
#include "fuzzers/tint_ast_fuzzer/override_cli_params.h" #include "fuzzers/tint_ast_fuzzer/override_cli_params.h"
#include "fuzzers/tint_common_fuzzer.h" #include "fuzzers/tint_common_fuzzer.h"
#include "fuzzers/transform_builder.h"
#include "src/reader/wgsl/parser.h" #include "src/reader/wgsl/parser.h"
#include "src/writer/wgsl/generator.h" #include "src/writer/wgsl/generator.h"
@ -109,13 +110,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
continue; continue;
} }
transform::Manager transform_manager; TransformBuilder tb(data, size);
transform::DataMap transform_inputs; tb.AddTransform<tint::transform::Robustness>();
transform_manager.Add<transform::Robustness>();
CommonFuzzer fuzzer(InputFormat::kWGSL, target.output_format); CommonFuzzer fuzzer(InputFormat::kWGSL, target.output_format);
fuzzer.EnableInspector(); fuzzer.EnableInspector();
fuzzer.SetTransformManager(&transform_manager, &transform_inputs); fuzzer.SetTransformManager(tb.manager(), tb.data_map());
fuzzer.Run(data, size); fuzzer.Run(data, size);
if (fuzzer.HasErrors()) { if (fuzzer.HasErrors()) {

View File

@ -21,6 +21,7 @@
#include "fuzzers/tint_regex_fuzzer/cli.h" #include "fuzzers/tint_regex_fuzzer/cli.h"
#include "fuzzers/tint_regex_fuzzer/override_cli_params.h" #include "fuzzers/tint_regex_fuzzer/override_cli_params.h"
#include "fuzzers/tint_regex_fuzzer/wgsl_mutator.h" #include "fuzzers/tint_regex_fuzzer/wgsl_mutator.h"
#include "fuzzers/transform_builder.h"
#include "src/reader/wgsl/parser.h" #include "src/reader/wgsl/parser.h"
#include "src/writer/wgsl/generator.h" #include "src/writer/wgsl/generator.h"
@ -137,13 +138,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
continue; continue;
} }
transform::Manager transform_manager; TransformBuilder tb(data, size);
transform::DataMap transform_inputs; tb.AddTransform<tint::transform::Robustness>();
transform_manager.Add<transform::Robustness>();
CommonFuzzer fuzzer(InputFormat::kWGSL, target.output_format); CommonFuzzer fuzzer(InputFormat::kWGSL, target.output_format);
fuzzer.EnableInspector(); fuzzer.EnableInspector();
fuzzer.SetTransformManager(&transform_manager, &transform_inputs); fuzzer.SetTransformManager(tb.manager(), tb.data_map());
fuzzer.Run(data, size); fuzzer.Run(data, size);
} }

View File

@ -14,16 +14,17 @@
#include "fuzzers/fuzzer_init.h" #include "fuzzers/fuzzer_init.h"
#include "fuzzers/tint_common_fuzzer.h" #include "fuzzers/tint_common_fuzzer.h"
#include "fuzzers/transform_builder.h"
namespace tint { namespace tint {
namespace fuzzers { namespace fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
tint::transform::Manager transform_manager; TransformBuilder tb(data, size);
transform_manager.Add<tint::transform::Robustness>(); tb.AddTransform<tint::transform::Robustness>();
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kWGSL); tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kWGSL);
fuzzer.SetTransformManager(&transform_manager, {}); fuzzer.SetTransformManager(tb.manager(), tb.data_map());
fuzzer.SetDumpInput(GetCliParams().dump_input); fuzzer.SetDumpInput(GetCliParams().dump_input);
return fuzzer.Run(data, size); return fuzzer.Run(data, size);