From 54180d6631b34e7a145f2d883f689de511fa89e2 Mon Sep 17 00:00:00 2001 From: Alastair Donaldson Date: Wed, 20 Oct 2021 00:59:31 +0000 Subject: [PATCH] Remove WGSL and SPIR-V reader fuzzers Fuzzing of the WGSL and SPIR-V readers is well covered by fuzzers that do both reading and writing. This change removes the fuzzers that only do reading. Fixes: tint:1254 Change-Id: Ice93016a6e95be7a2e8418387c35f20be13266e5 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66923 Auto-Submit: Alastair Donaldson Kokoro: Kokoro Reviewed-by: Ryan Harrison Commit-Queue: Ryan Harrison --- fuzzers/BUILD.gn | 14 -------------- fuzzers/CMakeLists.txt | 8 -------- fuzzers/tint_common_fuzzer.cc | 8 -------- fuzzers/tint_common_fuzzer.h | 4 ++-- fuzzers/tint_spirv_tools_fuzzer/util.cc | 3 --- 5 files changed, 2 insertions(+), 35 deletions(-) diff --git a/fuzzers/BUILD.gn b/fuzzers/BUILD.gn index b7623af253..0e59d230df 100644 --- a/fuzzers/BUILD.gn +++ b/fuzzers/BUILD.gn @@ -87,17 +87,6 @@ if (build_with_chromium) { ] } - if (tint_build_wgsl_reader) { - fuzzer_test("tint_wgsl_reader_fuzzer") { - sources = [ "tint_wgsl_reader_fuzzer.cc" ] - deps = [ ":tint_fuzzer_common_with_init" ] - dict = "dictionary.txt" - libfuzzer_options = tint_fuzzer_common_libfuzzer_options - seed_corpus = fuzzer_corpus_wgsl_dir - seed_corpus_deps = [ ":tint_generate_wgsl_corpus" ] - } - } - if (tint_build_wgsl_reader && tint_build_wgsl_writer) { fuzzer_test("tint_ast_clone_fuzzer") { sources = [ "tint_ast_clone_fuzzer.cc" ] @@ -300,9 +289,6 @@ if (build_with_chromium) { testonly = true deps = [] - if (tint_build_wgsl_reader) { - deps += [ ":tint_wgsl_reader_fuzzer" ] - } if (tint_build_wgsl_reader && tint_build_wgsl_writer) { deps += [ ":tint_ast_clone_fuzzer", diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt index 990b40a718..40af3a5df5 100644 --- a/fuzzers/CMakeLists.txt +++ b/fuzzers/CMakeLists.txt @@ -32,10 +32,6 @@ function(add_tint_fuzzer NAME) target_compile_options(${NAME} PRIVATE -Wno-missing-prototypes) endfunction() -if (${TINT_BUILD_WGSL_READER}) - add_tint_fuzzer(tint_wgsl_reader_fuzzer) -endif() - if (${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_WGSL_WRITER}) add_tint_fuzzer(tint_wgsl_reader_wgsl_writer_fuzzer) endif() @@ -60,10 +56,6 @@ if (${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_MSL_WRITER}) add_tint_fuzzer(tint_wgsl_reader_msl_writer_fuzzer) endif() -if (${TINT_BUILD_SPV_READER}) - add_tint_fuzzer(tint_spv_reader_fuzzer) -endif() - if (${TINT_BUILD_SPV_READER} AND ${TINT_BUILD_WGSL_WRITER}) add_tint_fuzzer(tint_spv_reader_wgsl_writer_fuzzer) endif() diff --git a/fuzzers/tint_common_fuzzer.cc b/fuzzers/tint_common_fuzzer.cc index 3b46af5a3e..fab1782fac 100644 --- a/fuzzers/tint_common_fuzzer.cc +++ b/fuzzers/tint_common_fuzzer.cc @@ -154,12 +154,6 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) { break; } #endif // TINT_BUILD_SPV_READER - default: - return 0; - } - - if (output_ == OutputFormat::kNone) { - return 0; } if (!program.IsValid()) { @@ -323,8 +317,6 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) { #endif // TINT_BUILD_MSL_WRITER break; } - case OutputFormat::kNone: - break; } return 0; diff --git a/fuzzers/tint_common_fuzzer.h b/fuzzers/tint_common_fuzzer.h index 975e563515..b5281a5758 100644 --- a/fuzzers/tint_common_fuzzer.h +++ b/fuzzers/tint_common_fuzzer.h @@ -34,9 +34,9 @@ void GenerateWgslOptions(DataBuilder* b, writer::wgsl::Options* options); void GenerateHlslOptions(DataBuilder* b, writer::hlsl::Options* options); void GenerateMslOptions(DataBuilder* b, writer::msl::Options* options); -enum class InputFormat { kWGSL, kSpv, kNone }; +enum class InputFormat { kWGSL, kSpv }; -enum class OutputFormat { kWGSL, kSpv, kHLSL, kMSL, kNone }; +enum class OutputFormat { kWGSL, kSpv, kHLSL, kMSL }; class CommonFuzzer { public: diff --git a/fuzzers/tint_spirv_tools_fuzzer/util.cc b/fuzzers/tint_spirv_tools_fuzzer/util.cc index d25bfde04c..2a82f3386f 100644 --- a/fuzzers/tint_spirv_tools_fuzzer/util.cc +++ b/fuzzers/tint_spirv_tools_fuzzer/util.cc @@ -100,9 +100,6 @@ void LogWgslError(const std::string& message, case OutputFormat::kWGSL: error_type = "WGSL -> WGSL"; break; - default: - assert(false && "All output formats should've been handled"); - break; } auto error_path = error_dir.empty() ? error_dir : error_dir + "/wgsl/"; LogError(wgsl_count++, error_type, message,