From patchwork Fri Aug 30 13:38:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 824004 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c1:0:b0:367:895a:4699 with SMTP id p1csp787323wrs; Fri, 30 Aug 2024 06:44:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUiIFWxbe/B7rQrxDy2+Y64+Yn8J4SrFdC53JQUOAuydj85whkIIM2z2evN3qyw2sUhiADAoQ==@linaro.org X-Google-Smtp-Source: AGHT+IH+oVRr8VrVj5W/f07L7RzbU7lWl6qc/OmbcKPlrpQaSN4orJOuckS+XK4FCWkJ1pCmloIr X-Received: by 2002:a05:622a:a16:b0:447:e60c:628 with SMTP id d75a77b69052e-4567f6f3618mr72641991cf.51.1725025482897; Fri, 30 Aug 2024 06:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725025482; cv=none; d=google.com; s=arc-20160816; b=KKCoMeIVLNN2JYWqsLKZ9ZyjlkhqOMm0OlCA1F2z6ImXSGGi+AZxu+Rko1dhB1rmHI 8pIerToR9BPq5JLUmVYU0ZbEbI6RwJIvgTkEOoD9xAgV4ckpwG1so8ym83a6Nbey8NKU wxdvv5n/TkqjafSXw9oAaeg+1T/4jYRCptGzJvJUmJ3D0tNX327DjQnGk/mL7Rl4xXCq fH31FCgdMl4rkmzOvJwWK7ydFOvV0gG6tvzT6d7UKqMjbwmASzIiKwWornRsRU04+EeB zkXPeC0k8Mvk/Fl2+LlYMS1IaMek09cvCWj2K4Ph4TQYRloFvSSiqAxHPDZ5weth71J3 6Ghg== 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=rD08ZnMTN0VvxHk60UxwJ6iH60cIkpG/1tMMITmmOvQ=; fh=P38goHIztZ4gXokF5rhgtVEB12E6Nfjaq+2lEOZYQsE=; b=MousvSL0uftJgla2zZF3QLd6A0jD8wyWqTuZjgh9ikBAY/IAlODbsJGQwPI5eIFCE5 7qZKOIMEGP8I26+VCOlKDGKVZ9o1w7++FovsYBYk8ATpXdABaMx1UJfVEAoJcETGjKr4 C49EzW4EbJE4AEJUq4lsJcqFA/DTCxCQE0AaM7pNB0ZXNj0Q76WuyTPuBfOkNiW2/Mrh FbbOh1Xm7MynLEq5hmQF+Kh4DC7XHk3cKq/n6NHUaXRrNeKgLeGqVUGdYnairuRNfy9i Uq/ZqYHB7IHGpU9tG6GQ7jJjYfgZYX6/9bAzVXrrngweiIaAskQgaafiDr2hkSfVsg1t 5VpQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NIPi/j2N"; 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-45682d3d223si37499331cf.327.2024.08.30.06.44.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Aug 2024 06:44:42 -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="NIPi/j2N"; 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 1sk1sy-0003lX-Qd; Fri, 30 Aug 2024 09:41:57 -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 1sk1sl-00031T-HD for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:46 -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 1sk1sj-0005eb-Br for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025299; 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=rD08ZnMTN0VvxHk60UxwJ6iH60cIkpG/1tMMITmmOvQ=; b=NIPi/j2N4m7qhYvv1NI5qyQsNuJOJ08S5YefLMJL86nkw1ZhXDCJfQ545PyZUzeexbvfXD ALntPRTrxH32T6w4wKAg7gpSopPu76p70YlYz3GPvbbKuFe46USnNyWpfNt2uI20Mth2xd pWNTQMGKKCXT63azXPMv06vZry2OoCQ= Received: from mx-prod-mc-02.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-179-FfptHt0DOI2CIdlRhtrmog-1; Fri, 30 Aug 2024 09:41:36 -0400 X-MC-Unique: FfptHt0DOI2CIdlRhtrmog-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 672391955BFA; Fri, 30 Aug 2024 13:41:32 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EBFDF300019C; Fri, 30 Aug 2024 13:41:28 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 37/44] tests/functional: Add QemuUserTest class Date: Fri, 30 Aug 2024 15:38:31 +0200 Message-ID: <20240830133841.142644-38-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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> 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."""