| # Copyright 2024 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/component/config.gni") |
| import("//build/components.gni") |
| import("//build/drivers.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//sdk/ctf/build/ctf.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":basic-driver-test-latest" ] |
| } |
| |
| group("ctf-tests") { |
| testonly = true |
| # TODO(https://fxbug.dev/42073139): Re-enable after CTF tests only use stable APIs. |
| #deps = [ ":basic-driver-test_archive" ] |
| } |
| |
| group("drivers") { |
| testonly = true |
| deps = [ ":basic-driver-component" ] |
| } |
| |
| fidl("fuchsia.basicdriver.ctftest") { |
| testonly = true |
| sources = [ "basic_driver.test.fidl" ] |
| } |
| |
| driver_bind_rules("bind") { |
| rules = "meta/basic.bind" |
| bind_output = "basic.bindbc" |
| deps = [ "//src/devices/bind/fuchsia.test" ] |
| } |
| |
| fuchsia_cc_driver("basic-driver") { |
| testonly = true |
| output_name = "ctf_basic_driver" |
| sources = [ "src/basic_driver.cc" ] |
| deps = [ |
| ":bind", |
| ":fuchsia.basicdriver.ctftest_cpp", |
| "//sdk/lib/driver/component/cpp", |
| "//src/devices/lib/driver:driver_runtime", |
| ] |
| } |
| |
| fuchsia_driver_component("basic-driver-component") { |
| testonly = true |
| manifest = "meta/basic-driver.cml" |
| component_name = "basic-driver" |
| deps = [ ":basic-driver" ] |
| info = "meta/info.json" |
| } |
| |
| fuchsia_driver_package("basic-driver-pkg") { |
| testonly = true |
| package_name = "basic-driver-pkg" |
| driver_components = [ ":basic-driver-component" ] |
| } |
| |
| rustc_test("bin") { |
| edition = "2021" |
| source_root = "src/main.rs" |
| sources = [ source_root ] |
| name = "basic_driver_test" |
| deps = [ |
| ":fuchsia.basicdriver.ctftest_rust", |
| "//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution_rust", |
| "//sdk/fidl/fuchsia.component.test:fuchsia.component.test_rust", |
| "//sdk/fidl/fuchsia.driver.test:fuchsia.driver.test_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/lib/device-watcher/rust", |
| "//src/devices/testing/fidl:fuchsia.driver.testing_rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/testing/realm_client/rust", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| ] |
| } |
| |
| fuchsia_component("basic-driver-test-component") { |
| testonly = true |
| component_name = "test-suite" |
| manifest = "meta/test-suite.cml" |
| deps = [ ":bin" ] |
| } |
| |
| ctf_fuchsia_package("basic-driver-test") { |
| testonly = true |
| package_name = "basic-driver-test" |
| |
| # Subpackaged driver works! |
| subpackages = [ ":basic-driver-pkg" ] |
| |
| deps = [ |
| # Disabling the direct dependency, but this also works! |
| #":basic-driver-component", |
| ":basic-driver-test-component", |
| ] |
| } |
| |
| fuchsia_test_component("basic-driver-test-root") { |
| testonly = true |
| manifest = "meta/test-root.cml" |
| test_type = "ctf" |
| } |
| |
| fuchsia_test_package("basic-driver-test-latest") { |
| test_components = [ ":basic-driver-test-root" ] |
| subpackages = [ |
| "//src/devices/testing/realm-factory", |
| ":basic-driver-test", |
| ] |
| } |