| # Copyright 2023 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("//build/fidl/fidl.gni") |
| import("//build/test.gni") |
| import("//build/testing/environments.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":driver-host-tests" ] |
| } |
| |
| driver_bind_rules("test-devhost-parent-bind") { |
| rules = "test-devhost-parent.bind" |
| deps = [ "//src/devices/bind/fuchsia.test.platform" ] |
| } |
| |
| fuchsia_driver("driver-host-test-driver-driver") { |
| output_name = "driver-host-test-driver" |
| sources = [ "test-driver.cc" ] |
| deps = [ |
| ":fuchsia.device.restarttest_cpp_wire", |
| ":test-devhost-parent-bind", |
| "//sdk/lib/fdio", |
| "//src/devices/lib/driver", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/fbl", |
| ] |
| } |
| |
| fuchsia_driver_component("driver-host-test-driver") { |
| component_name = "driver-host-test-driver" |
| deps = [ ":driver-host-test-driver-driver" ] |
| info = "driver-host-test-driver-info.json" |
| manifest = "meta/driver-host-test-driver.cml" |
| } |
| |
| driver_bind_rules("test-devhost-child-bind") { |
| rules = "test-devhost-child.bind" |
| deps = [ "//src/devices/bind/fuchsia.test" ] |
| } |
| |
| fuchsia_driver("driver-host-test-child-driver-driver") { |
| output_name = "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", |
| "//zircon/system/ulib/fbl", |
| ] |
| } |
| |
| fuchsia_driver_component("driver-host-test-child-driver") { |
| component_name = "driver-host-test-child-driver" |
| deps = [ ":driver-host-test-child-driver-driver" ] |
| info = "driver-host-test-child-driver-info.json" |
| manifest = "meta/driver-host-test-child-driver.cml" |
| } |
| |
| fidl("fuchsia.device.restarttest") { |
| sources = [ "driver.host.restart.fidl" ] |
| public_deps = [ "//zircon/vdso/zx" ] |
| } |
| |
| driver_bind_rules("driver-host-restart-bind") { |
| rules = "driver-host-restart.bind" |
| deps = [ "//src/devices/bind/fuchsia.test.platform" ] |
| } |
| |
| fuchsia_driver("driver-host-restart-driver-driver") { |
| output_name = "driver-host-restart-driver" |
| sources = [ "host-restart-test-driver.cc" ] |
| deps = [ |
| ":driver-host-restart-bind", |
| ":fuchsia.device.restarttest_cpp_wire", |
| "//sdk/lib/fdio", |
| "//src/devices/lib/driver", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/fbl", |
| ] |
| } |
| |
| fuchsia_driver_component("driver-host-restart-driver") { |
| component_name = "driver-host-restart-driver" |
| deps = [ ":driver-host-restart-driver-driver" ] |
| info = "driver-host-restart-driver-info.json" |
| manifest = "meta/driver-host-restart-driver.cml" |
| } |
| |
| test("integration_tests") { |
| output_name = "driver_host_integration_tests" |
| sources = [ |
| "device_controller_integration_test.cc", |
| "hot_reload_integration_test.cc", |
| ] |
| |
| deps = [ |
| ":fuchsia.device.restarttest_cpp_wire", |
| "//sdk/fidl/fuchsia.device.test:fuchsia.device.test_cpp_wire", |
| "//sdk/fidl/fuchsia.driver.development:fuchsia.driver.development_cpp_wire", |
| "//sdk/lib/async_patterns/testing/cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/inspect/testing/cpp:zxtest", |
| "//sdk/lib/sys/cpp", |
| "//src/devices/bin/driver_host:common", |
| "//src/devices/testing/devmgr-integration-test-shim", |
| "//src/devices/testing/driver-integration-test-shim", |
| "//src/lib/fxl", |
| "//src/lib/storage/vfs/cpp:test_support", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_component("driver_host_integration_tests") { |
| # The test itself |
| deps = [ ":integration_tests" ] |
| |
| # Driver components the test depends on |
| deps += [ |
| ":driver-host-test-child-driver", |
| ":driver-host-test-driver", |
| ":unit-test-fail", |
| ":unit-test-pass", |
| "//src/devices/board/drivers/integration-test", |
| "//src/devices/bus/drivers/platform", |
| "//src/devices/misc/drivers/test", |
| "//src/devices/misc/drivers/test-parent", |
| ] |
| } |
| |
| test("driver_host_test") { |
| sources = [ |
| "core_test.cc", |
| "device_api_test.cc", |
| "device_controller_connection_test.cc", |
| "driver_host_test.cc", |
| "inspect_test.cc", |
| "proxy_iostate_test.cc", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.device.fs:fuchsia.device.fs_cpp_wire", |
| "//sdk/lib/async_patterns/testing/cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/inspect/testing/cpp:zxtest", |
| "//sdk/lib/sys/cpp", |
| "//src/devices/bin/driver_host:common", |
| "//src/lib/fxl", |
| "//src/lib/storage/vfs/cpp:test_support", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_component("driver_host_unittests") { |
| deps = [ ":driver_host_test" ] |
| } |
| |
| driver_bind_rules("unit-test-fail-bind") { |
| rules = "unit-test-fail.bind" |
| deps = [ "//src/devices/bind/fuchsia.test" ] |
| } |
| |
| fuchsia_driver("unit-test-fail-driver") { |
| output_name = "unit-test-fail" |
| sources = [ "unit-test-fail.cc" ] |
| deps = [ |
| ":unit-test-fail-bind", |
| "//src/devices/lib/driver", |
| "//src/lib/ddk", |
| ] |
| } |
| |
| fuchsia_driver_component("unit-test-fail") { |
| component_name = "unit-test-fail" |
| deps = [ ":unit-test-fail-driver" ] |
| info = "unit-test-fail-info.json" |
| manifest = "meta/unit-test-fail.cml" |
| } |
| |
| driver_bind_rules("unit-test-pass-bind") { |
| rules = "unit-test-pass.bind" |
| deps = [ "//src/devices/bind/fuchsia.test" ] |
| } |
| |
| fuchsia_driver("unit-test-pass-driver") { |
| output_name = "unit-test-pass" |
| sources = [ "unit-test-pass.cc" ] |
| deps = [ |
| ":unit-test-pass-bind", |
| "//src/devices/lib/driver", |
| "//src/lib/ddk", |
| ] |
| } |
| |
| fuchsia_driver_component("unit-test-pass") { |
| component_name = "unit-test-pass" |
| deps = [ ":unit-test-pass-driver" ] |
| info = "unit-test-pass-info.json" |
| manifest = "meta/unit-test-pass.cml" |
| } |
| |
| fuchsia_test_package("driver-host-tests") { |
| test_components = [ |
| ":driver_host_unittests", |
| ":driver_host_integration_tests", |
| ] |
| |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |