Documentation
¶
Overview ¶
Package module provides a plugin system for the DUT package. Modules are the building blocks of a command and host the actual implementation of the steps that are executed on a device-under-test (DUT). The core of the plugin system is the Module interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Info ¶
type Info struct {
// ID is the unique identifier of the module.
// It is used to reference the module in the dutagent configuration.
ID string
// New is the factory function that creates a new instance of the module.
New func() Module
}
Info holds the information required to register a module.
type Module ¶
type Module interface {
// Help returns a formatted string with the capabilities of the module.
// It provides any user information required to interact with the module.
Help() string
// Init is called when the module is loaded by dutagent on an execution request for a command that uses this module.
Init() error
// Deinit is called when the module is unloaded by dutagent after the execution of a command that uses this module.
// It is used to clean up any resources that were allocated during the Init phase.
Deinit() error
// Run is the entry point and executes the module with the given arguments.
Run(ctx context.Context, s Session, args ...string) error
}
Module is a building block of a command running on a device-under-test (DUT). Implementations of this interface are the actual steps that are executed on a DUT.
type Session ¶
type Session interface {
Print(text string)
Console() (stdin io.Reader, stdout, stderr io.Writer)
RequestFile(name string) (io.Reader, error)
SendFile(name string, r io.Reader) error
}
Session provides an environment / a context for a module. Via the Session interface, modules can interact with the client during execution.
Click to show internal directories.
Click to hide internal directories.