| // 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. |
| |
| library fuchsia.driver.test; |
| |
| using fuchsia.component.resolution; |
| using fuchsia.io; |
| using zx; |
| |
| // These lengths match the corresponding config capabilities in the driver index cml. |
| @available(added=HEAD) |
| const MAX_DRIVER_URL uint32 = 150; |
| @available(added=HEAD) |
| const MAX_DRIVERS uint32 = 200; |
| |
| /// This protocol is served when running with the driver_test_realm to be used by the |
| /// fake-resolver component to access the various directories and metadata of the test it needs. |
| @available(added=HEAD) |
| @discoverable |
| closed protocol Internal { |
| /// Gets the test component's package directory. This is used to read drivers in this package. |
| /// If a test resolution context is available through |GetTestResolutionContext|, subpackages |
| /// in this test package are also discovered. |
| strict GetTestPackage() -> (resource struct { |
| test_pkg_dir client_end:<fuchsia.io.Directory, optional>; |
| }) error zx.Status; |
| |
| /// Gets the test component's resolution context. This is used to open subpackages of the |
| /// test package. |
| strict GetTestResolutionContext() -> (struct { |
| context box<fuchsia.component.resolution.Context>; |
| }) error zx.Status; |
| |
| /// Get the '/boot' directory to be used for the "fuchsia-boot:///" resolver. |
| /// If an invalid |boot_dir| is returned, the driver test realm's '/pkg' directory is |
| /// treated as the boot directory. |
| strict GetBootDirectory() -> (resource struct { |
| boot_dir client_end:<fuchsia.io.Directory, optional>; |
| }) error zx.Status; |
| |
| strict GetBootDriverOverrides() -> (struct { |
| boot_overrides vector<string:MAX_DRIVER_URL>:MAX_DRIVERS; |
| }) error zx.Status; |
| }; |
| |
| |
| /// This protocol is served when running with the driver_test_realm to be used by the |
| /// driver index to dynamically get the list of drivers. |
| @available(added=HEAD) |
| @discoverable |
| closed protocol DriverLists { |
| // Gets the list of drivers to be indexed. |
| strict GetDriverLists() -> (struct { |
| boot_drivers vector<string:MAX_DRIVER_URL>:MAX_DRIVERS; |
| base_drivers vector<string:MAX_DRIVER_URL>:MAX_DRIVERS; |
| }) error zx.Status; |
| }; |