| # 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_llcpp", |
| "//sdk/fidl/fuchsia.device.test:fuchsia.device.test_llcpp", |
| "//sdk/fidl/fuchsia.driver.development", |
| "//sdk/lib/device-watcher/cpp", |
| "//sdk/lib/driver_test_realm/simple", |
| "//sdk/lib/fdio", |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/ddk", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| ] |
| } |
| |
| 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 = [ |
| # TODO(fxb/95933): depend on bindlibparent when we start using it. |
| "//src/devices/bind/fuchsia.pci", |
| ] |
| } |
| |
| driver_bind_rules("parent-driver-bind") { |
| rules = "parent-driver.bind" |
| header_output = "parent-driver-bind.h" |
| 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/lib/driver", |
| "//src/lib/ddk", |
| ] |
| } |
| |
| fuchsia_driver_component("parent-driver") { |
| component_name = "bindlib-codegen-parent" |
| deps = [ ":parent-driver-driver" ] |
| info = "parent-driver-info.json" |
| colocate = true |
| } |
| |
| driver_bind_rules("child-driver-bind") { |
| rules = "child-driver.bind" |
| header_output = "child-driver-bind.h" |
| 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" |
| colocate = true |
| } |
| |
| 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", |
| ] |
| } |