Move src/fuzzers to src/fuzzers/dawn

As part of the tint -> dawn merge.

Bug: tint:1275
Change-Id: I0ebb8afe9971c21ca90f90f246edcfde01d5f4bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/78800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-02-01 16:45:12 +00:00 committed by Dawn LUCI CQ
parent 38b188ce61
commit 1a4185b742
10 changed files with 131 additions and 109 deletions

View File

@ -18,7 +18,7 @@ group("all") {
testonly = true
deps = [
"src/dawn_native:webgpu_dawn",
"src/fuzzers:dawn_fuzzers",
"src/fuzzers/dawn:dawn_fuzzers",
"src/tests:dawn_tests",
]
if (dawn_standalone) {

View File

@ -18,7 +18,7 @@ This repository contains the implementation of Dawn, which is itself composed of
- `<backend>`: code for the implementation of the backend on a specific graphics API, for example `d3d12`, `metal` or `vulkan`.
- [`dawn_platform`](../src/dawn_platform): definition of interfaces for dependency injection in `dawn_native` or `dawn_wire`.
- [`dawn_wire`](../src/dawn_wire): code for an implementation of WebGPU as a client-server architecture.
- [`fuzzers`](../src/fuzzers): various fuzzers for Dawn that are running in [Clusterfuzz](https://google.github.io/clusterfuzz/).
- [`fuzzers`](../src/dawn/fuzzers): various fuzzers for Dawn that are running in [Clusterfuzz](https://google.github.io/clusterfuzz/).
- [`include`](../src/include): public headers with subdirectories for each library. Note that some headers are auto-generated and not present directly in the directory.
- [`tests`](../src/tests):
- [`end2end`](../src/tests/end2end): tests for the execution of the WebGPU API and require a GPU to run.

View File

@ -1,4 +1,4 @@
# Copyright 2018 The Dawn Authors
# Copyright 2022 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,113 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("../../scripts/dawn_overrides_with_defaults.gni")
# TODO(crbug.com/dawn/1275) - Remove this file once all external references to
# this build file have been fixed up to use src/fuzzers/dawn instead.
# We only have libfuzzer in Chromium builds but if we build fuzzer targets only
# there, we would risk breaking fuzzer targets all the time when making changes
# to Dawn. To avoid that, we make fuzzer targets compile in standalone builds
# as well with a dawn_fuzzer_test target that acts like Chromium's fuzzer_test.
#
# The standalone fuzzer targets are able to run a single fuzzer input which
# could help reproduce fuzzer crashes more easily because you don't need a
# whole Chromium checkout.
if (build_with_chromium) {
import("//testing/libfuzzer/fuzzer_test.gni")
# In Chromium build we just proxy everything to the real fuzzer_test
template("dawn_fuzzer_test") {
fuzzer_test(target_name) {
forward_variables_from(invoker, "*")
}
}
} else {
import("//testing/test.gni")
# In standalone build we do something similar to fuzzer_test.
template("dawn_fuzzer_test") {
test(target_name) {
forward_variables_from(invoker,
[
"asan_options",
"cflags",
"cflags_cc",
"check_includes",
"defines",
"deps",
"include_dirs",
"sources",
])
if (defined(asan_options)) {
not_needed([ "asan_options" ])
}
if (!defined(configs)) {
configs = []
}
# Weirdly fuzzer_test uses a special variable for additional configs.
if (defined(invoker.additional_configs)) {
configs += invoker.additional_configs
}
sources += [ "StandaloneFuzzerMain.cpp" ]
}
}
}
static_library("dawn_wire_server_fuzzer_common") {
sources = [
"DawnWireServerFuzzer.cpp",
"DawnWireServerFuzzer.h",
]
public_deps = [
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawn_proc",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn_native:dawn_native_static",
"${dawn_root}/src/dawn_wire:dawn_wire_static",
"${dawn_root}/src/utils:dawn_utils",
]
}
dawn_fuzzer_test("dawn_wire_server_and_frontend_fuzzer") {
sources = [ "DawnWireServerAndFrontendFuzzer.cpp" ]
deps = [ ":dawn_wire_server_fuzzer_common" ]
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
if (is_win) {
dawn_fuzzer_test("dawn_wire_server_and_d3d12_backend_fuzzer") {
sources = [ "DawnWireServerAndD3D12BackendFuzzer.cpp" ]
deps = [ ":dawn_wire_server_fuzzer_common" ]
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
}
dawn_fuzzer_test("dawn_wire_server_and_vulkan_backend_fuzzer") {
sources = [ "DawnWireServerAndVulkanBackendFuzzer.cpp" ]
deps = [ ":dawn_wire_server_fuzzer_common" ]
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
# A group target to build all the fuzzers
# TODO(crbug.com/dawn/1275) - Alias to "src/fuzzers/dawn:dawn_fuzzers"
group("dawn_fuzzers") {
testonly = true
deps = [
":dawn_wire_server_and_frontend_fuzzer",
":dawn_wire_server_and_vulkan_backend_fuzzer",
]
if (is_win) {
deps += [ ":dawn_wire_server_and_d3d12_backend_fuzzer" ]
}
public_deps = [ "dawn:dawn_fuzzers" ]
}

124
src/fuzzers/dawn/BUILD.gn Normal file
View File

@ -0,0 +1,124 @@
# Copyright 2018 The Dawn 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.
import("//build_overrides/build.gni")
import("../../../scripts/dawn_overrides_with_defaults.gni")
# We only have libfuzzer in Chromium builds but if we build fuzzer targets only
# there, we would risk breaking fuzzer targets all the time when making changes
# to Dawn. To avoid that, we make fuzzer targets compile in standalone builds
# as well with a dawn_fuzzer_test target that acts like Chromium's fuzzer_test.
#
# The standalone fuzzer targets are able to run a single fuzzer input which
# could help reproduce fuzzer crashes more easily because you don't need a
# whole Chromium checkout.
if (build_with_chromium) {
import("//testing/libfuzzer/fuzzer_test.gni")
# In Chromium build we just proxy everything to the real fuzzer_test
template("dawn_fuzzer_test") {
fuzzer_test(target_name) {
forward_variables_from(invoker, "*")
}
}
} else {
import("//testing/test.gni")
# In standalone build we do something similar to fuzzer_test.
template("dawn_fuzzer_test") {
test(target_name) {
forward_variables_from(invoker,
[
"asan_options",
"cflags",
"cflags_cc",
"check_includes",
"defines",
"deps",
"include_dirs",
"sources",
])
if (defined(asan_options)) {
not_needed([ "asan_options" ])
}
if (!defined(configs)) {
configs = []
}
# Weirdly fuzzer_test uses a special variable for additional configs.
if (defined(invoker.additional_configs)) {
configs += invoker.additional_configs
}
sources += [ "StandaloneFuzzerMain.cpp" ]
}
}
}
static_library("dawn_wire_server_fuzzer_common") {
sources = [
"DawnWireServerFuzzer.cpp",
"DawnWireServerFuzzer.h",
]
public_deps = [
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawn_proc",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn_native:dawn_native_static",
"${dawn_root}/src/dawn_wire:dawn_wire_static",
"${dawn_root}/src/utils:dawn_utils",
]
}
dawn_fuzzer_test("dawn_wire_server_and_frontend_fuzzer") {
sources = [ "DawnWireServerAndFrontendFuzzer.cpp" ]
deps = [ ":dawn_wire_server_fuzzer_common" ]
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
if (is_win) {
dawn_fuzzer_test("dawn_wire_server_and_d3d12_backend_fuzzer") {
sources = [ "DawnWireServerAndD3D12BackendFuzzer.cpp" ]
deps = [ ":dawn_wire_server_fuzzer_common" ]
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
}
dawn_fuzzer_test("dawn_wire_server_and_vulkan_backend_fuzzer") {
sources = [ "DawnWireServerAndVulkanBackendFuzzer.cpp" ]
deps = [ ":dawn_wire_server_fuzzer_common" ]
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
# A group target to build all the fuzzers
group("dawn_fuzzers") {
testonly = true
deps = [
":dawn_wire_server_and_frontend_fuzzer",
":dawn_wire_server_and_vulkan_backend_fuzzer",
]
if (is_win) {
deps += [ ":dawn_wire_server_and_d3d12_backend_fuzzer" ]
}
}