On 5/2/25 17:53, Daniel P. Berrangé wrote:
On Wed, Feb 05, 2025 at 05:40:48PM +0100, Philippe Mathieu-Daudé wrote:
On 5/2/25 16:59, Daniel P. Berrangé wrote:
The test_mem_addr_space is validating handling of QEMU with various
memory address settings. All of the test cases are setting 'maxmem'
to a value that exceeds the 32-bit address space, so these must all
be skipped on 32-bit hosts.

Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
---
   tests/functional/qemu_test/__init__.py   |  2 +-
   tests/functional/qemu_test/decorators.py | 12 ++++++++++++
   tests/functional/test_mem_addr_space.py  | 17 ++++++++++++++++-
   3 files changed, 29 insertions(+), 2 deletions(-)


diff --git a/tests/functional/qemu_test/decorators.py 
b/tests/functional/qemu_test/decorators.py
index 1651eb739a..d3a8cf0483 100644
--- a/tests/functional/qemu_test/decorators.py
+++ b/tests/functional/qemu_test/decorators.py
@@ -5,6 +5,7 @@
   import importlib
   import os
   import platform
+import sys
   from unittest import skipUnless
   from .cmd import which
@@ -118,3 +119,14 @@ def skipIfMissingImports(*args):
       return skipUnless(has_imports, 'required import(s) "%s" not installed' %
                                      ", ".join(args))
+
+'''
+Decorator to skip execution of a test on 32-bit targets

"hosts"

+Example:
+
+  @skipIf32BitTarget()
+'''
+def skipIf32BitTarget():
+    enoughBits = sys.maxsize > 2**32
+    return skipUnless(enoughBits,
+                      'Test requires a host with 64-bit address space')

skipIf32BitHost?

I don't mind either way.

Preferably using skipIf32BitHost to match the error message:
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to