boottest

package
v0.0.0-...-2fb355d Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMockModel

func MakeMockModel(overrides ...map[string]interface{}) *asserts.Model

func MakeMockUC20Model

func MakeMockUC20Model(overrides ...map[string]interface{}) *asserts.Model

func MockDevice

func MockDevice(s string) boot.Device

MockDevice implements boot.Device. It wraps a string like <boot-snap-name>[@<mode>], no <boot-snap-name> means classic, empty <mode> defaults to "run" for UC16/18. If mode is set HasModeenv returns true for UC20 and an empty boot snap name panics. It returns <boot-snap-name> for both Base and Kernel, for more control mock a DeviceContext.

func MockUC20Device

func MockUC20Device(mode string, model *asserts.Model) boot.Device

MockUC20Device implements boot.Device and returns true for HasModeenv. Arguments are mode (empty means "run"), and model. If model is nil a default model is used (same as MakeMockUC20Model).

Types

type Bootenv16

type Bootenv16 struct {
	*bootloadertest.MockBootloader
	// contains filtered or unexported fields
}

Bootenv16 implements manipulating a UC16/18 boot env for testing.

func MockUC16Bootenv

func MockUC16Bootenv(b *bootloadertest.MockBootloader) *Bootenv16

MockUC16Bootenv wraps a mock bootloader for UC16/18 boot env manipulation.

func MockUC20EnvRefExtractedKernelRunBootenv

func MockUC20EnvRefExtractedKernelRunBootenv(b *bootloadertest.MockBootloader) *Bootenv16

MockUC20EnvRefExtractedKernelRunBootenv wraps a mock bootloader for UC20 run-mode boot env manipulation.

func (Bootenv16) SetBootBase

func (b16 Bootenv16) SetBootBase(base string)

SetBootBase sets the current boot base string. Should be something like "core_1234.snap".

func (Bootenv16) SetBootKernel

func (b16 Bootenv16) SetBootKernel(kernel string)

SetBootKernel sets the current boot kernel string. Should be something like "pc-kernel_1234.snap".

func (Bootenv16) SetBootTryKernel

func (b16 Bootenv16) SetBootTryKernel(kernel string)

SetBootTryKernel sets the try boot kernel string. Should be something like "pc-kernel_1235.snap".

func (Bootenv16) SetRollbackAcrossReboot

func (b16 Bootenv16) SetRollbackAcrossReboot(which []snap.Type) error

SetRollbackAcrossReboot will simulate a rollback across reboots. This means that the bootloader had "snap_try_{core,kernel}" set but this boot failed. In this case the bootloader will clear "snap_try_{core,kernel}" and "snap_mode" which means the "old" kernel,core in "snap_{core,kernel}" will be used. which indicates whether rollback applies to kernel, base or both.

func (Bootenv16) SetTryingDuringReboot

func (b16 Bootenv16) SetTryingDuringReboot(which []snap.Type) error

SetTryingDuringReboot indicates that new kernel or base are being tried same as done by bootloader config.

type RunBootenv20

RunBootenv20 implements manipulating a UC20 run-mode boot env for testing.

func MockUC20RunBootenv

func MockUC20RunBootenv(b *bootloadertest.MockBootloader) *RunBootenv20

MockUC20RunBootenv wraps a mock bootloader for UC20 run-mode boot env manipulation.

func (RunBootenv20) SetRollbackAcrossReboot

func (b20 RunBootenv20) SetRollbackAcrossReboot(which []snap.Type) error

SetRollbackAcrossReboot will simulate a rollback across reboots for either a new base or kernel or both, as indicated by which. TODO: only kernel is supported for now.

func (RunBootenv20) SetTryingDuringReboot

func (b20 RunBootenv20) SetTryingDuringReboot(which []snap.Type) error

SetTryingDuringReboot indicates that new kernel or base are being tried same as done by bootloader config.

Jump to

Keyboard shortcuts

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