Version: v4.0.0+incompatible Latest Latest

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

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


Integration Tests

This tests core use cases for u-root such as:

  • retrieving and kexec'ing a Linux kernel,
  • uinit (user init), and
  • running unit tests requiring root privileges.


Run the tests with:

go test

When the QEMU arch is not amd64, set the UROOT_TESTARCH variable. For example:

UROOT_TESTARCH=arm go test

Currently, only amd64 and arm are supported.


  • QEMU
    • Path and arguments must be set with UROOT_QEMU.
    • Example: export UROOT_QEMU="$HOME/bin/qemu-system-x86_64 -L ."
  • Linux kernel
    • Path and arguments must be set with UROOT_KERNEL.
    • Example: export UROOT_KERNEL="$HOME/linux/arch/x86_64/boot/bzImage"




This section is empty.


This section is empty.


func QEMU

func QEMU(o *Options) (*qemu.Options, 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.


type Options

type Options struct {
	// Env is the Go environment to use to build u-root.
	Env *golang.Environ

	// 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

	// Go commands to include in the initramfs for the VM.
	// If left empty, all u-root commands will be included.
	Cmds []string

	// Uinit are commands to execute after init.
	// If populated, a uinit.go will be generated from these.
	Uinit []string

	// Files are files to include in the VMs initramfs.
	Files []string

	// TmpDir is a temporary directory for build artifacts.
	TmpDir string

	// LogFile is a file to log serial output to.
	// The default is serial/$Name.log
	LogFile string

	// Logger logs build statements.
	Logger logger.Logger

	// Timeout is the timeout for expect statements.
	Timeout time.Duration

	// Network is the VM's network.
	Network *qemu.Network

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

	// Serial Output
	SerialOutput io.WriteCloser

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