From fe455260b0b0af61ad023c18d2da676cbc9e1b42 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 28 Nov 2024 12:50:19 +0100 Subject: [PATCH 1/3] tests/functional/test_acpi_bits: Turn the test into a QemuSystemTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using QemuSystemTest as a base class, we can use the set_machine() command to check whether the required machine is available in the binary (otherwise this test is failing when QEMU has been compiled without the default 'pc' machine type). Message-ID: <20241128115019.591362-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Ani Sinha Signed-off-by: Thomas Huth --- tests/functional/test_acpi_bits.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acpi_bits.py index 3498b96787..e2f84414d7 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -50,7 +50,7 @@ from typing import ( ) from qemu.machine import QEMUMachine from unittest import skipIf -from qemu_test import QemuBaseTest, Asset +from qemu_test import QemuSystemTest, Asset deps = ["xorriso", "mformat"] # dependent tools needed in the test setup/box. supported_platforms = ['x86_64'] # supported test platforms. @@ -127,7 +127,7 @@ class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods @skipIf(not supported_platform() or missing_deps(), 'unsupported platform or dependencies (%s) not installed' \ % ','.join(deps)) -class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes +class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attributes """ ACPI and SMBIOS tests using biosbits. """ @@ -284,7 +284,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes self.logger.info('iso file %s successfully generated.', iso_file) def setUp(self): # pylint: disable=arguments-differ - super().setUp('qemu-system-') + super().setUp() self.logger = self.log self._baseDir = Path(__file__).parent @@ -354,6 +354,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes def test_acpi_smbios_bits(self): """The main test case implementation.""" + self.set_machine('pc') iso_file = os.path.join(self.workdir, 'bits-%d.iso' %self.BITS_INTERNAL_VER) @@ -388,4 +389,4 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes self.parse_log() if __name__ == '__main__': - QemuBaseTest.main() + QemuSystemTest.main() From c78ba4341c69635ca864c39ed9c29e10e7fdd901 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 28 Nov 2024 13:01:42 +0100 Subject: [PATCH 2/3] tests/functional/test_virtio_version: Check for the availability of the machine Use self_set_machine() to set and check for the availability of the default pc machine (so that the test is not failing if the machine has not been included in the QEMU binary). Message-ID: <20241128120142.593408-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/functional/test_virtio_version.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/functional/test_virtio_version.py b/tests/functional/test_virtio_version.py index eb23060564..92e3f5caf0 100755 --- a/tests/functional/test_virtio_version.py +++ b/tests/functional/test_virtio_version.py @@ -141,6 +141,7 @@ class VirtioVersionCheck(QemuSystemTest): def test_conventional_devs(self): + self.set_machine('pc') self.check_all_variants('virtio-net-pci', VIRTIO_NET) # virtio-blk requires 'driver' parameter #self.check_all_variants('virtio-blk-pci', VIRTIO_BLOCK) @@ -167,6 +168,7 @@ class VirtioVersionCheck(QemuSystemTest): self.assertIn('pci-express-device', ifaces) def test_modern_only_devs(self): + self.set_machine('pc') self.check_modern_only('virtio-vga', VIRTIO_GPU) self.check_modern_only('virtio-gpu-pci', VIRTIO_GPU) self.check_modern_only('virtio-mouse-pci', VIRTIO_INPUT) From 92ee59bf56ba42954166e56ab112afe10f3c7556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 29 Nov 2024 17:30:59 +0000 Subject: [PATCH 3/3] tests/functional: increase timeouts for arm sx1 test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When under high load the test VM does not complete running in the default 30 second timeout. Double it to give more headroom. Signed-off-by: Daniel P. Berrangé Message-ID: <20241129173120.761728-2-berrange@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/functional/test_arm_sx1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/test_arm_sx1.py b/tests/functional/test_arm_sx1.py index 2d86405831..2292317946 100755 --- a/tests/functional/test_arm_sx1.py +++ b/tests/functional/test_arm_sx1.py @@ -44,7 +44,7 @@ class SX1Test(LinuxKernelTest): self.vm.add_args('-no-reboot') self.launch_kernel(zimage_path, initrd=initrd_path) - self.vm.wait() + self.vm.wait(timeout=60) def test_arm_sx1_sd(self): self.set_machine('sx1') @@ -55,7 +55,7 @@ class SX1Test(LinuxKernelTest): self.vm.add_args('-snapshot') self.vm.add_args('-drive', f'format=raw,if=sd,file={sd_fs_path}') self.launch_kernel(zimage_path) - self.vm.wait() + self.vm.wait(timeout=60) def test_arm_sx1_flash(self): self.set_machine('sx1') @@ -66,7 +66,7 @@ class SX1Test(LinuxKernelTest): self.vm.add_args('-snapshot') self.vm.add_args('-drive', f'format=raw,if=pflash,file={flash_path}') self.launch_kernel(zimage_path) - self.vm.wait() + self.vm.wait(timeout=60) if __name__ == '__main__': LinuxKernelTest.main()