Skip to contentSkip to conversation

hw/arm: Tests fixes for 10.0

PATCH In review Philippe Mathieu-Daudé 2 participants 7 messages Apr 3, 2025 – Apr 4, 2025

lore
Share & tools
lore
#0 lore raw

v3 cover hw/arm: Tests fixes for 10.0

Hi,

I tried to gather all the hw/arm/-related patches for the GitLab issues tagged for 10.0:

- trivial ones fixing / disabling broken tests
- disable the VMapple machine (not sure about it)

Regards,

Phil.

Since v2:
- Reword skipIfOperatingSystem() decorator
- Dropped ACPI patches

Philippe Mathieu-Daudé (4):
tests/functional: Add a decorator for skipping tests on particular OS tests/functional: Skip aarch64_replay test on macOS tests/qtest: Skip Aarch64 VMapple machine
hw/arm: Do not build VMapple machine by default

Pierrick Bouvier (1):
tests/functional/test_aarch64_rme_virt: fix sporadic failure

 configs/devices/aarch64-softmmu/default.mak |  1 +
 tests/qtest/libqtest.c                      |  1 +
 tests/functional/qemu_test/__init__.py      |  2 +-
 tests/functional/qemu_test/decorators.py    | 15 ++++++++++++++-
 tests/functional/test_aarch64_replay.py     |  4 +++-
 tests/functional/test_aarch64_rme_virt.py   |  4 +++-
 6 files changed, 23 insertions(+), 4 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH v3 1/5 tests/functional/test_aarch64_rme_virt: fix sporadic failure

From: Pierrick Bouvier <[email protected]>

This test was randomly failing on our CI, and on dev machines, especially with QEMU debug builds.

From the information collected, it's related to an implementation choice in edk2 QEMU virt support. The workaround is to disable KASLR, to avoid accessing protected memory.
Note: this is *not* needed for the similar test_aarch64_rme_sbsaref.

More information is available on the associated GitLab issue.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2823

Message-ID: <[email protected]>

---
 tests/functional/test_aarch64_rme_virt.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/functional/test_aarch64_rme_virt.py +3 -1
index f4ad4d33d58..a1abf584f0e 100755
@@ -87,7 +87,9 @@ def test_aarch64_rme_virt(self):
         self.vm.add_args('-fsdev', f'local,security_model=none,path={rme_stack},id=shr0')
         self.vm.add_args('-device', 'virtio-net-pci,netdev=net0')
         self.vm.add_args('-netdev', 'user,id=net0')
-        self.vm.add_args('-append', 'root=/dev/vda')
+        # We need to add nokaslr to avoid triggering this sporadic bug:
+        # https://gitlab.com/qemu-project/qemu/-/issues/2823
+        self.vm.add_args('-append', 'root=/dev/vda nokaslr')
 
         self.vm.launch()
         # Wait for host VM boot to complete.
Signature · 1 line
2.47.1
#2 lore raw

PATCH v3 2/5 tests/functional: Add a decorator for skipping tests on particular OS

In reply to Philippe Mathieu-Daudé

Since tests might be failing on some operating systems, introduce the skipIfOperatingSystem() decorator.

---
 tests/functional/qemu_test/__init__.py   |  2 +-
 tests/functional/qemu_test/decorators.py | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
tests/functional/qemu_test/__init__.py +1 -1
index 45f7befa374..af41c2c6a22 100644
@@ -15,6 +15,6 @@
 from .linuxkernel import LinuxKernelTest
 from .decorators import skipIfMissingCommands, skipIfNotMachine, \
     skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
-    skipIfMissingImports
+    skipIfMissingImports, skipIfOperatingSystem
 from .archive import archive_extract
 from .uncompress import uncompress
tests/functional/qemu_test/decorators.py +14 -1
index 1651eb739a7..50d29de533d 100644
@@ -5,7 +5,7 @@
 import importlib
 import os
 import platform
-from unittest import skipUnless
+from unittest import skipIf, skipUnless
 
 from .cmd import which
 
@@ -26,6 +26,19 @@ def skipIfMissingCommands(*args):
     return skipUnless(has_cmds, 'required command(s) "%s" not installed' %
                                 ", ".join(args))
 
