From patchwork Thu Aug 22 10:42:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 821324 Delivered-To: patch@linaro.org Received: by 2002:adf:e98a:0:b0:367:895a:4699 with SMTP id h10csp1113067wrm; Thu, 22 Aug 2024 03:43:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUtGwQX6buHndA/6lKFzWpfF9MNe/x5SzYsozgNFZW4t8/CKwLFdlmrhz353oZ9RX5bB9GiQQ==@linaro.org X-Google-Smtp-Source: AGHT+IFuTKjC5RUkNhwevqNnF+0db40ayLeXJoKfL9snbWdB7iToEZutJo0Ze2SC+nzcoreNi5RV X-Received: by 2002:a05:6214:3a86:b0:6bb:994c:3ef2 with SMTP id 6a1803df08f44-6c1567d81a4mr57338806d6.16.1724323420514; Thu, 22 Aug 2024 03:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724323420; cv=none; d=google.com; s=arc-20160816; b=kBfdf8r5paa4G3hplKh1Jk182OZ6iY3eH9WpelREI2J4eIRhwGXM2HYjQUvDeyVRg5 kyFEoOHvh5Io95YXaoH5d3ym4y4p/lYuC2V4o8Rkef4/QUhpwpft27hF6ulp7ApbufDd Ui48icB4fzwDSbzD93tEvo8GJZxLC2Y8yc+USqDxixhInlnjWTmiLOSHPCntP4gCEBnb ENi9DDLs2gvWwXzl1wK2FECdW0P4a8BUc8IumRU0A4elUFpQOHTslPXfou6fhOmmyDj/ nRidxiSnVIeXhY9UWVHTA0sBBCJqHt7hYIw2vFMEmzuG49Uem47ZtvRZXIDiTZGkCVSu q8QQ== 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=tf5HkEASfWzSVkOHOTgGoEk72uRFvrW6k14mphVk1H0=; fh=JWMo7U+4BCk7ne4VdTRvgfD9sI/rlhCmhpfgFUNOsTU=; b=q6PIZkVMvf0S9mIw0Sj/8Ph7wps9qblaIfOOAIRJ4w3sczqU2YNcpMCSXg8TSIIyB8 T6Eg0GnMbFnF0L2yPrF7yyiup8A41SU0M0QcwnCNZFDTHrsavEehfCLpIsCfc35lisvk WWZGKMdkQX4cWfnXdYOemjslyQkucsWjgWZV2wuKwr/VM5yUtzggyVCGF0dih+GBYAZi 4q6XZoGLGecNW1ca/W2OlCpWl+AyOjhFFU4MzOi4DSesH99s1kdFKcat7dQtAZhyyw+5 VVIgZGO/dYg5eqINmepR1mXpaVSSoP8XFOPk5/NphSIpHeQM9+Xx2+srrOBiv3lJ/QJt g9Jg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ANf96sQM; 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=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c162dd671esi15062736d6.358.2024.08.22.03.43.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Aug 2024 03:43:40 -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=@linaro.org header.s=google header.b=ANf96sQM; 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=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sh5HK-0003Nj-Hk; Thu, 22 Aug 2024 06:42:54 -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 1sh5HJ-0003Mk-0T for qemu-devel@nongnu.org; Thu, 22 Aug 2024 06:42:53 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sh5HH-00019q-CN for qemu-devel@nongnu.org; Thu, 22 Aug 2024 06:42:52 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-429da8b5feaso5881415e9.2 for ; Thu, 22 Aug 2024 03:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724323369; x=1724928169; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tf5HkEASfWzSVkOHOTgGoEk72uRFvrW6k14mphVk1H0=; b=ANf96sQMZBvQbIiGnmhb96fuw2QP3naQWMHOEnzHZxZzHdlYVabA5PtjW9tEf5HIDU Ppl8C50j37JMlIA0GnywSoqfOWMn0sQ5ouB497Ok7YIvHyEsJ+AzBCp7q0uiRcsgIMbT do04FxUMGDrkHfKKkZh//OU7N0XpKPboZaK4PKMEYfvfqCJ9TeW4Vflt7mdwLzZgomt/ d7ofp88qOJcZK74zg2Q8TEqkth56I/E1mp7XO3alpD4F4CalHPsswNJBc/b6hMqgeJ0h DFBkXDbFxQFb7U4I1S+fGp+c6Hm7t+Ds+jnQJptNJ/qMrSJEaVHhftl0SKUzF3xJ0isE ic+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724323369; x=1724928169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tf5HkEASfWzSVkOHOTgGoEk72uRFvrW6k14mphVk1H0=; b=LPujlFdlQrmlDe6PAlMggYnNkakBZCnanj2IYs+EOJ5N3QeHCsDRXUpXjQth05K9J1 +4TztJlMXAreC3/8t3QSBWt1xjefRIzD9GTqxLzDQb5G9EcwbtMXXIb80dj6oxVhzWUy GXgtL/1c0dk3aAb3DcCJ6xOBdVCgW0B7feFpMhxXqJy4gwfA2nwMl6CfPiudyxyeZxy0 i4SHBNDawUDIm6SYo1XKRNLofAbcPoTZ+Mhj9Q5T2CfzHKlRfLJ2U1y1tvdg4gBp4J// dP1Wv7V1g5vEE6Y4zS4tbktFIyfPcfjqOnRCZpcWf0l4AUSAXsGJgE6YBlE2uA/E0Yv5 1LFQ== X-Gm-Message-State: AOJu0YzM+ZEYa9PTBJlQJ7f4qH4tTa1PHmUWkza3EgD2wRDuTkhi8jHy 4uBA+KI3xzPQAwIoYM2EyWyU553KXxNo9ib44DK44Sw8lTKj0NiCpQzPPQdd0KWfQnzOZjwmiFU s X-Received: by 2002:a05:600c:1e8f:b0:426:5e8e:aa48 with SMTP id 5b1f17b1804b1-42ac55dfe1cmr13537755e9.22.1724323369120; Thu, 22 Aug 2024 03:42:49 -0700 (PDT) Received: from m1x-phil.lan ([176.187.206.153]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac500e119sm20623675e9.0.2024.08.22.03.42.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 22 Aug 2024 03:42:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Cleber Rosa , Thomas Huth , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , Beraldo Leal Subject: [PATCH 1/3] tests/functional: Add QemuUserTest class Date: Thu, 22 Aug 2024 12:42:36 +0200 Message-ID: <20240822104238.75045-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240822104238.75045-1-philmd@linaro.org> References: <20240822104238.75045-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 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é Reviewed-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 db05c8f412..6e9b017264 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 -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."""