| # 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/config/fuchsia/rules.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.gni") |
| |
| driver_module("xhci") { |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| sources = [ |
| "usb-xhci.cc", |
| "xhci-enumeration.cc", |
| "xhci-event-ring.cc", |
| "xhci-transfer-ring.cc", |
| ] |
| deps = [ |
| "//sdk/banjo/ddk.protocol.composite", |
| "//sdk/banjo/ddk.protocol.pci", |
| "//sdk/banjo/ddk.protocol.platform.device", |
| "//sdk/banjo/ddk.protocol.usb", |
| "//sdk/banjo/ddk.protocol.usb.bus", |
| "//sdk/banjo/ddk.protocol.usb.hci", |
| "//sdk/banjo/ddk.protocol.usb.hub", |
| "//sdk/banjo/ddk.protocol.usb.phy", |
| "//sdk/banjo/ddk.protocol.usb.request", |
| "//sdk/fidl/fuchsia.usb.debug:fuchsia.usb.debug_c", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/devices/lib/dma-buffer", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/mmio", |
| "//src/devices/lib/synchronous-executor", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/usb/lib/usb", |
| "//src/lib/ddk", |
| |
| # TODO(fxb/38132): Migrate to the new bind rules and delete the below |
| "//src/lib/ddk:ddk-deprecated-binding-headers", |
| "//src/lib/ddktl", |
| "//zircon/public/lib/async", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/hwreg", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxc", |
| "//zircon/public/lib/zxc", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/xdc-server-utils", |
| ] |
| } |
| |
| source_set("test-libs") { |
| testonly = true |
| public_deps = [ |
| "//sdk/banjo/ddk.protocol.acpi", |
| "//sdk/banjo/ddk.protocol.composite", |
| "//sdk/banjo/ddk.protocol.platform.bus", |
| "//sdk/banjo/ddk.protocol.platform.device", |
| "//sdk/banjo/ddk.protocol.serialimpl.async", |
| "//sdk/banjo/ddk.protocol.usb.hci", |
| "//sdk/banjo/ddk.protocol.usb.phy", |
| "//sdk/fidl/fuchsia.hardware.serial:fuchsia.hardware.serial_c", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/devices/bus/lib/device-protocol-platform-device", |
| "//src/devices/lib/dma-buffer", |
| "//src/devices/lib/mmio", |
| "//src/devices/lib/synchronous-executor", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/testing/fake-dma-buffer", |
| "//src/devices/testing/fake-mmio-reg", |
| "//src/devices/testing/fake_ddk", |
| "//src/devices/usb/lib/usb", |
| "//src/lib/ddk", |
| |
| # TODO(fxb/38132): Migrate to the new bind rules and delete the below |
| "//src/lib/ddk:ddk-deprecated-binding-headers", |
| "//src/lib/ddktl", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/hwreg", |
| "//zircon/public/lib/mock-function", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxc", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| test("xhci-unittest") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-unittest" |
| sources = [ |
| "xhci-enumeration-test.cc", |
| "xhci-enumeration.cc", |
| ] |
| deps = [ |
| ":test-libs", |
| "//zircon/system/ulib/mmio-ptr:mmio-ptr-fake", |
| ] |
| } |
| |
| test("xhci-core-unittest") { |
| if (is_fuchsia) { |
| configs += [ |
| "//build/unification/config:zircon-migrated", |
| "//build/config:all_source", |
| ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-core-unittest" |
| sources = [ |
| "usb-xhci-test.cc", |
| "usb-xhci.cc", |
| ] |
| deps = [ ":test-libs" ] |
| |
| # TODO(fxbug.dev/54318): Fix the leaks and remove this. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| test("xhci-event-ring-unittest") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-event-ring-unittest" |
| sources = [ |
| "xhci-event-ring-test.cc", |
| "xhci-event-ring.cc", |
| ] |
| deps = [ |
| ":test-libs", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| ] |
| |
| # TODO(fxbug.dev/54318): Fix the leaks and remove this. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| test("xhci-transfer-ring-unittest") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-transfer-ring-unittest" |
| sources = [ |
| "xhci-transfer-ring-test.cc", |
| "xhci-transfer-ring.cc", |
| ] |
| deps = [ ":test-libs" ] |
| |
| # TODO(fxbug.dev/54318): Fix the leaks and remove this. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| unittest_package("xhci-unittest-package") { |
| package_name = "xhci-unittest" |
| deps = [ ":xhci-unittest" ] |
| |
| tests = [ |
| { |
| name = "xhci-unittest" |
| environments = basic_envs |
| }, |
| ] |
| } |
| |
| unittest_package("xhci-core-unittest-package") { |
| package_name = "xhci-core-unittest" |
| deps = [ ":xhci-core-unittest" ] |
| |
| tests = [ |
| { |
| name = "xhci-core-unittest" |
| environments = basic_envs |
| }, |
| ] |
| } |
| |
| unittest_package("xhci-event-ring-unittest-package") { |
| package_name = "xhci-event-ring-unittest" |
| deps = [ ":xhci-event-ring-unittest" ] |
| |
| tests = [ |
| { |
| name = "xhci-event-ring-unittest" |
| environments = basic_envs |
| }, |
| ] |
| } |
| |
| unittest_package("xhci-transfer-ring-unittest-package") { |
| package_name = "xhci-transfer-ring-unittest" |
| deps = [ ":xhci-transfer-ring-unittest" ] |
| |
| tests = [ |
| { |
| name = "xhci-transfer-ring-unittest" |
| environments = basic_envs |
| }, |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":xhci-core-unittest-package", |
| ":xhci-event-ring-unittest-package", |
| ":xhci-transfer-ring-unittest-package", |
| ":xhci-unittest-package", |
| ] |
| } |