blob: 6284560ff4efd45eb11d9f6c566164efd27c3dd8 [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/config/fuchsia/rules.gni")
import("//build/test.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//zircon/system/ulib/devmgr-integration-test/isolated_devmgr.gni")
group("tests") {
testonly = true
deps = [ ":driver-host-tests" ]
}
executable("driver_host") {
sources = [ "main.cc" ]
deps = [
":common",
":driver",
]
}
source_set("common") {
sources = [
"api.cc",
"composite_device.cc",
"connection_destroyer.cc",
"core.cc",
"devfs_vnode.cc",
"device_controller_connection.cc",
"driver_host.cc",
"driver_host_context.cc",
"env.cc",
"inspect.cc",
"proxy_iostate.cc",
"scheduler_profile.cc",
"tracing.cc",
"zx_device.cc",
]
public_deps = [
"//sdk/banjo/ddk.protocol.composite",
"//sdk/fidl/fuchsia.device:fuchsia.device_c",
"//sdk/fidl/fuchsia.device:fuchsia.device_llcpp",
"//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager_c",
"//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager_llcpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_c",
"//sdk/fidl/fuchsia.scheduler:fuchsia.scheduler_c",
"//sdk/lib/fdio",
"//src/devices/lib/log",
"//src/lib/ddk",
"//zircon/system/ulib/fidl:fidl-llcpp",
# TODO(fxb/38132): Migrate to the new bind rules and delete the below
"//src/lib/ddk:ddk-deprecated-binding-headers",
"//src/lib/ddktl",
"//src/storage/deprecated-fs-fidl-handler",
"//zircon/public/lib/fbl",
"//zircon/public/lib/fidl",
"//zircon/public/lib/sync",
"//zircon/public/lib/zircon-internal",
"//zircon/public/lib/zx",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fidl-async",
"//zircon/system/ulib/fs",
"//zircon/system/ulib/inspect",
"//zircon/system/ulib/trace",
"//zircon/system/ulib/trace-provider:trace-provider-with-fdio",
"//zircon/system/ulib/zxio",
]
configs += [ "//build/config:all_source" ]
}
shared_library("driver") {
sources = []
deps = [ ":common" ]
}
bind_rules("test-devhost-parent-bind") {
rules = "test-devhost-parent.bind"
output = "test-devhost-parent-bind.h"
deps = [ "//src/devices/bind/test.platform" ]
}
driver_module("driver-host-test-driver") {
sources = [ "test-driver.cc" ]
deps = [
":test-devhost-parent-bind",
"//sdk/lib/fdio",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
]
}
bind_rules("test-devhost-child-bind") {
rules = "test-devhost-child.bind"
output = "test-devhost-child-bind.h"
deps = [ "//src/devices/bind/fuchsia.test" ]
}
driver_module("driver-host-test-child-driver") {
sources = [ "test-driver-child.cc" ]
deps = [
":test-devhost-child-bind",
"//sdk/lib/fdio",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
]
}
test("driver_host_test") {
sources = [
"core_test.cc",
"device_api_test.cc",
"device_controller_connection_test.cc",
"device_controller_integration_test.cc",
"driver_host_test.cc",
"inspect_test.cc",
"proxy_iostate_test.cc",
]
deps = [
":common",
"//sdk/fidl/fuchsia.device.test:fuchsia.device.test_llcpp",
"//sdk/lib/inspect/testing/cpp:zxtest",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/devmgr-integration-test",
"//zircon/system/ulib/driver-integration-test",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
]
}
bind_rules("unit-test-fail-bind") {
rules = "unit-test-fail.bind"
output = "unit-test-fail-bind.h"
deps = [ "//src/devices/bind/fuchsia.test" ]
disable_autobind = true
}
driver_module("unit-test-fail") {
test = true
sources = [ "unit-test-fail.cc" ]
deps = [
":unit-test-fail-bind",
"//src/devices/lib/driver",
"//src/lib/ddk",
]
}
bind_rules("unit-test-pass-bind") {
rules = "unit-test-pass.bind"
output = "unit-test-pass-bind.h"
deps = [ "//src/devices/bind/fuchsia.test" ]
disable_autobind = true
}
driver_module("unit-test-pass") {
test = true
sources = [ "unit-test-pass.cc" ]
deps = [
":unit-test-pass-bind",
"//src/devices/lib/driver",
"//src/lib/ddk",
]
}
isolated_devmgr_unittest_package("driver-host-tests") {
executable_path = "test/driver_host_test"
deps = [
":driver-host-test-child-driver",
":driver-host-test-driver",
":driver_host_test",
":unit-test-fail",
":unit-test-pass",
"//src/devices/board/drivers/integration-test",
"//src/devices/bus/drivers/platform",
"//src/devices/misc/drivers/test",
"//src/devices/tests/sysdev",
]
}