687
class TestGetEFIBootMGR(TestCase):
690
super(TestGetEFIBootMGR, self).setUp()
691
mock_chroot = mock.patch(
692
'curtin.util.ChrootableTarget', autospec=True)
693
self.mock_chroot = mock_chroot.start()
694
self.addCleanup(mock_chroot.stop)
695
self.mock_in_chroot = mock.MagicMock()
696
self.mock_in_chroot.__enter__.return_value = self.mock_in_chroot
697
self.in_chroot_subp_output = []
698
self.mock_in_chroot_subp = self.mock_in_chroot.subp
699
self.mock_in_chroot_subp.side_effect = self.in_chroot_subp_output
700
self.mock_chroot.return_value = self.mock_in_chroot
702
def test_calls_efibootmgr_verbose(self):
703
self.in_chroot_subp_output.append(('', ''))
704
util.get_efibootmgr('target')
706
(['efibootmgr', '-v'],),
707
self.mock_in_chroot_subp.call_args_list[0][0])
709
def test_parses_output(self):
710
self.in_chroot_subp_output.append((dedent(
714
BootOrder: 0000,0002,0001,0003,0004,0005
715
Boot0000* ubuntu HD(1,GPT)/File(\\EFI\\ubuntu\\shimx64.efi)
716
Boot0001* CD/DVD Drive BBS(CDROM,,0x0)
717
Boot0002* Hard Drive BBS(HD,,0x0)
718
Boot0003* UEFI:CD/DVD Drive BBS(129,,0x0)
719
Boot0004* UEFI:Removable Device BBS(130,,0x0)
720
Boot0005* UEFI:Network Device BBS(131,,0x0)
722
observed = util.get_efibootmgr('target')
725
'timeout': '1 seconds',
726
'order': ['0000', '0002', '0001', '0003', '0004', '0005'],
730
'path': 'HD(1,GPT)/File(\\EFI\\ubuntu\\shimx64.efi)',
733
'name': 'CD/DVD Drive',
734
'path': 'BBS(CDROM,,0x0)',
737
'name': 'Hard Drive',
738
'path': 'BBS(HD,,0x0)',
741
'name': 'UEFI:CD/DVD Drive',
742
'path': 'BBS(129,,0x0)',
745
'name': 'UEFI:Removable Device',
746
'path': 'BBS(130,,0x0)',
749
'name': 'UEFI:Network Device',
750
'path': 'BBS(131,,0x0)',
686
756
# vi: ts=4 expandtab syntax=python