+'''
+Decorator to skip execution of a test if the current
+host operating system does match one of the prohibited
+ones.
+Example
+
+  @skipIfOperatingSystem("Linux", "Darwin")
+'''
+def skipIfOperatingSystem(*args):
+    return skipIf(platform.system() in args,
+                  'running on an OS (%s) that is not able to run this test' %
+                  ", ".join(args))
+
 '''
 Decorator to skip execution of a test if the current
 host machine does not match one of the permitted
Signature · 1 line
2.47.1
Reviewed-by on v3 2/5
#3 lore raw

Re: [PATCH-for-10.0 v3 2/5] tests/functional: Add a decorator for skipping tests on particular OS

Quoted 46 lines · Philippe Mathieu-Daudé

Since tests might be failing on some operating systems, introduce the skipIfOperatingSystem() decorator.

---
  tests/functional/qemu_test/__init__.py   |  2 +-
  tests/functional/qemu_test/decorators.py | 15 ++++++++++++++-
  2 files changed, 15 insertions(+), 2 deletions(-)
tests/functional/qemu_test/__init__.py +1 -1
index 45f7befa374..af41c2c6a22 100644
@@ -15,6 +15,6 @@
  from .linuxkernel import LinuxKernelTest
  from .decorators import skipIfMissingCommands, skipIfNotMachine, \
      skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
-    skipIfMissingImports
+    skipIfMissingImports, skipIfOperatingSystem
  from .archive import archive_extract
  from .uncompress import uncompress
tests/functional/qemu_test/decorators.py +7 -1
index 1651eb739a7..50d29de533d 100644
@@ -5,7 +5,7 @@
  import importlib
  import os
  import platform
-from unittest import skipUnless
+from unittest import skipIf, skipUnless
 
  from .cmd import which
 
@@ -26,6 +26,19 @@ def skipIfMissingCommands(*args):
      return skipUnless(has_cmds, 'required command(s) "%s" not installed' %
                                  ", ".join(args))
 
+'''
+Decorator to skip execution of a test if the current
+host operating system does match one of the prohibited
+ones.
+Example
+

tests/functional/qemu_test/decorators.py def skipIfMissingCommands(*args): · line 44

Quoted 10 lines
tests/functional/qemu_test/decorators.py +7 -0
+  @skipIfOperatingSystem("Linux", "Darwin")
+'''
+def skipIfOperatingSystem(*args):
+    return skipIf(platform.system() in args,
+                  'running on an OS (%s) that is not able to run this test' %
+                  ", ".join(args))
+
  '''
  Decorator to skip execution of a test if the current
  host machine does not match one of the permitted
#4 lore raw

PATCH v3 3/5 tests/functional: Skip aarch64_replay test on macOS

In reply to Philippe Mathieu-Daudé

As of v10.0.0-rc2 this test is still failing on macos:

  $ make check-functional-aarch64 V=1
  ...
  ERROR:../../replay/replay-internal.c:235:replay_mutex_unlock: assertion failed: (replay_mutex_locked())
  Bail out! ERROR:../../replay/replay-internal.c:235:replay_mutex_unlock: assertion failed: (replay_mutex_locked())

This is tracked as https://gitlab.com/qemu-project/qemu/-/issues/2907

---
 tests/functional/test_aarch64_replay.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/functional/test_aarch64_replay.py +3 -1
index 04cde433bcf..029fef3cbf8 100755
@@ -5,7 +5,7 @@
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
 
-from qemu_test import Asset
+from qemu_test import Asset, skipIfOperatingSystem
 from replay_kernel import ReplayKernelBase
 
 
@@ -16,6 +16,8 @@ class Aarch64Replay(ReplayKernelBase):
          'releases/29/Everything/aarch64/os/images/pxeboot/vmlinuz'),
         '7e1430b81c26bdd0da025eeb8fbd77b5dc961da4364af26e771bd39f379cbbf7')
 
+    # Failing on Darwin: https://gitlab.com/qemu-project/qemu/-/issues/2907
+    @skipIfOperatingSystem('Darwin')
     def test_aarch64_virt(self):
         self.set_machine('virt')
         self.cpu = 'cortex-a53'
Signature · 1 line
2.47.1
#5 lore raw

PATCH v3 4/5 tests/qtest: Skip Aarch64 VMapple machine

In reply to Philippe Mathieu-Daudé

First, the VMapple machine only works with the ARM 'host' CPU type, which isn't accepted for QTest:

  $ qemu-system-aarch64 -M vmapple -accel qtest
  qemu-system-aarch64: The 'host' CPU type can only be used with KVM or HVF

