Simplify fuzzer targets to ease adding additional targets

BUG=tint:199

Change-Id: Ic42c8e5ea03f012e2be8e9bdbf46490bdc0048a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26120
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ryan Harrison 2020-07-30 18:43:48 +00:00
parent 753f40b869
commit 1a50cb9064
2 changed files with 13 additions and 12 deletions

View File

@ -1157,16 +1157,16 @@ test("tint_unittests") {
if (build_with_chromium) {
import("//testing/libfuzzer/fuzzer_test.gni")
source_set("tint_wgsl_reader_fuzzer_src") {
fuzzer_test("tint_wgsl_reader_fuzzer") {
sources = [ "fuzzers/tint_wgsl_reader_fuzzer.cc" ]
configs += [ ":tint_common_config" ]
public_configs = [ ":tint_public_config" ]
deps = [ ":libtint_wgsl_reader_src" ]
}
fuzzer_test("tint_wgsl_reader_fuzzer") {
sources = []
deps = [ ":tint_wgsl_reader_fuzzer_src" ]
deps = [
":libtint_wgsl_reader_src",
":tint_wgsl_reader_fuzzer_src",
]
}
}

View File

@ -12,11 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# TODO(rharrison): Make a generic fuzzer target template once we have more
# fuzzers.
if ({TINT_BUILD_WGSL_READER})
add_executable(tint_wgsl_reader_fuzzer tint_wgsl_reader_fuzzer.cc)
function(add_tint_fuzzer NAME)
add_executable(${NAME} ${NAME}.cc)
target_link_libraries(tint_fuzz libtint)
tint_default_compile_options(tint_fuzz)
target_link_options(tint_fuzz PRIVATE
@ -27,8 +24,12 @@ if ({TINT_BUILD_WGSL_READER})
-g
)
target_compile_options(tint_wgsl_reader_fuzzer PRIVATE
target_compile_options(${NAME} PRIVATE
-fsanitize=fuzzer,address,undefined
-Wno-missing-prototypes
)
endfunction()
if ({TINT_BUILD_WGSL_READER})
add_tint_fuzzer(tint_wgsl_reader_fuzzer)
endif()