Add fuzzing for transform::CanonicalizeEntryPointIO
BUG=tint:722
Change-Id: Id6ca2a8c5b807c84658969a09ca75281f62221d1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49381
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/fuzzers/BUILD.gn b/fuzzers/BUILD.gn
index f8cbaab..7de9983 100644
--- a/fuzzers/BUILD.gn
+++ b/fuzzers/BUILD.gn
@@ -81,6 +81,11 @@
deps = [ ":tint_fuzzer_common" ]
}
+ fuzzer_test("tint_canonicalize_entry_point_io_fuzzer") {
+ sources = [ "tint_canonicalize_entry_point_io_fuzzer.cc" ]
+ deps = [ ":tint_fuzzer_common" ]
+ }
+
fuzzer_test("tint_emit_vertex_point_size_fuzzer") {
sources = [ "tint_emit_vertex_point_size_fuzzer.cc" ]
deps = [ ":tint_fuzzer_common" ]
@@ -169,6 +174,7 @@
":tint_binding_remapper_fuzzer",
":tint_bound_array_accessors_fuzzer",
":tint_calculate_array_length_fuzzer",
+ ":tint_canonicalize_entry_point_io_fuzzer",
":tint_emit_vertex_point_size_fuzzer",
":tint_first_index_offset_fuzzer",
":tint_inspector_fuzzer",
diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt
index 89362cf..98abf30 100644
--- a/fuzzers/CMakeLists.txt
+++ b/fuzzers/CMakeLists.txt
@@ -34,6 +34,7 @@
add_tint_fuzzer(tint_binding_remapper_fuzzer)
add_tint_fuzzer(tint_bound_array_accessors_fuzzer)
add_tint_fuzzer(tint_calculate_array_length_fuzzer)
+ add_tint_fuzzer(tint_canonicalize_entry_point_io_fuzzer)
add_tint_fuzzer(tint_emit_vertex_point_size_fuzzer)
add_tint_fuzzer(tint_first_index_offset_fuzzer)
add_tint_fuzzer(tint_inspector_fuzzer)
diff --git a/fuzzers/tint_all_transforms_fuzzer.cc b/fuzzers/tint_all_transforms_fuzzer.cc
index f93e7a5..36ed341 100644
--- a/fuzzers/tint_all_transforms_fuzzer.cc
+++ b/fuzzers/tint_all_transforms_fuzzer.cc
@@ -34,6 +34,7 @@
transform_manager.Add<transform::FirstIndexOffset>();
transform_manager.Add<transform::BindingRemapper>();
transform_manager.Add<transform::CalculateArrayLength>();
+ transform_manager.Add<transform::CanonicalizeEntryPointIO>();
fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
fuzzer.SetTransformManager(&transform_manager, std::move(transform_inputs));
diff --git a/fuzzers/tint_canonicalize_entry_point_io_fuzzer.cc b/fuzzers/tint_canonicalize_entry_point_io_fuzzer.cc
new file mode 100644
index 0000000..263aa8a
--- /dev/null
+++ b/fuzzers/tint_canonicalize_entry_point_io_fuzzer.cc
@@ -0,0 +1,31 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "fuzzers/tint_common_fuzzer.h"
+
+namespace tint {
+namespace fuzzers {
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ transform::Manager transform_manager;
+ transform_manager.Add<transform::CanonicalizeEntryPointIO>();
+
+ fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
+ fuzzer.SetTransformManager(&transform_manager, {});
+
+ return fuzzer.Run(data, size);
+}
+
+} // namespace fuzzers
+} // namespace tint
diff --git a/include/tint/tint.h b/include/tint/tint.h
index 04e1f53..44d85f3 100644
--- a/include/tint/tint.h
+++ b/include/tint/tint.h
@@ -27,6 +27,7 @@
#include "src/transform/binding_remapper.h"
#include "src/transform/bound_array_accessors.h"
#include "src/transform/calculate_array_length.h"
+#include "src/transform/canonicalize_entry_point_io.h"
#include "src/transform/emit_vertex_point_size.h"
#include "src/transform/first_index_offset.h"
#include "src/transform/manager.h"