]> git.proxmox.com Git - efi-boot-shim.git/blob - debian/tests/01_sanity_tests.py
Add ubuntu test
[efi-boot-shim.git] / debian / tests / 01_sanity_tests.py
1 #
2 # UEFI Shim sanity checks for tests
3 #
4 # Copyright (C) 2019 Canonical, Ltd.
5 # Author: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
6 #
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.
10 #
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.
15 #
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/>.
18
19 import subprocess
20 import sys
21 import unittest
22
23 from uefi_tests_base import UEFITestsBase
24
25
26 class SanityTests(UEFITestsBase):
27 '''
28 Sanity checks for uefi tests
29 '''
30
31 def testArchitectureSuffixes(self):
32 """Ensure sanity of our concept of architecture suffixes for UEFI"""
33
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)
43
44 def testQemuAvailable(self):
45 """Ensure QEMU is available for this architecture"""
46 try:
47 out = subprocess.run([self.qemu_arch, '-version'], stdout=None)
48 out.check_returncode()
49 except:
50 raise UEFINotAvailable(feature="qemu", arch=self.arch_machine,
51 details="%s failed to run" % self.qemu_arch)
52
53
54 unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))