2021-06-24 18:10:46 +00:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
set(FUZZER_SOURCES
|
2021-11-24 14:55:05 +00:00
|
|
|
../mersenne_twister_engine.cc
|
2021-09-03 00:59:35 +00:00
|
|
|
../random_generator.cc
|
2021-11-24 14:55:05 +00:00
|
|
|
../random_generator_engine.cc
|
2021-06-24 18:10:46 +00:00
|
|
|
cli.cc
|
|
|
|
fuzzer.cc
|
|
|
|
mutator.cc
|
|
|
|
mutator_cache.cc
|
|
|
|
spirv_fuzz_mutator.cc
|
|
|
|
spirv_opt_mutator.cc
|
|
|
|
spirv_reduce_mutator.cc
|
|
|
|
util.cc)
|
|
|
|
|
|
|
|
set(FUZZER_SOURCES ${FUZZER_SOURCES}
|
2021-11-24 14:55:05 +00:00
|
|
|
../mersenne_twister_engine.h
|
2021-09-03 00:59:35 +00:00
|
|
|
../random_generator.h
|
2021-11-24 14:55:05 +00:00
|
|
|
../random_generator_engine.h
|
2021-06-24 18:10:46 +00:00
|
|
|
cli.h
|
|
|
|
mutator.h
|
|
|
|
mutator_cache.h
|
2021-09-21 16:41:58 +00:00
|
|
|
override_cli_params.h
|
2021-06-24 18:10:46 +00:00
|
|
|
spirv_fuzz_mutator.h
|
|
|
|
spirv_opt_mutator.h
|
|
|
|
spirv_reduce_mutator.h
|
|
|
|
util.h)
|
|
|
|
|
|
|
|
set(FUZZER_SOURCES ${FUZZER_SOURCES}
|
2021-09-03 00:59:35 +00:00
|
|
|
../tint_common_fuzzer.cc
|
|
|
|
../tint_common_fuzzer.h)
|
2021-06-24 18:10:46 +00:00
|
|
|
|
|
|
|
function(configure_spirv_tools_fuzzer_target NAME SOURCES)
|
|
|
|
add_executable(${NAME} ${SOURCES})
|
|
|
|
target_link_libraries(${NAME} SPIRV-Tools SPIRV-Tools-opt SPIRV-Tools-fuzz SPIRV-Tools-reduce)
|
|
|
|
tint_default_compile_options(${NAME})
|
|
|
|
target_compile_options(${NAME} PRIVATE
|
|
|
|
-Wno-missing-prototypes
|
|
|
|
-Wno-zero-as-null-pointer-constant
|
|
|
|
-Wno-reserved-id-macro
|
|
|
|
-Wno-sign-conversion
|
|
|
|
-Wno-extra-semi-stmt
|
|
|
|
-Wno-inconsistent-missing-destructor-override
|
|
|
|
-Wno-newline-eof
|
|
|
|
-Wno-old-style-cast
|
|
|
|
-Wno-weak-vtables
|
|
|
|
-Wno-undef)
|
|
|
|
target_include_directories(${NAME} PRIVATE
|
|
|
|
${spirv-tools_SOURCE_DIR}
|
|
|
|
${spirv-tools_BINARY_DIR})
|
|
|
|
endfunction()
|
|
|
|
|
2021-09-21 16:41:58 +00:00
|
|
|
function(add_tint_spirv_tools_fuzzer NAME)
|
|
|
|
set(FUZZER_TARGET_SOURCES ${NAME}.cc ${FUZZER_SOURCES})
|
|
|
|
configure_spirv_tools_fuzzer_target(${NAME} "${FUZZER_TARGET_SOURCES}")
|
|
|
|
target_link_libraries(${NAME} libtint-fuzz)
|
|
|
|
target_compile_definitions(tint_spirv_tools_fuzzer PUBLIC CUSTOM_MUTATOR)
|
|
|
|
target_compile_definitions(tint_spirv_tools_fuzzer PRIVATE TARGET_FUZZER)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# Add libfuzzer targets.
|
|
|
|
# Targets back-ends according to command line arguments.
|
|
|
|
add_tint_spirv_tools_fuzzer(tint_spirv_tools_fuzzer)
|
|
|
|
# Targets back-ends individually.
|
|
|
|
add_tint_spirv_tools_fuzzer(tint_spirv_tools_hlsl_writer_fuzzer)
|
|
|
|
add_tint_spirv_tools_fuzzer(tint_spirv_tools_msl_writer_fuzzer)
|
|
|
|
add_tint_spirv_tools_fuzzer(tint_spirv_tools_spv_writer_fuzzer)
|
|
|
|
add_tint_spirv_tools_fuzzer(tint_spirv_tools_wgsl_writer_fuzzer)
|
2021-06-24 18:10:46 +00:00
|
|
|
|
|
|
|
set(DEBUGGER_SOURCES
|
2021-11-24 14:55:05 +00:00
|
|
|
../mersenne_twister_engine.cc
|
2021-09-03 00:59:35 +00:00
|
|
|
../random_generator.cc
|
2021-11-24 14:55:05 +00:00
|
|
|
../random_generator_engine.cc
|
2021-06-24 18:10:46 +00:00
|
|
|
cli.cc
|
|
|
|
mutator.cc
|
|
|
|
mutator_debugger.cc
|
|
|
|
spirv_fuzz_mutator.cc
|
|
|
|
spirv_opt_mutator.cc
|
|
|
|
spirv_reduce_mutator.cc
|
|
|
|
util.cc)
|
|
|
|
|
|
|
|
set(DEBUGGER_SOURCES ${DEBUGGER_SOURCES}
|
2021-11-24 14:55:05 +00:00
|
|
|
../mersenne_twister_engine.h
|
2021-09-03 00:59:35 +00:00
|
|
|
../random_generator.h
|
2021-11-24 14:55:05 +00:00
|
|
|
../random_generator_engine.h
|
2021-06-24 18:10:46 +00:00
|
|
|
cli.h
|
|
|
|
mutator.h
|
|
|
|
spirv_fuzz_mutator.h
|
|
|
|
spirv_opt_mutator.h
|
|
|
|
spirv_reduce_mutator.h
|
|
|
|
util.h)
|
|
|
|
|
|
|
|
configure_spirv_tools_fuzzer_target(tint_spirv_tools_mutator_debugger "${DEBUGGER_SOURCES}")
|
|
|
|
target_compile_definitions(tint_spirv_tools_mutator_debugger PRIVATE TARGET_DEBUGGER)
|