blob: d8b6a3544fd360acef4e0d4851942e7b42f75e05 [file] [log] [blame]
// 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.device.test;
using zx;
/// The path which can be used to open the control device.
/// This path is relative to /dev/.
const CONTROL_DEVICE string = "sys/test/test";
/// Returns the result summary of a test run
type TestReport = struct {
/// Total number of tests
test_count uint32;
/// Number of successful tests
success_count uint32;
/// Number of failed tests
failure_count uint32;
};
protocol Test {
/// Execute the tests for this device. Returns the status from the test. If
/// used as part of the Device protocol then Test output will be streamed to
/// the socket set by SetOutputSocket().
RunTests() -> (struct {
status zx.status;
report TestReport;
});
};
/// Interface for controlling a device created via RootDevice.CreateDevice
protocol Device {
compose Test;
/// Set a socket to stream test output to.
SetOutputSocket(resource struct {
sock zx.handle:SOCKET;
});
/// Set a channel for the test to use in a test-specific manner.
SetChannel(resource struct {
chan zx.handle:CHANNEL;
});
/// Unload this device.
Destroy();
};
/// Maximum device name len. This value must match `ZX_DEVICE_NAME_MAX`.
const MAX_DEVICE_NAME_LEN uint32 = 31;
/// Interface for creating devices within a devhost.
protocol RootDevice {
/// Create a device with the given `name` that is a child of this device.
CreateDevice(resource struct {
name string:MAX_DEVICE_NAME_LEN;
}) -> () error zx.status;
};