]>
git.proxmox.com Git - efi-boot-shim.git/blob - debian/tests/01_sanity_tests.py
2 # UEFI Shim sanity checks for tests
4 # Copyright (C) 2019 Canonical, Ltd.
5 # Author: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; version 3.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 from uefi_tests_base
import UEFITestsBase
26 class SanityTests(UEFITestsBase
):
28 Sanity checks for uefi tests
31 def testArchitectureSuffixes(self
):
32 """Ensure sanity of our concept of architecture suffixes for UEFI"""
34 machine
= subprocess
.check_output(['uname', '-m']).rstrip().decode('utf-8')
35 if machine
== 'x86_64':
36 self
.assertEquals('x64', self
.arch_suffix
)
37 self
.assertEquals('x86_64-efi', self
.grub_arch
)
38 self
.assertEquals('qemu-system-x86_64', self
.qemu_arch
)
39 elif machine
== 'aarch64':
40 self
.assertEquals('aa64', self
.arch_suffix
)
41 self
.assertEquals('arm64-efi', self
.grub_arch
)
42 self
.assertEquals('qemu-system-aarch64', self
.qemu_arch
)
44 def testQemuAvailable(self
):
45 """Ensure QEMU is available for this architecture"""
47 out
= subprocess
.run([self
.qemu_arch
, '-version'], stdout
=None)
48 out
.check_returncode()
50 raise UEFINotAvailable(feature
="qemu", arch
=self
.arch_machine
,
51 details
="%s failed to run" % self
.qemu_arch
)
54 unittest
.main(testRunner
=unittest
.TextTestRunner(stream
=sys
.stdout
, verbosity
=2))