blob: f41ce8e4f976fd670e69c3fd81a0cf8c3aae68e2 [file] [log] [blame]
# Copyright 2022 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/rust/rustc_test.gni")
import("//build/test.gni")
group("bindlib-codegen-test") {
testonly = true
deps = [
":bindlib-codegen-rust-test-pkg",
":bindlib-codegen-test-pkg",
]
}
test("test") {
output_name = "bindlib-codegen-test"
sources = [ "bindlib-codegen-test.cc" ]
deps = [
":bindlib.codegen.testlib_cpp",
":bindlibparent.codegen.testlib_cpp",
"//sdk/fidl/fuchsia.device:fuchsia.device_cpp",
"//sdk/fidl/fuchsia.device.test:fuchsia.device.test_cpp",
"//sdk/fidl/fuchsia.driver.development:fuchsia.driver.development_hlcpp",
"//sdk/fidl/fuchsia.driver.test:fuchsia.driver.test_hlcpp",
"//sdk/lib/device-watcher/cpp",
"//sdk/lib/driver_test_realm/realm_builder/cpp",
"//sdk/lib/fdio",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/cpp",
"//src/devices/bind/fuchsia:fuchsia_cpp",
"//src/lib/ddk",
"//src/lib/fxl",
"//src/lib/fxl/test:gtest_main",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/fbl",
]
}
fuchsia_unittest_package("bindlib-codegen-test-pkg") {
deps = [
":child-driver",
":parent-driver",
":test",
"//src/devices/misc/drivers/test-parent",
]
}
fuchsia_unittest_package("bindlib-codegen-rust-test-pkg") {
deps = [ ":bindlib-codegen-rust-test" ]
}
bind_library("bindlibparent.codegen.testlib") {
source = "testbindlib_parent.bind"
}
bind_library("bindlib.codegen.testlib") {
source = "testbindlib.bind"
public_deps = [
":bindlibparent.codegen.testlib",
"//src/devices/bind/fuchsia.pci",
]
}
driver_bind_rules("parent-driver-bind") {
rules = "parent-driver.bind"
deps = [ "//src/devices/bind/fuchsia.test" ]
}
fuchsia_driver("parent-driver-driver") {
output_name = "bindlib-codegen-parent"
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
sources = [ "parent-driver.cc" ]
deps = [
":bindlib.codegen.testlib_cpp",
":bindlibparent.codegen.testlib_cpp",
":parent-driver-bind",
"//src/devices/bind/fuchsia:fuchsia_cpp",
"//src/devices/lib/driver",
"//src/lib/ddk",
]
}
fuchsia_driver_component("parent-driver") {
component_name = "bindlib-codegen-parent"
deps = [ ":parent-driver-driver" ]
info = "parent-driver-info.json"
manifest = "meta/parent-driver.cml"
}
driver_bind_rules("child-driver-bind") {
rules = "child-driver.bind"
deps = [
":bindlib.codegen.testlib",
":bindlibparent.codegen.testlib",
"//src/devices/bind/fuchsia.test",
]
}
fuchsia_driver("child-driver-driver") {
output_name = "bindlib-codegen-child"
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
sources = [ "child-driver.cc" ]
deps = [
":child-driver-bind",
"//src/devices/lib/driver",
"//src/lib/ddk",
]
}
fuchsia_driver_component("child-driver") {
component_name = "bindlib-codegen-child"
deps = [ ":child-driver-driver" ]
info = "child-driver-info.json"
manifest = "meta/child-driver.cml"
}
rustc_test("bindlib-codegen-rust-test") {
edition = "2021"
testonly = true
source_root = "rust_test.rs"
sources = [ "rust_test.rs" ]
deps = [
":bindlib.codegen.testlib_rust",
"//src/lib/fuchsia-async",
"//third_party/rust_crates:anyhow",
]
}