summaryrefslogtreecommitdiff
path: root/debian/tests/01_sanity_tests.py
diff options
context:
space:
mode:
authorBastien Roucariès <rouca@debian.org>2024-04-15 14:06:23 +0000
committerBastien Roucariès <rouca@debian.org>2024-04-15 14:15:22 +0000
commit79b95f1092adc1d3f646d850793568a96aa1c7bc (patch)
tree1cd7b831c8e47f0726ef1f3b48d54841965fa16f /debian/tests/01_sanity_tests.py
parentf4f4e39e16af685d5d6de16c4fcc0e04f651ab70 (diff)
downloadefi-boot-shim-79b95f1092adc1d3f646d850793568a96aa1c7bc.tar.gz
efi-boot-shim-79b95f1092adc1d3f646d850793568a96aa1c7bc.zip
Add ubuntu test
Diffstat (limited to 'debian/tests/01_sanity_tests.py')
-rwxr-xr-xdebian/tests/01_sanity_tests.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/debian/tests/01_sanity_tests.py b/debian/tests/01_sanity_tests.py
new file mode 100755
index 00000000..2f2142ca
--- /dev/null
+++ b/debian/tests/01_sanity_tests.py
@@ -0,0 +1,54 @@
+#
+# UEFI Shim sanity checks for tests
+#
+# Copyright (C) 2019 Canonical, Ltd.
+# Author: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import subprocess
+import sys
+import unittest
+
+from uefi_tests_base import UEFITestsBase
+
+
+class SanityTests(UEFITestsBase):
+ '''
+ Sanity checks for uefi tests
+ '''
+
+ def testArchitectureSuffixes(self):
+ """Ensure sanity of our concept of architecture suffixes for UEFI"""
+
+ machine = subprocess.check_output(['uname', '-m']).rstrip().decode('utf-8')
+ if machine == 'x86_64':
+ self.assertEquals('x64', self.arch_suffix)
+ self.assertEquals('x86_64-efi', self.grub_arch)
+ self.assertEquals('qemu-system-x86_64', self.qemu_arch)
+ elif machine == 'aarch64':
+ self.assertEquals('aa64', self.arch_suffix)
+ self.assertEquals('arm64-efi', self.grub_arch)
+ self.assertEquals('qemu-system-aarch64', self.qemu_arch)
+
+ def testQemuAvailable(self):
+ """Ensure QEMU is available for this architecture"""
+ try:
+ out = subprocess.run([self.qemu_arch, '-version'], stdout=None)
+ out.check_returncode()
+ except:
+ raise UEFINotAvailable(feature="qemu", arch=self.arch_machine,
+ details="%s failed to run" % self.qemu_arch)
+
+
+unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))