From patchwork Wed Sep 4 10:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 825306 Delivered-To: patch@linaro.org Received: by 2002:adf:e246:0:b0:367:895a:4699 with SMTP id bl6csp98792wrb; Wed, 4 Sep 2024 03:44:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXWqgqRgossTOqoPzDXad5pd4Hp4q5IHEpihPbMZwl7ZveiQnsMu/ZHvYyQJV6arulqzX0ycw==@linaro.org X-Google-Smtp-Source: AGHT+IHFyoVm2dyZPPEOphdaseNUUIYN2lMBMBIIkBQL60jMZdrCP1q1/cKtdL+k5k+CAp2QT/Bc X-Received: by 2002:a05:6830:3141:b0:709:3462:a4b6 with SMTP id 46e09a7af769-710aada0acfmr6385640a34.9.1725446661089; Wed, 04 Sep 2024 03:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725446661; cv=none; d=google.com; s=arc-20160816; b=zYpaMtjm8vKhDFCgfNzZk4JTTrtc2x0pkb4iZbun5eR2eniB14d6/h3AQpmxjvu6N3 RJnQEHQIKNCkHLq7cGsy4sBfBqEE/z82aS+HdyLmJY7dq6NLlbtpwvcYPM6SAr+Y3sSy ZLOtxJAdMmMclWi845DcZRbJRLDRqUchCDIJlYdzcHyQ8gfQO+uq+Yf5ZeI0E8WyGeu5 hUnYbRNEOSq426VSsUsWz5488EUxsE4zxoov7DAunCa0hzpQUzFZXY/fjgWZoa9rjxzz yzF3XW9GGZ+Id4+J+PVJ1NJWxJksmXbQDdnxp7aPLIKj+QUrlY+zfdqO1rQRnN1Lnb4h mTig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2QG0fAfmdEZ+scHz33lHba5j2XI/Y3qWZNG3CM6ANi0=; fh=GA6tJk/WKXFNHREIjl3CVQtm7xJ+c0jqwR7aN/BFkLY=; b=Sgv429t2UtF0xMOeVnG6iAFfTuHHj3Uq25fHJAnrjO6A1HHbam23WFIsY3E1+RHzmH 2uH1wxue341S4lMFRQAjMiwGSDGK/IB7ycjBkhGrfldBoGU7j7qP8xNgUj3Gczp1z5to ko8Ueq17dCocOMhVwwMaBZanVS03pLcnWa22lsHTYtQaIf0Iw/Q9tiaSfXCM8WSwD82g aMOIQ9/iS5SC0HRoiYxl0L8rbwMk0GyktEtaTPJbCKcsvIya5QY8CCHhVNPWiP98y49O 7w5ZS/gVIiMaw2upI7cMmUwcnF7jDal8ziAqX4cMNiI+HX9tw/BVQNPN3vqV/OfO7TiF OCVA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SXJyO3jG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45682d8349bsi145803741cf.405.2024.09.04.03.44.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2024 03:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SXJyO3jG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slnRw-0000LZ-Mv; Wed, 04 Sep 2024 06:41:20 -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 1slnRp-0007h3-PD for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:41:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slnRn-0000Va-1N for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:41:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725446470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2QG0fAfmdEZ+scHz33lHba5j2XI/Y3qWZNG3CM6ANi0=; b=SXJyO3jGU+vSwt8GmeXP+XEOO3OSgulOFVdCMrHTmnBNGrvF0Tga1arRsR6u83Is+HuD3j bIPfDJ33ZiS9k+PKKZ+V1imN93ph7An4STV+mAwl7pxkOaPQnhL8YxbCMWPEeVutnbD9u+ vsZcF58PGYXtyQOoUxo8iguuPpEpN2c= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-z4QGF8wdMkm81inRP_E-Vw-1; Wed, 04 Sep 2024 06:41:06 -0400 X-MC-Unique: z4QGF8wdMkm81inRP_E-Vw-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DEE6019560AE; Wed, 4 Sep 2024 10:41:02 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.194.48]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3AFFF1955F44; Wed, 4 Sep 2024 10:41:01 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefan Hajnoczi , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 35/42] tests/functional: Add QemuUserTest class Date: Wed, 4 Sep 2024 12:39:10 +0200 Message-ID: <20240904103923.451847-36-thuth@redhat.com> In-Reply-To: <20240904103923.451847-1-thuth@redhat.com> References: <20240904103923.451847-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Per commit 5334df4822 ("tests/avocado: Introduce QemuUserTest base class"): Similarly to the 'System' Test base class with methods for testing system emulation, the QemuUserTest class contains methods useful to test user-mode emulation. Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20240822104238.75045-2-philmd@linaro.org> Reviewed-by: Thomas Huth Message-ID: <20240830133841.142644-38-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/testcase.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py index 1d87d7122f..f33282efe8 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -11,4 +11,4 @@ from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \ interrupt_interactive_console_until_pattern, wait_for_console_pattern, \ exec_command, exec_command_and_wait_for_pattern, get_qemu_img -from .testcase import QemuSystemTest, QemuBaseTest +from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py index 18314be9d1..aa0146265a 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -13,6 +13,7 @@ import logging import os +import subprocess import pycotap import sys import unittest @@ -70,6 +71,22 @@ def main(): unittest.main(module = None, testRunner = tr, argv=["__dummy__", path]) +class QemuUserTest(QemuBaseTest): + + def setUp(self): + super().setUp('qemu-') + self._ldpath = [] + + def add_ldpath(self, ldpath): + self._ldpath.append(os.path.abspath(ldpath)) + + def run_cmd(self, bin_path, args=[]): + return subprocess.run([self.qemu_bin] + + ["-L %s" % ldpath for ldpath in self._ldpath] + + [bin_path] + + args, + text=True, capture_output=True) + class QemuSystemTest(QemuBaseTest): """Facilitates system emulation tests."""