From 79b95f1092adc1d3f646d850793568a96aa1c7bc Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Mon, 15 Apr 2024 14:06:23 +0000 Subject: Add ubuntu test --- debian/tests/01_sanity_tests.py | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 debian/tests/01_sanity_tests.py (limited to 'debian/tests/01_sanity_tests.py') 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 +# +# 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 . + +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)) -- cgit v1.2.3 From 9f6871197e53ca8d9e723cf6835ccdd51f26173d Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Mon, 15 Apr 2024 14:59:47 +0000 Subject: Fix depreciation warnings --- debian/tests/01_sanity_tests.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'debian/tests/01_sanity_tests.py') diff --git a/debian/tests/01_sanity_tests.py b/debian/tests/01_sanity_tests.py index 2f2142ca..63d98631 100755 --- a/debian/tests/01_sanity_tests.py +++ b/debian/tests/01_sanity_tests.py @@ -30,16 +30,16 @@ class SanityTests(UEFITestsBase): 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) + self.assertEqual('x64', self.arch_suffix) + self.assertEqual('x86_64-efi', self.grub_arch) + self.assertEqual('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) + self.assertEqual('aa64', self.arch_suffix) + self.assertEqual('arm64-efi', self.grub_arch) + self.assertEqual('qemu-system-aarch64', self.qemu_arch) def testQemuAvailable(self): """Ensure QEMU is available for this architecture""" -- cgit v1.2.3