From nobody Sat Nov 15 20:36:26 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1748156973; cv=none; d=zohomail.com; s=zohoarc; b=arUk44Brj/+NSIFiNmJouK+FpadUPGVfj7DQIw1HBzf3hnKdBotUGC+fwL4gAG4lh8z4kFtcBrzrYqcwE2nCw+WJRZgADJp6gVyNt85A4CsYA2sUZ3o425MRbrVajKvXoxiBIDZk3KWYKKM2UHnRHWwwXw3i/GhKazyJ61nmHBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748156973; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PARyZLPgpNjNVOuTGwALJSxPCyPsA06okdw1uAwF4+4=; b=M7mFRUVTfQ8ygn5M/ggNESnsN54I8uuSV/qt9MUkaSXzGITITbAp2MeKALS6r+AnWMdwuqWQ7r4NEVPYXtjQsJOrd9Bx+vFk+7pYYfvnPmZhHtlobPBYLequr7FnD6gefxs4TBiyG+J9ypDm2BFDyZWbhf/lQbrWNiVq2qTH1ZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748156973874857.4281982142076; Sun, 25 May 2025 00:09:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uJ5TD-0005GD-BA; Sun, 25 May 2025 03:08:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uJ5T9-0005FZ-5Q for qemu-devel@nongnu.org; Sun, 25 May 2025 03:08:27 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uJ5T7-0008EI-DX for qemu-devel@nongnu.org; Sun, 25 May 2025 03:08:26 -0400 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c11:4195:0:640:137b:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id DA17160DA0; Sun, 25 May 2025 10:08:21 +0300 (MSK) Received: from dtalexundeer-nx.yandex-team.ru (unknown [2a02:6b8:b081:7309::1:2]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 68MOog1FXOs0-hBC6XRQR; Sun, 25 May 2025 10:08:21 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1748156901; bh=PARyZLPgpNjNVOuTGwALJSxPCyPsA06okdw1uAwF4+4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=vqWvN69xI84DsxuGbb+XU0lWg8w3rRSDjGR1nyYrIqvr7F1hbKVzNbheO0iLLGn81 2v8vdlEGu+qCJ+tDFVFpJs4pzfDpFA1fnVMfIyqRi9f81Nm25fIFomw0vqSfN1iEQu ohhjLqWx57scHjU+vOI21/XlzdkrM5ayc6sD7F9k= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Alexandr Moshkov To: qemu-devel@nongnu.org Cc: Cleber Rosa , "yc-core @ yandex-team . ru" , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandr Moshkov Subject: [PATCH v8 1/2] tests/functional: add skipLockedMemoryTest decorator Date: Sun, 25 May 2025 12:07:38 +0500 Message-Id: <20250525070737.54267-2-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250525070737.54267-1-dtalexundeer@yandex-team.ru> References: <20250525070737.54267-1-dtalexundeer@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=dtalexundeer@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1748156975908116600 Content-Type: text/plain; charset="utf-8" Used in future commit to skipping execution of a tests if the system's locked memory limit is below the required threshold. Signed-off-by: Alexandr Moshkov Reviewed-by: Thomas Huth --- tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/decorators.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py index af41c2c6a2..6e666a059f 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -15,6 +15,6 @@ from .linuxkernel import LinuxKernelTest from .decorators import skipIfMissingCommands, skipIfNotMachine, \ skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \ - skipIfMissingImports, skipIfOperatingSystem + skipIfMissingImports, skipIfOperatingSystem, skipLockedMemoryTest from .archive import archive_extract from .uncompress import uncompress diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qe= mu_test/decorators.py index 50d29de533..c0d1567b14 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 resource from unittest import skipIf, skipUnless =20 from .cmd import which @@ -131,3 +132,20 @@ def skipIfMissingImports(*args): =20 return skipUnless(has_imports, 'required import(s) "%s" not installed'= % ", ".join(args)) + +''' +Decorator to skip execution of a test if the system's +locked memory limit is below the required threshold. +Takes required locked memory threshold in kB. +Example: + + @skipLockedMemoryTest(2_097_152) +''' +def skipLockedMemoryTest(locked_memory): + # get memlock hard limit in bytes + _, ulimit_memory =3D resource.getrlimit(resource.RLIMIT_MEMLOCK) + + return skipUnless( + ulimit_memory =3D=3D resource.RLIM_INFINITY or ulimit_memory >=3D = locked_memory * 1024, + f'Test required {locked_memory} kB of available locked memory', + ) --=20 2.34.1