| # 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/fidl/fidl.gni") |
| import("//build/test.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", |
| "//sdk/lib/syslog/cpp:backend_fuchsia_compat", |
| ] |
| } |
| |
| 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", |
| ] |
| |
| deps = [ "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp" ] |
| |
| public_deps = [ |
| "//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.io2:fuchsia.io2_llcpp", |
| "//sdk/fidl/fuchsia.scheduler:fuchsia.scheduler_c", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit-promise", |
| "//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/lib/storage/vfs/cpp", |
| "//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/inspect", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| "//zircon/system/ulib/zxio", |
| ] |
| |
| configs += [ "//build/config:all_source" ] |
| |
| # 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" ] |
| } |
| |
| 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 = [ |
| ":fuchsia.device.restarttest_llcpp", |
| ":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", |
| ] |
| } |
| |
| fidl("fuchsia.device.restarttest") { |
| sources = [ "driver.host.restart.fidl" ] |
| public_deps = [ "//zircon/vdso/zx" ] |
| } |
| |
| bind_rules("driver-host-restart-bind") { |
| rules = "driver-host-restart.bind" |
| output = "driver-host-restart-bind.h" |
| deps = [ "//src/devices/bind/test.platform" ] |
| } |
| |
| driver_module("driver-host-restart-driver") { |
| sources = [ "host-restart-test-driver.cc" ] |
| deps = [ |
| ":driver-host-restart-bind", |
| ":fuchsia.device.restarttest_llcpp", |
| "//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", |
| "hot_reload_integration_test.cc", |
| "inspect_test.cc", |
| "proxy_iostate_test.cc", |
| ] |
| |
| deps = [ |
| ":common", |
| ":fuchsia.device.restarttest_llcpp", |
| "//sdk/fidl/fuchsia.device.manager", |
| "//sdk/fidl/fuchsia.device.test:fuchsia.device.test_llcpp", |
| "//sdk/lib/inspect/testing/cpp:zxtest", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl", |
| "//src/lib/storage/vfs/cpp:test_support", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/devmgr-integration-test", |
| "//zircon/system/ulib/driver-integration-test", |
| "//zircon/system/ulib/fidl-async:fidl-async-cpp", |
| "//zircon/system/ulib/service:service-llcpp", |
| ] |
| |
| # 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" ] |
| } |
| |
| 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-restart-driver", |
| ":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", |
| ] |
| |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |