blob: 3f2fbb7fbb0249f9978054eb4d1714a9f3748ab5 [file] [log] [blame]
# 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-main.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",
"target-main.h",
]
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.
#
# NOTE:This component is excluded from coverage builds. In those builds, test_manager's debug_data
# component *also* exposes `fuchsia.debugdata.Publisher`, which is offered via the "test-env"
# environment's debug field. The component framework does not reliably route to this component,
# which can cause tests to flake.
if (!is_coverage) {
executable("coverage-bin") {
output_name = "realmfuzzer_test_coverage"
testonly = true
sources = [ "coverage-main.cc" ]
deps = [
":testing",
"//sdk/fidl/fuchsia.debugdata:fuchsia.debugdata_hlcpp",
"//src/sys/fuzzing/common",
]
}
fuchsia_test_component("coverage") {
manifest = "meta/coverage.cml"
deps = [ ":coverage-bin" ]
}
}