console

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package console provides an API to interact with the serial console of a DUT.

To capture the contents of the serial console to a file, use the Console.StartCapture method:

stdoutFile, err := os.Create("stdout.log")
if err != nil {
	return err
}
stderrFile, err := os.Create("stderr.log")
if err != nil {
	return err
}
dut.Console().StartCapture(t, stdoutFile, stderrFile)

StartCapture automatically registers a test cleanup function to stop the capture, but if a test needs fine-grained control over when precisely it is stopped, it can call the StopCaptureFunc function returned by StartCapture:

stopFn := dut.Console().StartCapture(t, stdoutFile, stderrFile)
doStuffToTriggerConsoleOutput()
stopFn(t)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

type Console struct {
	// contains filtered or unexported fields
}

Console is the device Console API.

func New

func New(dut binding.DUT) *Console

New constructs a new instance of the Console API. Tests must not call this directly

func (*Console) StartCapture

func (c *Console) StartCapture(t testing.TB, outw, errw io.Writer) StopCaptureFunc

StartCapture starts copying console stdout and stderr to outw and errw, respectively. It registers a cleanup function to stop the capture but also returns that same function, in case the user wants to stop it earlier.

type StopCaptureFunc

type StopCaptureFunc func(t testing.TB)

StopCaptureFunc is a function that stops copying console stdout and stderr

Jump to

Keyboard shortcuts

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