All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tests/functional/x86_64: Limit the memlock test to Linux hosts
@ 2026-01-21 11:11 Thomas Huth
  2026-01-21 11:14 ` Daniel P. Berrangé
  2026-01-21 13:30 ` Zhao Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2026-01-21 11:11 UTC (permalink / raw)
  To: qemu-devel, Daniel P. Berrangé
  Cc: Paolo Bonzini, Zhao Liu, Alexandr Moshkov

From: Thomas Huth <thuth@redhat.com>

The memlock test analyzes /proc/*/status files and expects the layout
from Linux in there. However, these files also exist on NetBSD hosts
with a completely different layout, causing this test to fail. Thus
limit the test to Linux hosts now. We already have a decorator to
skip a test if it is running on a certain host system, but in this
case, we rather want to skip if we are not running on a specific
host system, so introduce a new @skipUnlessOperatingSystem decorator
for this job.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 v2: Check via a decorator, not via meson.build file

 tests/functional/qemu_test/__init__.py   |  4 ++--
 tests/functional/qemu_test/decorators.py | 12 ++++++++++++
 tests/functional/x86_64/test_memlock.py  |  3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
index 320193591b2..03e5c73d39d 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -15,8 +15,8 @@
 from .linuxkernel import LinuxKernelTest
 from .decorators import skipIfMissingCommands, skipIfNotMachine, \
     skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
-    skipIfMissingImports, skipIfOperatingSystem, skipLockedMemoryTest, \
-    skipIfMissingEnv
+    skipIfMissingImports, skipIfOperatingSystem, skipUnlessOperatingSystem, \
+    skipLockedMemoryTest, skipIfMissingEnv
 from .archive import archive_extract
 from .uncompress import uncompress
 from .gdb import GDB
diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qemu_test/decorators.py
index 807418359ab..fcf236ecfdf 100644
--- a/tests/functional/qemu_test/decorators.py
+++ b/tests/functional/qemu_test/decorators.py
@@ -57,6 +57,18 @@ def skipIfOperatingSystem(*args):
                   'running on an OS (%s) that is not able to run this test' %
                   ", ".join(args))
 
+def skipUnlessOperatingSystem(*args):
+    '''
+    Decorator to skip execution of a test if the current host
+    operating system does not match one of the allowed ones.
+    Example:
+
+      @skipUnlessOperatingSystem("Linux", "Darwin")
+    '''
+    return skipUnless(platform.system() in args,
+                  'not running on one of the required operating systems (%s)' %
+                  ", ".join(args))
+
 def skipIfNotMachine(*args):
     '''
     Decorator to skip execution of a test if the current
diff --git a/tests/functional/x86_64/test_memlock.py b/tests/functional/x86_64/test_memlock.py
index f970a2c3095..d88843ab5f9 100755
--- a/tests/functional/x86_64/test_memlock.py
+++ b/tests/functional/x86_64/test_memlock.py
@@ -14,12 +14,13 @@
 from typing import Dict
 
 from qemu_test import QemuSystemTest
-from qemu_test import skipLockedMemoryTest
+from qemu_test import skipLockedMemoryTest, skipUnlessOperatingSystem
 
 
 STATUS_VALUE_PATTERN = re.compile(r'^(\w+):\s+(\d+) kB', re.MULTILINE)
 
 
+@skipUnlessOperatingSystem('Linux')
 @skipLockedMemoryTest(2_097_152)  # 2GB
 class MemlockTest(QemuSystemTest):
     """
-- 
2.52.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] tests/functional/x86_64: Limit the memlock test to Linux hosts
  2026-01-21 11:11 [PATCH v2] tests/functional/x86_64: Limit the memlock test to Linux hosts Thomas Huth
@ 2026-01-21 11:14 ` Daniel P. Berrangé
  2026-01-21 13:30 ` Zhao Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2026-01-21 11:14 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, Paolo Bonzini, Zhao Liu, Alexandr Moshkov

On Wed, Jan 21, 2026 at 12:11:40PM +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> The memlock test analyzes /proc/*/status files and expects the layout
> from Linux in there. However, these files also exist on NetBSD hosts
> with a completely different layout, causing this test to fail. Thus
> limit the test to Linux hosts now. We already have a decorator to
> skip a test if it is running on a certain host system, but in this
> case, we rather want to skip if we are not running on a specific
> host system, so introduce a new @skipUnlessOperatingSystem decorator
> for this job.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Check via a decorator, not via meson.build file
> 
>  tests/functional/qemu_test/__init__.py   |  4 ++--
>  tests/functional/qemu_test/decorators.py | 12 ++++++++++++
>  tests/functional/x86_64/test_memlock.py  |  3 ++-
>  3 files changed, 16 insertions(+), 3 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] tests/functional/x86_64: Limit the memlock test to Linux hosts
  2026-01-21 11:11 [PATCH v2] tests/functional/x86_64: Limit the memlock test to Linux hosts Thomas Huth
  2026-01-21 11:14 ` Daniel P. Berrangé
@ 2026-01-21 13:30 ` Zhao Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Zhao Liu @ 2026-01-21 13:30 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-devel, Daniel P. Berrangé, Paolo Bonzini,
	Alexandr Moshkov

On Wed, Jan 21, 2026 at 12:11:40PM +0100, Thomas Huth wrote:
> Date: Wed, 21 Jan 2026 12:11:40 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: [PATCH v2] tests/functional/x86_64: Limit the memlock test to
>  Linux hosts
> 
> From: Thomas Huth <thuth@redhat.com>
> 
> The memlock test analyzes /proc/*/status files and expects the layout
> from Linux in there. However, these files also exist on NetBSD hosts
> with a completely different layout, causing this test to fail. Thus
> limit the test to Linux hosts now. We already have a decorator to
> skip a test if it is running on a certain host system, but in this
> case, we rather want to skip if we are not running on a specific
> host system, so introduce a new @skipUnlessOperatingSystem decorator
> for this job.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Check via a decorator, not via meson.build file

LGTM,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-21 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 11:11 [PATCH v2] tests/functional/x86_64: Limit the memlock test to Linux hosts Thomas Huth
2026-01-21 11:14 ` Daniel P. Berrangé
2026-01-21 13:30 ` Zhao Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.