qemu

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package qemu is suitable for running QEMU-based integration tests.

The environment variable `UROOT_QEMU` overrides the path to QEMU and the first few arguments (defaults to "qemu"). For example, I use:

UROOT_QEMU='qemu-system-x86_64 -L . -m 4096 -enable-kvm'

For CI, this environment variable is set in `.circleci/images/integration/Dockerfile`.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTimeout = 7 * time.Second

DefaultTimeout for `Expect` and `ExpectRE` functions.

View Source
var TimeoutMultiplier = 2.0

TimeoutMultiplier increases all timeouts proportionally. Useful when running QEMU on a slow machine.

Functions

This section is empty.

Types

type QEMU

type QEMU struct {
	// Path to the bzImage kernel
	Kernel string

	// Path to the initramfs
	InitRAMFS string

	// Extra kernel arguments
	KernelArgs string

	// Extra QEMU arguments
	ExtraArgs []string
	// contains filtered or unexported fields
}

QEMU is filled and pass to `Start()`.

func (*QEMU) Close

func (q *QEMU) Close()

Close stops QEMU.

func (*QEMU) CmdLine

func (q *QEMU) CmdLine() []string

CmdLine returns the command line arguments used to start QEMU. These arguments are derived from the given QEMU struct.

func (*QEMU) CmdLineQuoted

func (q *QEMU) CmdLineQuoted() (cmdline string)

CmdLineQuoted quotes any of QEMU's command line arguments containing a space so it is easy to copy-n-paste into a shell for debugging.

func (*QEMU) Expect

func (q *QEMU) Expect(search string) error

Expect returns an error if the given string is not found in QEMU's serial output within `DefaultTimeout`.

func (*QEMU) ExpectRE

func (q *QEMU) ExpectRE(pattern *regexp.Regexp) error

ExpectRE returns an error if the given regular expression is not found in QEMU's serial output within `DefaultTimeout`.

func (*QEMU) ExpectRETimeout

func (q *QEMU) ExpectRETimeout(pattern *regexp.Regexp, timeout time.Duration) error

ExpectRETimeout returns an error if the given regular expression is not found in QEMU's serial output within the given timeout.

func (*QEMU) ExpectTimeout

func (q *QEMU) ExpectTimeout(search string, timeout time.Duration) error

ExpectTimeout returns an error if the given string is not found in QEMU's serial output within the given timeout.

func (*QEMU) Send

func (q *QEMU) Send(in string)

Send sends a string to QEMU's serial.

func (*QEMU) Start

func (q *QEMU) Start() error

Start QEMU.

Jump to

Keyboard shortcuts

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