blob: 08b27fb746d1115027b1a363f566eddeb7c67968 [file] [log] [blame]
# Copyright 2019 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/bind/bind.gni")
import("//build/components.gni")
import("//build/drivers.gni")
import("//src/lib/isolated_devmgr/isolated_devmgr.gni")
source_set("src") {
testonly = true
sources = [
"isolated_devmgr.cc",
"isolated_devmgr.h",
]
public_deps = [ "//zircon/system/ulib/devmgr-integration-test" ]
deps = [
"//sdk/lib/device-watcher/cpp",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//src/lib/ddk",
"//src/lib/ddk:ddk-metadata-headers",
"//src/lib/fxl",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/inspector",
"//zircon/system/ulib/zx",
]
}
executable("isolated_devmgr") {
testonly = true
output_name = "isolated_devmgr"
sources = [ "main.cc" ]
deps = [
":src",
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp_wire",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//src/lib/ddk",
"//src/lib/fxl",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/devmgr-integration-test",
"//zircon/system/ulib/fbl",
]
# These binaries are used by isolated_devmgr at runtime and should be
# present in the same package.
data_deps = [
"//src/devices/bin/driver_host",
"//src/devices/bin/driver_manager",
"//src/storage/fshost",
]
# STOP: Do not add any new entries to this allow list. Use //sdk/lib/driver_test_realm instead.
visibility = [
"//src/bringup/bin/device-name-provider/tests/*",
"//src/connectivity/network/testing/netemul/runner/*",
"//src/connectivity/openthread/tests/ot-devmgr/*",
"//src/connectivity/telephony/lib/tel-devmgr/*",
"//src/connectivity/wlan/testing/wlan-devmgr/*",
"//src/devices/bus/drivers/platform/test/*",
"//src/diagnostics/validator/logs/ddk/sink/*",
"//src/lib:lib",
"//src/lib/isolated_devmgr/*",
"//src/lib/storage/ramdevice_client/rust/*",
"//src/media/audio/lib/audio_test_devmgr/*",
"//vendor/*",
]
metadata = {
# Tests that use isolated_devmgr require the following capabilities
test_component_manifest_cmx = [
{
sandbox = {
services = [
"fuchsia.exception.Handler",
"fuchsia.process.Launcher",
]
}
},
]
}
}
static_library("usb-virtual-bus") {
testonly = true
sources = [
"usb-virtual-bus-helper.cc",
"usb-virtual-bus-helper.h",
"usb-virtual-bus.cc",
"usb-virtual-bus.h",
]
public_deps = [
"//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_cpp_wire",
"//sdk/fidl/fuchsia.hardware.usb.virtual.bus:fuchsia.hardware.usb.virtual.bus_cpp_wire",
"//src/lib/testing/loop_fixture",
]
deps = [
"//sdk/fidl/fuchsia.sys",
"//sdk/lib/device-watcher/cpp",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//src/lib/ddk",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
"//zircon/system/ulib/zx",
]
configs += [
"//build/config/fuchsia:enable_zircon_asserts",
"//build/config/fuchsia:static_cpp_standard_library",
]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
# STOP: Do not add any new entries to this allow list. Use //sdk/lib/driver_test_realm instead.
visibility = [ "//src/connectivity/telephony/tests/driver-integration/*" ]
}
executable("test_bin") {
testonly = true
output_name = "isolated_devmgr_tests"
sources = [ "isolated_devmgr_tests.cc" ]
deps = [
":src",
"//sdk/fidl/fuchsia.hardware.ethertap",
"//sdk/fidl/fuchsia.io:fuchsia.io",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.virtualaudio",
"//sdk/lib/device-watcher/cpp",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//src/lib/ddk",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/devmgr-integration-test",
"//zircon/system/ulib/fdio-caller",
]
}
isolated_devmgr_component("ethertap-devmgr") {
args = [
"--sys_device=/boot/driver/test-parent-sys.so",
"--svc_name=fuchsia.example.IsolatedDevmgr",
"--wait_for=sys/test/tapctl",
]
deps = [
"//src/connectivity/ethernet/drivers/ethernet",
"//src/connectivity/ethernet/drivers/ethertap",
"//src/devices/misc/drivers/test-parent",
]
}
isolated_devmgr_component("virtual-audio-devmgr") {
args = [
"--sys_device=fuchsia-boot:///#driver/platform-bus.so",
"--svc_name=fuchsia.example.IsolatedDevmgr",
"--wait_for=sys/platform/00:00:2f/virtual_audio",
]
deps = [ "//src/media/audio/drivers/virtual_audio:virtual_audio_driver" ]
}
driver_bind_rules("crash-device-bind") {
rules = "crash-device.bind"
header_output = "crash-device-bind.h"
deps = [ "//src/devices/bind/fuchsia.test.platform" ]
}
# A device that causes a crash when it's operated on
fuchsia_driver("crash-device-driver") {
output_name = "crash-device"
sources = [ "crash_device.cc" ]
deps = [
":crash-device-bind",
"//sdk/lib/fidl",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/fzl",
]
}
fuchsia_driver_component("crash-device") {
component_name = "crash-device"
deps = [ ":crash-device-driver" ]
info = "crash-device-info.json"
colocate = true
}
driver_bind_rules("test-device-bind") {
rules = "test-device.bind"
header_output = "test-device-bind.h"
deps = [ "//src/devices/bind/fuchsia.test.platform" ]
}
fuchsia_driver("test-device-driver") {
output_name = "test-device"
sources = [ "test_device.cc" ]
deps = [
":test-device-bind",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
]
}
fuchsia_driver_component("test-device") {
component_name = "test-device"
deps = [ ":test-device-driver" ]
info = "test-device-info.json"
colocate = true
}
fuchsia_component("isolated-devmgr-tests") {
testonly = true
manifest = "isolated-devmgr-tests.cmx"
deps = [
":crash-device",
":ethertap-devmgr",
":test-device",
":test_bin",
":virtual-audio-devmgr",
"//src/connectivity/ethernet/drivers/ethernet",
"//src/connectivity/ethernet/drivers/ethertap",
"//src/devices/board/drivers/integration-test",
"//src/devices/bus/drivers/platform",
]
}
fuchsia_test_package("isolated-devmgr-tests-package") {
test_components = [ ":isolated-devmgr-tests" ]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
data_deps = [ ":isolated-devmgr-tests-package" ]
}