| # Copyright 2021 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/components/fuchsia_test_component.gni") |
| |
| # This source set contains various fakes used in realmfuzzer unit tests. |
| source_set("testing") { |
| visibility = [ "../*" ] |
| testonly = true |
| sources = [ |
| "adapter.cc", |
| "adapter.h", |
| "coverage.cc", |
| "coverage.h", |
| "module.cc", |
| "module.h", |
| "target.cc", |
| "target.h", |
| ] |
| public_deps = [ |
| "../engine:engine-lib", |
| "../target:no_hooks", |
| "//src/sys/fuzzing/common", |
| "//src/sys/fuzzing/common/testing", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/zx", |
| ] |
| deps = [ "//sdk/lib/fdio" ] |
| } |
| |
| # This executable is used for unit tests that manipulate processes. |
| executable("test-target") { |
| output_name = "realmfuzzer_test_target" |
| visibility = [ "//src/sys/fuzzing/*" ] |
| testonly = true |
| sources = [ "target-main.cc" ] |
| deps = [ |
| "//sdk/lib/syslog/cpp", |
| "//src/sys/fuzzing/common", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| # The test engine is used to drive the target adapter with fixed inputs from the seed corpus. This |
| # is used to create fuzzer tests that can be run as part of CQ. |
| executable("engine-bin") { |
| output_name = "realmfuzzer_test_engine" |
| testonly = true |
| sources = [ "engine.cc" ] |
| deps = [ |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/sys/fuzzing/common", |
| "//src/sys/fuzzing/common/testing", |
| "//src/sys/fuzzing/realmfuzzer/engine:adapter-client", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| fuchsia_test_component("engine") { |
| manifest = "meta/engine.cml" |
| deps = [ ":engine-bin" ] |
| } |
| |
| # The test coverage component is a simpler version of test_manager's fuzz_coverage component. It |
| # can handle a single watcher, and doesn't need |fuchsia.sys2.EventStream|, making it suitable for |
| # use in integration tests. |
| executable("coverage-bin") { |
| output_name = "realmfuzzer_test_coverage" |
| testonly = true |
| sources = [ "coverage-main.cc" ] |
| deps = [ |
| ":testing", |
| "//sdk/fidl/fuchsia.debugdata", |
| "//src/sys/fuzzing/common", |
| ] |
| } |
| |
| fuchsia_test_component("coverage") { |
| manifest = "meta/coverage.cml" |
| deps = [ ":coverage-bin" ] |
| } |