| // Copyright 2018 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.hardware.test; |
| |
| using zx; |
| |
| type TestReport = struct { |
| n_tests uint32; |
| n_success uint32; |
| n_failed uint32; |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-callback") |
| closed protocol TestFuncCallback { |
| strict Callback() -> (struct { |
| s zx.Status; |
| report TestReport; |
| }); |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| closed protocol Test { |
| /// Sets test output socket. |
| strict SetOutputSocket(resource struct { |
| handle zx.Handle:SOCKET; |
| }) -> (); |
| |
| /// Gets test output socket. |
| strict GetOutputSocket() -> (resource struct { |
| h zx.Handle:SOCKET; |
| }); |
| |
| /// Gets test channel. This has per-test meaning. |
| strict GetChannel() -> (resource struct { |
| h zx.Handle:CHANNEL; |
| }); |
| |
| /// Sets test function. |
| strict SetTestFunc(resource struct { |
| func client_end:TestFuncCallback; |
| }) -> (); |
| |
| /// Run tests, calls the function set in |SetTestFunc|. |
| strict RunTests() -> (struct { |
| s zx.Status; |
| report TestReport; |
| }); |
| |
| /// Calls `device_remove()`. |
| strict Destroy() -> (); |
| }; |