Version: v6.0.0+incompatible Latest Latest

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 19 Imported by: 0




This section is empty.


This section is empty.


func GolangTest

func GolangTest(t *testing.T, pkgs []string, o *Options)

GolangTest compiles the unit tests found in pkgs and runs them in a QEMU VM.

func JSONLessTestLineWriter

func JSONLessTestLineWriter(tb testing.TB, prefix string) io.WriteCloser

func QEMU

func QEMU(o *Options) (*qemu.Options, string, error)

QEMU builds the u-root environment and prepares QEMU options given the test options and environment variables.

QEMU will augment o.BuildOpts and o.QEMUOpts with configuration that the caller either requested (through the Options.Uinit field, for example) or that the caller did not set.

QEMU returns the QEMU launch options, the temporary directory exposed to the QEMU VM, or an error.

func QEMUTest

func QEMUTest(t *testing.T, o *Options) (*qemu.VM, func())

func SkipWithoutQEMU

func SkipWithoutQEMU(t *testing.T)

SkipWithoutQEMU skips the test when the QEMU environment variables are not set. This is already called by QEMUTest(), so use if some expensive operations are performed before calling QEMUTest().

func TestArch

func TestArch() string

TestArch returns the architecture under test. Pass this as GOARCH when building Go programs to be run in the QEMU environment.

func TestLineWriter

func TestLineWriter(tb testing.TB, prefix string) io.WriteCloser

TestLineWriter is an io.Writer that logs full lines of serial to tb.


type Options

type Options struct {
	// BuildOpts are u-root initramfs options.
	// Fields that are not set are populated by QEMU and QEMUTest as
	// possible.
	BuildOpts uroot.Opts

	// QEMUOpts are QEMU VM options for the test.
	// Fields that are not set are populated by QEMU and QEMUTest as
	// possible.
	QEMUOpts qemu.Options

	// DontSetEnv doesn't set the BuildOpts.Env and uses the user-supplied one.
	// TODO: make uroot.Opts.Env a pointer?
	DontSetEnv bool

	// Name is the test's name.
	// If name is left empty, the calling function's function name will be
	// used as determined by runtime.Caller.
	Name string

	// Uinit are commands to execute after init.
	// If populated, a uinit.go will be generated from these and added to
	// the busybox generated in BuildOpts.Commands.
	Uinit []string

	// Logger logs build statements.
	Logger logger.Logger

	// Extra environment variables to set when building (used by u-bmc)
	ExtraBuildEnv []string

	// Use virtual vfat rather than 9pfs
	UseVVFAT bool

Options are integration test options.


Path Synopsis

Jump to

Keyboard shortcuts

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