mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
boot, bootloader: tweak naming of panic injection helper
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This commit is contained in:
@@ -130,7 +130,7 @@ func (s *bootenv20Suite) checkBootStateAfterUnexpectedRebootAndCleanup(
|
||||
) {
|
||||
if panicFunc != "" {
|
||||
// setup a panic during the given bootloader function
|
||||
restoreBootloaderPanic := s.bootloader.SetMockPanic(panicFunc)
|
||||
restoreBootloaderPanic := s.bootloader.SetMockToPanic(panicFunc)
|
||||
|
||||
// run the boot function that will now panic
|
||||
c.Assert(
|
||||
|
||||
@@ -3800,7 +3800,7 @@ func (s *bootKernelCommandLineSuite) TestCommandLineUpdateUC20OverSpuriousReboot
|
||||
c.Assert(err, IsNil)
|
||||
s.bootloader.SetBootVarsCalls = 0
|
||||
|
||||
restoreBootloaderNoPanic := s.bootloader.SetMockPanic("SetBootVars")
|
||||
restoreBootloaderNoPanic := s.bootloader.SetMockToPanic("SetBootVars")
|
||||
|
||||
// transition to gadget with cmdline.extra
|
||||
sf := snaptest.MakeTestSnapWithFiles(c, gadgetSnapYaml, [][]string{
|
||||
|
||||
@@ -148,13 +148,13 @@ func (b *MockBootloader) InstallBootConfig(gadgetDir string, opts *bootloader.Op
|
||||
return b.InstallBootConfigErr
|
||||
}
|
||||
|
||||
// SetMockPanic allows setting any method in the Bootloader interface or derived
|
||||
// SetMockToPanic allows setting any method in the Bootloader interface or derived
|
||||
// interface to panic instead of returning. This allows one to test what would
|
||||
// happen if the system was rebooted during execution of a particular function.
|
||||
// Specifically, the panic will be done immediately entering the function so
|
||||
// setting SetBootVars to panic will emulate a reboot before any boot vars are
|
||||
// set persistently
|
||||
func (b *MockBootloader) SetMockPanic(f string) (restore func()) {
|
||||
func (b *MockBootloader) SetMockToPanic(f string) (restore func()) {
|
||||
switch f {
|
||||
// XXX: update this list as more calls in this interface or derived ones
|
||||
// are added
|
||||
@@ -167,7 +167,7 @@ func (b *MockBootloader) SetMockPanic(f string) (restore func()) {
|
||||
b.panicMethods[f] = old
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown ExtractedRunKernelImageBootloader method %q to mock reboot via panic for", f))
|
||||
panic(fmt.Sprintf("unknown bootloader method %q to mock reboot via panic for", f))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user