dut

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package dut provides representation of the device-under-test (DUT).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeviceNotFound  = errors.New("no such device")
	ErrCommandNotFound = errors.New("no such command")
	ErrInvalidCommand  = errors.New("command not implemented - no modules or no main module set")
)
View Source
var ErrModuleValidation = errors.New("validation error")

Functions

This section is empty.

Types

type Command

type Command struct {
	Desc    string
	Modules []Module
}

Command represents a task that can be executed on a device-under-test (DUT). This task is composed of one or multiple steps. The steps are implemented by modules and are executed in the order they are defined.

func (*Command) UnmarshalYAML

func (c *Command) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML unmarshals a Command from a YAML node and adds custom validation.

type Device

type Device struct {
	Desc string
	Cmds map[string]Command
}

Device is the representation of a device-under-test (DUT).

type Devlist added in v0.1.0

type Devlist map[string]Device

Devlist is a list of devices-under-test.

func (Devlist) CmdNames added in v0.2.0

func (devs Devlist) CmdNames(device string) ([]string, error)

CmdNames returns the names of all commands available for a device or ErrDeviceNotFound if the device is not found. The names are sorted alphabetically. A device with no commands will not report an error but return an empty slice.

func (Devlist) FindCmd added in v0.2.0

func (devs Devlist) FindCmd(device, command string) (Device, Command, error)

FindCmd returns the device and command for a given device and command name. If the device is not found, it returns ErrDeviceNotFound, if the command is not found, it returns ErrCommandNotFound. If the requested command has no modules, or no main module, it returns ErrInvalidCommand.

func (Devlist) Names added in v0.1.0

func (devs Devlist) Names() []string

Names returns the names of all devices in the list. The names are sorted alphabetically.

type Module

type Module struct {
	Config ModuleConfig

	module.Module
}

Module is a wrapper for any module implementation.

func (*Module) UnmarshalYAML

func (m *Module) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML unmarshals a Module from a YAML node and adds custom validation.

type ModuleConfig

type ModuleConfig struct {
	Name    string `yaml:"module"`
	Main    bool
	Args    string
	Options map[string]any
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL