boottest

package
v0.0.0-...-263a040 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMockClassicWithModesModel

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

func MakeMockModel

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

func MakeMockUC20Model

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

func MockClassicWithModesDevice

func MockClassicWithModesDevice(mode string, model *asserts.Model) snap.Device

MockClassicWithModesDevice mocks a classic with modes device. Arguments are mode (empty means "run"), and model.

func MockDevice

func MockDevice(s string) snap.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 Base, Kernel and gadget, for more control mock a DeviceContext.

func MockUC20Device

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

MockUC20Device mocks a UC with modes device. Arguments are mode (empty means "run"), and model.

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.

type RunBootenvNotScript20

RunBootenvNotScript20 implements manipulating a UC20 run-mode boot env for testing, for the case of not scriptable bootloader (i.e. piboot).

func MockUC20RunBootenvNotScript

func MockUC20RunBootenvNotScript(b *bootloadertest.MockBootloader) *RunBootenvNotScript20

MockUC20RunBootenvNotScript wraps a mock bootloader for UC20 run-mode boot env manipulation, for the case of not scriptable bootloader (i.e. piboot).

Jump to

Keyboard shortcuts

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