blob: ce60862fd77d3351dd44d78b0e140513b2871a39 [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/fidl/fidl.gni")
import("//build/test.gni")
import("//zircon/system/ulib/devmgr-integration-test/isolated_devmgr.gni")
test("platform-bus") {
output_name = "platform-bus-test"
sources = [ "main.cc" ]
deps = [
"//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_llcpp",
"//sdk/lib/fdio",
"//src/lib/ddk",
# TODO(fxb/38132): Migrate to the new bind rules and delete the below
"//src/lib/ddk:ddk-deprecated-binding-headers",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/devmgr-integration-test",
"//zircon/system/ulib/devmgr-launcher",
]
# 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("test-board-bind") {
rules = "test-board.bind"
output = "test-board-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-board") {
configs += [ "//build/config:all_source" ]
sources = [
"test-board.cc",
"test-clock.cc",
"test-goldfish.cc",
"test-gpio.cc",
"test-i2c.cc",
"test-power.cc",
"test-pwm.cc",
"test-rpmb.cc",
"test-spi.cc",
"test-vreg.cc",
"test.cc",
]
deps = [
":test-board-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/amlogic",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddk:ddk-metadata-headers",
# 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",
]
}
bind_rules("test-gpio-bind") {
rules = "test/test-gpio.bind"
output = "test-gpio-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-gpio") {
configs += [ "//build/config:all_source" ]
sources = [ "test/gpio.cc" ]
deps = [
":test-gpio-bind",
"//sdk/banjo/fuchsia.hardware.gpio",
"//sdk/banjo/fuchsia.hardware.gpioimpl",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-power-bind") {
rules = "test/test-power.bind"
output = "test-power-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-power") {
configs += [ "//build/config:all_source" ]
sources = [ "test/power.cc" ]
deps = [
":test-power-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/banjo/fuchsia.hardware.power",
"//sdk/banjo/fuchsia.hardware.powerimpl",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-goldfish-address-space-bind") {
rules = "test/test-goldfish-address-space.bind"
output = "test-goldfish-address-space-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-goldfish-address-space") {
configs += [ "//build/config:all_source" ]
sources = [ "test/goldfish_address_space.cc" ]
deps = [
":test-goldfish-address-space-bind",
"//sdk/banjo/fuchsia.hardware.goldfish.addressspace",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-goldfish-pipe-bind") {
rules = "test/test-goldfish-pipe.bind"
output = "test-goldfish-pipe-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-goldfish-pipe") {
configs += [ "//build/config:all_source" ]
sources = [ "test/goldfish_pipe.cc" ]
deps = [
":test-goldfish-pipe-bind",
"//sdk/banjo/fuchsia.hardware.goldfish.pipe",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-goldfish-sync-bind") {
rules = "test/test-goldfish-sync.bind"
output = "test-goldfish-sync-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-goldfish-sync") {
configs += [ "//build/config:all_source" ]
sources = [ "test/goldfish_sync.cc" ]
deps = [
":test-goldfish-sync-bind",
"//sdk/banjo/fuchsia.hardware.goldfish.sync",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-clock-bind") {
rules = "test/test-clock.bind"
output = "test-clock-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-clock") {
configs += [ "//build/config:all_source" ]
sources = [ "test/clock.cc" ]
deps = [
":test-clock-bind",
"//sdk/banjo/fuchsia.hardware.clock:fuchsia.hardware.clock_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.clockimpl",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-i2c-bind") {
rules = "test/test-i2c.bind"
output = "test-i2c-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-i2c") {
configs += [ "//build/config:all_source" ]
sources = [ "test/i2c.cc" ]
deps = [
":test-i2c-bind",
"//sdk/banjo/fuchsia.hardware.i2c",
"//sdk/banjo/fuchsia.hardware.i2cimpl",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-spi-bind") {
rules = "test/test-spi.bind"
output = "test-spi-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-spi") {
configs += [ "//build/config:all_source" ]
sources = [ "test/spi.cc" ]
deps = [
":test-spi-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/banjo/fuchsia.hardware.spi",
"//sdk/banjo/fuchsia.hardware.spiimpl",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-pwm-bind") {
rules = "test/test-pwm.bind"
output = "test-pwm-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-pwm") {
configs += [ "//build/config:all_source" ]
sources = [ "test/pwm.cc" ]
deps = [
":test-pwm-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/banjo/fuchsia.hardware.pwm",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-rpmb-bind") {
rules = "test/test-rpmb.bind"
output = "test-rpmb-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-rpmb") {
configs += [ "//build/config:all_source" ]
sources = [ "test/rpmb.cc" ]
deps = [
":test-rpmb-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/banjo/fuchsia.hardware.rpmb",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-vreg-bind") {
rules = "test/test-vreg.bind"
output = "test-vreg-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-vreg") {
configs += [ "//build/config:all_source" ]
sources = [ "test/vreg.cc" ]
deps = [
":test-vreg-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/banjo/fuchsia.hardware.vreg",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddk:ddk-deprecated-binding-headers",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
bind_rules("test-composite-bind") {
rules = "test/test-composite.bind"
output = "test-composite-bind.h"
deps = [ "//src/devices/bind/test.platform" ]
}
driver_module("test-composite") {
configs += [ "//build/config:all_source" ]
sources = [ "test/composite.c" ]
deps = [
":test-composite-bind",
"//sdk/banjo/fuchsia.hardware.clock:fuchsia.hardware.clock_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.goldfish.addressspace",
"//sdk/banjo/fuchsia.hardware.goldfish.pipe",
"//sdk/banjo/fuchsia.hardware.goldfish.sync",
"//sdk/banjo/fuchsia.hardware.gpio",
"//sdk/banjo/fuchsia.hardware.i2c",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/banjo/fuchsia.hardware.power",
"//sdk/banjo/fuchsia.hardware.pwm",
"//sdk/banjo/fuchsia.hardware.rpmb",
"//sdk/banjo/fuchsia.hardware.spi",
"//sdk/banjo/fuchsia.hardware.vreg",
"//sdk/fidl/fuchsia.hardware.spi:fuchsia.hardware.spi_c",
"//src/devices/i2c/lib/device-protocol-i2c",
"//src/devices/lib/driver",
"//src/lib/ddk",
# TODO(fxb/38132): Migrate to the new bind rules and delete the below
"//src/lib/ddk:ddk-deprecated-binding-headers",
"//zircon/public/lib/sync",
"//zircon/system/ulib/spi",
]
}
bind_rules("test-child-2.proxy-bind") {
output = "test-child-2.proxy-bind.h"
disable_autobind = true
}
driver_module("test-child-2.proxy") {
configs += [ "//build/config:all_source" ]
sources = [ "test/child-2.proxy.c" ]
deps = [
":test-child-2.proxy-bind",
"//src/devices/lib/driver",
"//src/lib/ddk",
]
}
simple_drivers = [
"child-1",
"child-2",
"child-3",
"parent",
]
foreach(driver, simple_drivers) {
bind_rules("test-${driver}-bind") {
rules = "test/test-${driver}.bind"
output = "test-${driver}-bind.h"
deps = [ "//src/devices/bind/test.platform" ]
}
driver_module("test-$driver") {
configs += [ "//build/config:all_source" ]
sources = [ "test/$driver.c" ]
deps = [
":test-${driver}-bind",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/lib/driver",
"//src/lib/ddk",
# TODO(fxb/38132): Migrate to the new bind rules and delete the below
"//src/lib/ddk:ddk-deprecated-binding-headers",
]
}
}
isolated_devmgr_unittest_package("platform-bus-test") {
executable_path = "test/platform-bus-test"
deps = [
":platform-bus",
":test-board",
":test-child-2.proxy",
":test-clock",
":test-composite",
":test-goldfish-address-space",
":test-goldfish-pipe",
":test-goldfish-sync",
":test-gpio",
":test-i2c",
":test-power",
":test-pwm",
":test-rpmb",
":test-spi",
":test-vreg",
"//src/devices/bus/drivers/platform",
"//src/devices/clock/drivers/clock",
"//src/devices/gpio/drivers/gpio",
"//src/devices/i2c/drivers/i2c",
"//src/devices/internal/drivers/fragment",
"//src/devices/power/drivers/power",
"//src/devices/pwm/drivers/pwm",
"//src/devices/spi/drivers/spi",
]
foreach(driver, simple_drivers) {
deps += [ ":test-$driver" ]
}
}
fidl("fuchsia.hardware.btitest") {
sources = [ "bti.test.fidl" ]
}
bind_rules("test-bti-board-bind") {
rules = "test-bti-board.bind"
output = "test-bti-board-bind.h"
deps = [
"//src/devices/bind/fuchsia.platform",
"//src/devices/bind/test.platform",
]
}
driver_module("test-bti-board") {
configs += [ "//build/config:all_source" ]
sources = [ "test-bti-board.cc" ]
deps = [
":test-bti-board-bind",
"//sdk/banjo/fuchsia.hardware.platform.bus",
"//src/devices/lib/driver",
"//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",
]
}
bind_rules("test-bti-bind") {
rules = "test-bti.bind"
output = "test-bti-bind.h"
deps = [ "//src/devices/bind/test.platform" ]
}
driver_module("test-bti") {
configs += [ "//build/config:all_source" ]
sources = [ "test-bti.cc" ]
deps = [
":fuchsia.hardware.btitest_llcpp",
":test-bti-bind",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//src/devices/bus/lib/device-protocol-pdev",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
]
}
test("platform-bus-bti") {
output_name = "platform-bus-bti-test"
sources = [ "bti-test.cc" ]
deps = [
":fuchsia.hardware.btitest_llcpp",
"//sdk/lib/fdio",
"//src/lib/ddk",
# TODO(fxb/38132): Migrate to the new bind rules and delete the below
"//src/lib/ddk:ddk-deprecated-binding-headers",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/devmgr-integration-test",
"//zircon/system/ulib/devmgr-launcher",
]
# 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" ]
}
isolated_devmgr_unittest_package("platform-bus-bti-test") {
executable_path = "test/platform-bus-bti-test"
services = [ "fuchsia.boot.RootResource" ]
deps = [
":platform-bus-bti",
":test-bti",
":test-bti-board",
"//src/devices/bus/drivers/platform",
"//src/devices/internal/drivers/fragment",
]
}