Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMockModel ¶
func MakeMockUC20Model ¶
func MockDevice ¶
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.
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 ¶
SetBootBase sets the current boot base string. Should be something like "core_1234.snap".
func (Bootenv16) SetBootKernel ¶
SetBootKernel sets the current boot kernel string. Should be something like "pc-kernel_1234.snap".
func (Bootenv16) SetBootTryKernel ¶
SetBootTryKernel sets the try boot kernel string. Should be something like "pc-kernel_1235.snap".
func (Bootenv16) SetRollbackAcrossReboot ¶
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.
type RunBootenv20 ¶
type RunBootenv20 struct {
*bootloadertest.MockExtractedRunKernelImageBootloader
}
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.