Second, the QTest framework expects machines to be createable without specifying optional arguments, however the VMapple machine requires few of them:

  $ qemu-system-aarch64 -M vmapple -accel qtest
  qemu-system-aarch64: No firmware specified
  $ qemu-system-aarch64 -M vmapple -accel qtest -bios /dev/null
  qemu-system-aarch64: No AUX device. Please specify one as pflash drive.

Restrict this machine with QTest so we can at least run check-qtest, otherwise we get:

  $ make check-qtest-aarch64
  qemu-system-aarch64: The 'host' CPU type can only be used with KVM or HVF
  Broken pipe
  ../tests/qtest/libqtest.c:199: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
  ...
   7/26 qemu:qtest+qtest-aarch64 / qtest-aarch64/test-hmp     ERROR      24.71s   killed by signal 6 SIGABRT
   2/26 qemu:qtest+qtest-aarch64 / qtest-aarch64/qom-test     ERROR      71.23s   killed by signal 6 SIGABRT
---
 tests/qtest/libqtest.c | 1 +
 1 file changed, 1 insertion(+)
tests/qtest/libqtest.c +1 -0
index 2750067861e..fad307d125a 100644
@@ -1788,6 +1788,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine),
         if (!strncmp("xenfv", machines[i].name, 5) ||
             g_str_equal("xenpv", machines[i].name) ||
             g_str_equal("xenpvh", machines[i].name) ||
+            g_str_equal("vmapple", machines[i].name) ||
             g_str_equal("nitro-enclave", machines[i].name)) {
             continue;
         }
Signature · 1 line
2.47.1
#6 lore raw

PATCH v3 5/5 hw/arm: Do not build VMapple machine by default

In reply to Philippe Mathieu-Daudé

Unfortunately as of v10.0.0-rc2 the VMapple machine is unusable:

  $ qemu-system-aarch64 -M vmapple [...]
  *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
      reason: '-[PGIOSurfaceHostDeviceDescriptor setMapMemory:]: unrecognized selector sent to instance 0x600001ede820'
  *** First throw call stack:
  (
    0   CoreFoundation          0x000000019c759df0 __exceptionPreprocess + 176
    1   libobjc.A.dylib         0x000000019c21eb60 objc_exception_throw + 88
    2   CoreFoundation          0x000000019c816ce0 -[NSObject(NSObject) __retain_OA] + 0
    3   CoreFoundation          0x000000019c6c7efc ___forwarding___ + 1500
    4   CoreFoundation          0x000000019c6c7860 _CF_forwarding_prep_0 + 96
    5   qemu-system-aarch64     0x000000010486dbd0 apple_gfx_mmio_realize + 200
    6   qemu-system-aarch64     0x0000000104e6ab5c device_set_realized + 352
    7   qemu-system-aarch64     0x0000000104e7250c property_set_bool + 100
    8   qemu-system-aarch64     0x0000000104e7023c object_property_set + 136
    9   qemu-system-aarch64     0x0000000104e74870 object_property_set_qobject + 60
    10  qemu-system-aarch64     0x0000000104e70748 object_property_set_bool + 60
    11  qemu-system-aarch64     0x0000000104e69bd8 qdev_realize_and_unref + 20
    12  qemu-system-aarch64     0x0000000104e258e0 mach_vmapple_init + 1728
    13  qemu-system-aarch64     0x000000010481b0ac machine_run_board_init + 1892
    14  qemu-system-aarch64     0x0000000104a4def8 qmp_x_exit_preconfig + 260
    15  qemu-system-aarch64     0x0000000104a51ba8 qemu_init + 14460
    16  qemu-system-aarch64     0x0000000104f7cef8 main + 36
    17  dyld                    0x000000019c25eb4c start + 6000
  )
  libc++abi: terminating due to uncaught exception of type NSException
  Abort trap: 6

Disable the machine so it isn't built by default.

This is tracked as https://gitlab.com/qemu-project/qemu/-/issues/2913

---
 configs/devices/aarch64-softmmu/default.mak | 1 +
 1 file changed, 1 insertion(+)
configs/devices/aarch64-softmmu/default.mak +1 -0
index 93f4022ad62..ad8028cfd48 100644
@@ -9,3 +9,4 @@ include ../arm-softmmu/default.mak
 # CONFIG_XLNX_VERSAL=n
 # CONFIG_SBSA_REF=n
 # CONFIG_NPCM8XX=n
+CONFIG_VMAPPLE=n
Signature · 1 line
2.47.1