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:
parent
753f40b869
commit
1a50cb9064
12
BUILD.gn
12
BUILD.gn
|
@ -1157,16 +1157,16 @@ test("tint_unittests") {
|
||||||
if (build_with_chromium) {
|
if (build_with_chromium) {
|
||||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
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" ]
|
sources = [ "fuzzers/tint_wgsl_reader_fuzzer.cc" ]
|
||||||
|
|
||||||
configs += [ ":tint_common_config" ]
|
configs += [ ":tint_common_config" ]
|
||||||
public_configs = [ ":tint_public_config" ]
|
public_configs = [ ":tint_public_config" ]
|
||||||
deps = [ ":libtint_wgsl_reader_src" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
fuzzer_test("tint_wgsl_reader_fuzzer") {
|
deps = [
|
||||||
sources = []
|
":libtint_wgsl_reader_src",
|
||||||
deps = [ ":tint_wgsl_reader_fuzzer_src" ]
|
":tint_wgsl_reader_fuzzer_src",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,8 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# TODO(rharrison): Make a generic fuzzer target template once we have more
|
function(add_tint_fuzzer NAME)
|
||||||
# fuzzers.
|
add_executable(${NAME} ${NAME}.cc)
|
||||||
|
|
||||||
if ({TINT_BUILD_WGSL_READER})
|
|
||||||
add_executable(tint_wgsl_reader_fuzzer tint_wgsl_reader_fuzzer.cc)
|
|
||||||
target_link_libraries(tint_fuzz libtint)
|
target_link_libraries(tint_fuzz libtint)
|
||||||
tint_default_compile_options(tint_fuzz)
|
tint_default_compile_options(tint_fuzz)
|
||||||
target_link_options(tint_fuzz PRIVATE
|
target_link_options(tint_fuzz PRIVATE
|
||||||
|
@ -27,8 +24,12 @@ if ({TINT_BUILD_WGSL_READER})
|
||||||
-g
|
-g
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(tint_wgsl_reader_fuzzer PRIVATE
|
target_compile_options(${NAME} PRIVATE
|
||||||
-fsanitize=fuzzer,address,undefined
|
-fsanitize=fuzzer,address,undefined
|
||||||
-Wno-missing-prototypes
|
-Wno-missing-prototypes
|
||||||
)
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if ({TINT_BUILD_WGSL_READER})
|
||||||
|
add_tint_fuzzer(tint_wgsl_reader_fuzzer)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue