[PATCH] tests/functional/test_acpi_bits: Turn the test into a QemuSystemTest

Thomas Huth posted 1 patch 1 week, 1 day ago
tests/functional/test_acpi_bits.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[PATCH] tests/functional/test_acpi_bits: Turn the test into a QemuSystemTest
Posted by Thomas Huth 1 week, 1 day ago
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).

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 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 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 @@ def base_args(self):
 @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 @@ def generate_bits_iso(self):
         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 @@ def tearDown(self):
     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 @@ def test_acpi_smbios_bits(self):
         self.parse_log()
 
 if __name__ == '__main__':
-    QemuBaseTest.main()
+    QemuSystemTest.main()
-- 
2.47.0
Re: [PATCH] tests/functional/test_acpi_bits: Turn the test into a QemuSystemTest
Posted by Ani Sinha 1 week ago

> On 28 Nov 2024, at 5:20 PM, Thomas Huth <thuth@redhat.com> wrote:
> 
> 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).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Ani Sinha <anisinha@redhat.com>

> ---
> 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 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 @@ def base_args(self):
> @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 @@ def generate_bits_iso(self):
>         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 @@ def tearDown(self):
>     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 @@ def test_acpi_smbios_bits(self):
>         self.parse_log()
> 
> if __name__ == '__main__':
> -    QemuBaseTest.main()
> +    QemuSystemTest.main()
> -- 
> 2.47.0
> 
Re: [PATCH] tests/functional/test_acpi_bits: Turn the test into a QemuSystemTest
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
On 28/11/24 12:50, Thomas Huth wrote:
> 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).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   tests/functional/test_acpi_bits.py | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>