| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/fuzzing/fuzzer.gni") |
| import("//build/test.gni") |
| |
| group("fuzz") { |
| testonly = true |
| deps = [ ":tests" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":sysmem-fuzz" ] |
| } |
| |
| fuzzers_package("sysmem-fuzz") { |
| # Fuzzers are defined for each supported language |
| cpp_fuzzers = [ |
| # Each list of fuzzers can contain simple labels... |
| ":sysmem_fuzzer", |
| ":sysmem_fuzzer_multi", |
| ] |
| } |
| |
| fuzzer("sysmem_fuzzer") { |
| testonly = true |
| output_name = "sysmem_fuzzer" |
| sources = [ |
| "sysmem_fuzz.cc", |
| "sysmem_fuzz_common.cc", |
| ] |
| corpus = "corpus" |
| deps = [ |
| "//sdk/banjo/fuchsia.hardware.platform.bus:fuchsia.hardware.platform.bus_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.platform.device:fuchsia.hardware.platform.device_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_banjo_cpp", |
| "//sdk/banjo/fuchsia.sysmem:fuchsia.sysmem_banjo_c", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_c", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_llcpp", |
| "//sdk/fidl/fuchsia.sysmem2:fuchsia.sysmem2_llcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit", |
| "//src/devices/bus/testing/fake-pdev", |
| "//src/devices/lib/driver", |
| "//src/devices/sysmem/drivers/sysmem:sysmem_common_srcs", |
| "//src/devices/testing/fake_ddk", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/closure-queue", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fidl", |
| "//zircon/system/ulib/fidl:fidl-llcpp", |
| "//zircon/system/ulib/fidl-utils", |
| "//zircon/system/ulib/image-format", |
| "//zircon/system/ulib/region-alloc", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/sysmem-version", |
| "//zircon/system/ulib/trace:trace-driver", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| # TODO(fxbug.dev/95833): This target uses the deprecated C bindings. |
| # Consider switching to the C++ bindings. See linked bug for details. |
| configs += [ "//build/c:fidl-deprecated-c-bindings" ] |
| } |
| |
| fuzzer("sysmem_fuzzer_multi") { |
| testonly = true |
| output_name = "sysmem_fuzzer_multi" |
| sources = [ |
| "sysmem_fuzz_common.cc", |
| "sysmem_fuzz_multi.cc", |
| ] |
| corpus = "corpus_multi" |
| |
| # The fuzzer requires 2 BufferCollectionConstraints inputs, so the input must |
| # be at least that big (at the time of writing, around 14000 bytes). Choose |
| # 20000 bytes as a margin in case the size of the struct changes; the fuzzer |
| # should by able to determine the exact size needed as long as it's <= |
| # max_len. |
| options = [ "max_len=20000" ] |
| deps = [ |
| "//sdk/banjo/fuchsia.hardware.platform.bus:fuchsia.hardware.platform.bus_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.platform.device:fuchsia.hardware.platform.device_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_banjo_cpp", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_c", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_llcpp", |
| "//sdk/fidl/fuchsia.sysmem2:fuchsia.sysmem2_llcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit", |
| "//src/devices/bus/testing/fake-pdev", |
| "//src/devices/lib/driver", |
| "//src/devices/sysmem/drivers/sysmem:sysmem_common_srcs", |
| "//src/devices/testing/fake_ddk", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/closure-queue", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fidl", |
| "//zircon/system/ulib/fidl:fidl-llcpp", |
| "//zircon/system/ulib/fidl-async-2", |
| "//zircon/system/ulib/fidl-utils", |
| "//zircon/system/ulib/image-format", |
| "//zircon/system/ulib/region-alloc", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/sysmem-version", |
| "//zircon/system/ulib/trace:trace-driver", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| # TODO(fxbug.dev/95833): This target uses the deprecated C bindings. |
| # Consider switching to the C++ bindings. See linked bug for details. |
| configs += [ "//build/c:fidl-deprecated-c-bindings" ] |
| } |