Add robustness pass to ast and regex fuzzers

Fixed: tint:1104
Change-Id: I4ea3aa283c1c4b5e55f507dbc104b21c8bedb63b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61521
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: James Price <jrprice@google.com>
This commit is contained in:
Ryan Harrison 2021-08-11 13:02:45 +00:00 committed by Tint LUCI CQ
parent bfb27f00d7
commit 5085efb748
3 changed files with 13 additions and 1 deletions

View File

@ -105,8 +105,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
continue; continue;
} }
transform::Manager transform_manager;
transform::DataMap transform_inputs;
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, std::move(transform_inputs));
fuzzer.Run(data, size); fuzzer.Run(data, size);
if (fuzzer.HasErrors()) { if (fuzzer.HasErrors()) {
std::cout << "Fuzzing " << target.name << " produced an error" std::cout << "Fuzzing " << target.name << " produced an error"

View File

@ -127,8 +127,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
continue; continue;
} }
transform::Manager transform_manager;
transform::DataMap transform_inputs;
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, std::move(transform_inputs));
fuzzer.Run(data, size); fuzzer.Run(data, size);
} }

View File

@ -97,7 +97,7 @@ void ReplaceRegion(size_t idx1,
/// Replaces an interval of length interval1_len starting at start_index /// Replaces an interval of length interval1_len starting at start_index
/// with the interval interval2. /// with the interval interval2.
/// @param start_index - starting position of the interval to be replaced. /// @param start_index - starting position of the interval to be replaced.
/// @param interval1_len - length of the interval to be replaced. /// @param length - length of the interval to be replaced.
/// @param replacement_text - the interval that will be used as a replacement. /// @param replacement_text - the interval that will be used as a replacement.
/// @param wgsl_code - the WGSL-like string where the replacement will occur. /// @param wgsl_code - the WGSL-like string where the replacement will occur.
void ReplaceInterval(size_t start_index, void ReplaceInterval(size_t start_index,