From nobody Sat Nov 15 05:35:25 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; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1755515221; cv=pass; d=zohomail.com; s=zohoarc; b=Ffc0kgWsyI5XRBvYuM/BX8HOr2aUgb0Jb4bv9ZbtA42BccWbvdgexVjSPLsRInLF1vkH4bidwWlnHUKgBKn7pfMBxIp3zSsXh4Fz+2hDiQkji6DwJCI/C+KehB+vXEBKytuJIYwrBfGhoGkyCOldMdiJgn+1HU4wsdq3XKdb5DE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755515221; h=Content-Type: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=8JdHU59LfI4k2zDZSoIuw806yk4XzAREI3QhG62qets=; b=fjT99C14iHk6E3/SZX9Q/PCa/X2srLsuFJGC08rkMK6zYDSzEvP8vLBeSOFPc2yxHnMrOCZy0A/RmSj3qWhSUWAWeY5hZW+IQhHWa6tBsoM4L7GLfpteE0gcsSCTpxONeEsMtW/tPTd70+EhkEQQAllPI4gvZORd3fmb7O/Jn1g= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); 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 17555152219271009.1814588999003; Mon, 18 Aug 2025 04:07:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1unxgj-0008R3-9r; Mon, 18 Aug 2025 07:06:05 -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 1unxgc-0008Po-U4 for qemu-devel@nongnu.org; Mon, 18 Aug 2025 07:05:59 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unxga-0001Pm-Hw for qemu-devel@nongnu.org; Mon, 18 Aug 2025 07:05:58 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 57I9gcKV006558; Mon, 18 Aug 2025 04:05:53 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10on2108.outbound.protection.outlook.com [40.107.92.108]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 48jsh0jw3q-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 18 Aug 2025 04:05:52 -0700 (PDT) Received: from CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) by MN2PR02MB6814.namprd02.prod.outlook.com (2603:10b6:208:199::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.24; Mon, 18 Aug 2025 11:05:51 +0000 Received: from CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51]) by CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51%7]) with mapi id 15.20.9031.023; Mon, 18 Aug 2025 11:05:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint20171006; bh=8JdHU59LfI4k2zDZSoIuw806yk4XzAREI3QhG62qe ts=; b=dz7eZyoTVCmHkNcj09d5h7rD9Vb10RXWW6G6mJ6VDWZ3agWQQxIkXW656 sAJg7r5rj05FuP316WiILQvF0ElV4jWXLFrvI+sHNOt7S4GVXd/cgRhu5cD06wUk ErfzW2vVYgcb/Dd5cg2U/tTo3IZNa9FrMrKYAZWwzxuITlVzcK8ZgEPFKLbdxy3P uDktH2g7ACS2eeaujtn6rCSRx7Qgo3is4a4Z0b6ptqZfqHUuaXv4sKHp0YXzNPCK 0pkDBfFCa23VYFbudUMT4UGf52pXKWSuhhfehgTkjH39VCdv0f/Y7N9N7oRyQNuY UpWhd2Rg4MuHCq3bSTPZLznpMQYIA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TmrXv7ZhU1guGxtW3uWaWujnj2F+Nw6xr2tn/4wzolEUcvtXHU/kt9IWhm3AKcgKj7dgXAP6o9NiAbXqYaOwCg5em7HEtTeVFUHOUYvzcwrHG6UPFRmU7roAURh2wR4LG40YjzzW6tvN8cXYKusoAprzPRZ443+iF7gAjgWlo0T+l778hL96XKL+z80R8rJFvE5JKCsA841ty9bfhQhg5yofqwWp9D7piE5OrdQN+w1huHBxoNdCQ4dBF910XKgPbl9RB1RQN2HNFWIDJ8GO+FP/D3ew2eTEhduF8XVi7PlK13q87e1Isp3Xxk65D8X+r0NC9igH86uCTB72sRLvPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8JdHU59LfI4k2zDZSoIuw806yk4XzAREI3QhG62qets=; b=sDdSKptadLrHYrtZ3TrZ3ahHigr61QhA3eqoaK7JhQyzQVMjNbHpwkCKIh2+OxpTq0nkipBe6Wxybc7iDcq/xWnlrWb/LkXAQ4ECTki+YtR7MvhqNe+gSSBpND6K02y3E4RMKIUdqW2KsO6DUAp+RpKHI3mSVZdDUNTM2RDhzHiID4g1vDDf3kal+qiQ9EL2rDZaZfR6yxvTKZE1CdHRUSUGPdrMWC342LZwrY4rU6n+nAfVt5LFc6Q1vaZ3Z2U5/e8M6+ZrOTneE5qkBXzY/uo60XwmoQV7G00XPXAR93vaqXlrQwiv/vu40wLJnOwSUZyXIu5COFXx5o1DEdLI9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8JdHU59LfI4k2zDZSoIuw806yk4XzAREI3QhG62qets=; b=MnonNAzeAOUBvPTybpzKJxPwA7TftzqKFx7vrowacPZd1ziSMqb9XPO/3Ao7BI3/ZwuihFkAgBvOkXI1q0d6ROyA6RBSYkehCWzcbvjcbrIip4cBb4ckXV0x7gBp5wYx0AiwDPQEqpe9lAlL7jHEWy/rOEVMEeeN5sfYC9r/0C7JKxs8NUF6rGo0Xj1bPtdDtgBVBvScnzUdRlQ7M3gsaAGfLF4cUEy9dK+HpICJ2Cfj3FQqZbSPmjaYojP/CwuvBBXe8xHd9tkV5lrl7/Iz4OBorHAmmyFBDr+edwaSuAhFaBb2EzqOoECFfj0BWh/JExhq5A83GnE3dng7QFgxEg== From: John Levon To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , John Levon , Thanos Makatos , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/3] tests/functional: return output from exec_command_and_wait_for_pattern() Date: Mon, 18 Aug 2025 12:05:44 +0100 Message-ID: <20250818110546.2159622-2-john.levon@nutanix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250818110546.2159622-1-john.levon@nutanix.com> References: <20250818110546.2159622-1-john.levon@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR02MB6760:EE_|MN2PR02MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 05f699a7-246c-4106-c921-08ddde47318e x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GhPWPzYp3Zf2smEcmLF+TaFR2PPr8GktYgiwGlqgndDr8rEVdHj928pMyim8?= =?us-ascii?Q?mmPhjg1XocBATmhsG0MZ4Y6c/X6d7AMMq/RNphxJv63knVHhYZmOZtrlfyve?= =?us-ascii?Q?XjLPlm7AvwTVXMwuJkApQlnthrFP0mWHlcVV8/aPvVg0ByeKQ/+La6js/a2z?= =?us-ascii?Q?DsIvxZCn/eui0fqNqD4rI9BmPYmISson6lO74czY8+RbkwVJTKpE+7f7R0MV?= =?us-ascii?Q?iNJyAaDJZA9cpu+O8uZHhK+MO5vDYbSdQO0L8EByXcuH7v6QiuRpDBDXoJtF?= =?us-ascii?Q?Js3SO5aEvfV7oHcNU8kTpk2RDaIu90xMUFlj8XJ4X+gXZwxo53cAqCVkFAgT?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9/viyem/gSBvDDdol?= =?us-ascii?Q?5OHhkE8FPV6XwWdiyiGZerfnoNwmnTH9pv0f9lX12ucqSAcRSumrzAl87trp?= =?us-ascii?Q?SF3ufsgMIZPNNaa41ZMFsPJU0K90EVP4QwEb6+Ca3vKLer4b9Y11s1EOxD+I?= =?us-ascii?Q?7H93at0Lpxq3bXMAWB53h8/YQXbx9RUo7qfD7kMY/b3CIbusjvofhFpC8dFc?= =?us-ascii?Q?/dBf3MGwp0o=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR02MB6760.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?k7lCEQFVLuyzj/GfKzW/quZtyNBtTKHZMjGbd3GJrUJndKTE5nH1OPVb7kYC?= =?us-ascii?Q?V99S5BpaqZNj/qEA3cL3Zxg3VNm5eEmtJd+MOOcpylZaeyN7VBichcB+dMzq?= =?us-ascii?Q?a5yj/YPH7ZTCwIqST5GnRkWuyj6ZZj63mBDseulucBWS/+rB/6PMZBApzvJz?= =?us-ascii?Q?PvWIvwNFiWqKuDPOPU8g3gZ+2XnvmPvO8wahSdbmmHtApWa6CT2x2FhMSP7v?= =?us-ascii?Q?bppsPLqyHgkQZcpcKxVjKwSSHqB/wsQWTBFEgk2RlUuOGLXNE7aZhU+HfjOI?= =?us-ascii?Q?uCYiODG+JvKpRyBygf3TvIs8OMKW4EUn8HVl5Fmi67W0Jnvf5Rs/mCNi4CKv?= =?us-ascii?Q?At0W9I+9J1hrXnpMQMUVzEb0ewuyjrArZGz8nbXx8NZiBELezKqhDAyP9+j4?= =?us-ascii?Q?lI5UX8IbeVYvkKwEzj4DJ8RupcIVR4OoHZJ3rM1ayaMe95lruJDYqWIdAzr7?= =?us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uZSRs7rFMUSfsgCNUVKHDn?= =?us-ascii?Q?sdddQyGHFHmHrSifOPnPxed5QrW3JVqEkHzti7ESbe1HTCp4hTbj2ZKTFBW1?= =?us-ascii?Q?iGur7MVYmqqaBe2Z7L0YgcTpHTHRY2mfwdmUAfNA8QBL39xSepTfkO9lWl4A?= =?us-ascii?Q?c7n/23wF5S+C8smM7LRWwHUIt0eGnCyaCA38nzru7gab7p7k3m0Aeaja85XT?= =?us-ascii?Q?zQPtVvVOI7vrQrHrBPKCsTQvnTegK7b794MDfnUB?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05f699a7-246c-4106-c921-08ddde47318e X-MS-Exchange-CrossTenant-AuthSource: CH2PR02MB6760.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2025 11:05:51.4179 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3PUVsTmMfhITOTog3XMTCJemOCHs1VlZdamRUS0ibbMXnVjwUWK7AmtxCjA54ntocrLR4SB6M3EGKGEiKbK2eQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6814 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODE4MDEwNiBTYWx0ZWRfX6zusuYB+ETff oB2KSvmYDXmlYpHLkGV52JSrqY+7yOhonjLIvsTGYsUbxuxZ4CsT4Hlb0yKc/0DK5D918E7HBVg EuOxGzUpwHzOiawgkongPMSho62E9dIZkpJjEwqASLQ4lApOz9GYP4zDNcsS3Bwx31cfi8esnG9 3RlGiD0+e3GNDKejeYiFH+9xsHf8DCUyx15wcgR16eyz/JdgUpq2j2MSr0isBuEwWRSdx6AzPzV 4JNrR45R4yYQ40EoIJ94x9brLS7jMzWzwgoIunP6d7Abu0c8Taa7aAWyg4qxnG0ZZ7ut9h4hJQ9 kKCohu7zRU+pfkUOmr7/uNZTOonKnZb/DgHZ4lm1mcH3S62PrKEj8vGIInVDLo= X-Proofpoint-ORIG-GUID: QxEMo9v29xNhNGjqcJ9NC8xTaehSmW5M X-Proofpoint-GUID: QxEMo9v29xNhNGjqcJ9NC8xTaehSmW5M X-Authority-Analysis: v=2.4 cv=EbnIQOmC c=1 sm=1 tr=0 ts=68a30910 cx=c_pps a=Se1Kd4d4o2/Q5WTQO+3bhA==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=2OwXVqhp2XgA:10 a=0kUYKlekyDsA:10 a=64Cc0HZtAAAA:8 a=T5N1hjIC8Veio-cZMUgA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-18_04,2025-08-14_01,2025-03-28_01 X-Proofpoint-Spam-Reason: safe 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=148.163.155.12; envelope-from=john.levon@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Precedence: list 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 @nutanix.com) X-ZM-MESSAGEID: 1755515225044124100 Content-Type: text/plain; charset="utf-8" Tests might want to look at the whole output from a command execution, as well as just logging it. Add support for this. Signed-off-by: John Levon --- tests/functional/qemu_test/cmd.py | 38 +++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test= /cmd.py index dc5f422b77..6355b1a683 100644 --- a/tests/functional/qemu_test/cmd.py +++ b/tests/functional/qemu_test/cmd.py @@ -45,6 +45,9 @@ def is_readable_executable_file(path): # If end of line is seen, with neither @success or @failure # return False # +# In both cases, also return the contents of the line (in bytes) +# up to that point. +# # If @failure is seen, then mark @test as failed def _console_read_line_until_match(test, vm, success, failure): msg =3D bytes([]) @@ -76,10 +79,23 @@ def _console_read_line_until_match(test, vm, success, f= ailure): except: console_logger.debug(msg) =20 - return done + return done, msg =20 def _console_interaction(test, success_message, failure_message, send_string, keep_sending=3DFalse, vm=3DNone): + """ + Interact with the console until either message is seen. + + :param success_message: if this message appears, finish interaction + :param failure_message: if this message appears, test fails + :param send_string: a string to send to the console before trying + to read a new line + :param keep_sending: keep sending the send string each time + :param vm: the VM to interact with + + :return: The collected output (in bytes form). + """ + assert not keep_sending or send_string assert success_message or send_string =20 @@ -101,6 +117,8 @@ def _console_interaction(test, success_message, failure= _message, if failure_message is not None: failure_message_b =3D failure_message.encode() =20 + out =3D bytes([]) + while True: if send_string: vm.console_socket.sendall(send_string.encode()) @@ -113,11 +131,17 @@ def _console_interaction(test, success_message, failu= re_message, break continue =20 - if _console_read_line_until_match(test, vm, - success_message_b, - failure_message_b): + done, line =3D _console_read_line_until_match(test, vm, + success_message_b, + failure_message_b) + + out +=3D line + + if done: break =20 + return out + def interrupt_interactive_console_until_pattern(test, success_message, failure_message=3DNone, interrupt_string=3D'\r'): @@ -184,9 +208,13 @@ def exec_command_and_wait_for_pattern(test, command, :param command: the command to send :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails + + :return: The collected output (in bytes form). """ assert success_message - _console_interaction(test, success_message, failure_message, command += '\r') + + return _console_interaction(test, success_message, failure_message, + command + '\r') =20 def get_qemu_img(test): test.log.debug('Looking for and selecting a qemu-img binary') --=20 2.43.0 From nobody Sat Nov 15 05:35:25 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; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1755515221; cv=pass; d=zohomail.com; s=zohoarc; b=KXew3OTrD9sa4tnnZk2zQJUIRX60dv3UgHw0SZIiNJyPikwES7D+TmJwadX0v3ZdDHCktU1djVMQY67yBu1lWm8Cb/uXqZC/v5ztX9AL/aMNS69rS4Qa+oAMrKoKKIzZH/N5juse8gGCfqR89gARsjxPSMrMsSSj9N6Og/HRedA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755515221; h=Content-Type: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=n/gIgXK1uivQMg1Yf/R3taOx4d+4xYandkIg1fsRkUk=; b=McoFQrygtFo5zF7Fxtm3elrdmlQUJI6d8KQylhTQpFu+oUzhYahr6MdrZYDqSaOafPR7y5Xavp1eoAhlXUGxTBTuEu0ZP5iA2UzaycM9BWXDHGPdSLdtOwcxH+gTmCLu3kd6GiIbm0KtmZwGobNweaTj68HCuf6HaROe0fTkS0c= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); 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 1755515221334508.3361105572426; Mon, 18 Aug 2025 04:07:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1unxgk-0008Rb-Dj; Mon, 18 Aug 2025 07:06:06 -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 1unxge-0008Q1-UE for qemu-devel@nongnu.org; Mon, 18 Aug 2025 07:06:01 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unxga-0001Px-L0 for qemu-devel@nongnu.org; Mon, 18 Aug 2025 07:06:00 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 57IASZuH334811; Mon, 18 Aug 2025 04:05:54 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10on2111.outbound.protection.outlook.com [40.107.92.111]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 48jsabtwd2-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 18 Aug 2025 04:05:54 -0700 (PDT) Received: from CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) by MN2PR02MB6814.namprd02.prod.outlook.com (2603:10b6:208:199::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.24; Mon, 18 Aug 2025 11:05:53 +0000 Received: from CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51]) by CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51%7]) with mapi id 15.20.9031.023; Mon, 18 Aug 2025 11:05:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint20171006; bh=n/gIgXK1uivQMg1Yf/R3taOx4d+4xYandkIg1fsRk Uk=; b=PYt4paWZ+SJ45UaGSB2g+3DuzPgw9W2G1Il45Lvwn8PnaWuVYWyXiYBdH x2LNOB3K0fvja9Fz3UDcFoEkpKzLaYXB4eoY+pHKN3rXbY9tN0535tHKgaJHc3Wr wRrWXw0sOueQnJwFFEvWi0H78M9HWtAC9pIPUK6fBFksaI4tYqIb6PdduDUEpxSz 0iYmpCvk3DNrGbwhQqsZG0z8LcsYBqFByCecSPvmZCAcQ4B3okEhugpV3StgGHc7 SvWO2K5+gGnyxesoB6rYDijBXajixrDvFqhfxXhfzRxO8dNyfQAnZWJWZ0A0BiBo NL3xhCOnJl6OzrKuowSt81MM4SYYA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V6p0bNb0bi3xIx1xZBUjnuNQ/txJQThS/lEkqLNuj8nLm59VfqFlo7yFjySQ2odr7pSzK8XX8F3XT1dCy4p5bB5qzdU/XbEROvgW0lB508GhvKeLJlhUJSS3mBPWzjLfhNY8lRpXio5/apE6R1XJwtgrZ4Y9o6S3Qa+97kgKLGLaEOpdXlvxjTkyJsjrRzm/Blaxp30cb3P+gy6rmMY4fWV5amaqk+ru8twabmqjLsr1rX2fb35R0waR6hjc+QzgMf/M+vin/AMNQMupn1s/U5jrgc4Rnt0sjBkOGxpJDTewCvgy9Ab0jfjzX4+pjBx6F3lPuV9/59NxiMKdp7Bp/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n/gIgXK1uivQMg1Yf/R3taOx4d+4xYandkIg1fsRkUk=; b=sSTWEyo9+WPG7+6SiioiQTcMO2EmEz8vpGk9Ywg57aYZZog61zW9RUAQi5xbqqzo/XJ2tQqe5V9CjHKuOhGWRe6/5b40ZSAUN3zl6tDVV6C/dP9699nSyje2TSNM3BKSJN7NLLWFzJQMB3KE/T1ZF8Fm9CeS4yKE7tGgsCzxiSScijapsb+IxRwgsH/1+GDOrSfkhn8qXnZVeOuwhVnRGDfE2CKB2cAS6eEFcDy4kVRwmkyjmOXSrBBMdh5NJg/yz6EaKD8nYa8+q31MmtQhGKQ/jsLJCcZ+43yB01fqRqQwMJ+YHyFV+4jrkCMf7RW5Kiz3zj5g2VmQPNTOD6OTwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n/gIgXK1uivQMg1Yf/R3taOx4d+4xYandkIg1fsRkUk=; b=DCAJA2vZNO9rNB9FL0SGZ1xjVUjfxawYAA40GPBRyktQNnEE21DunFGQB0KXyJRB0uKsSB9GdMYFPuWT1GqyMs7bYVXrXfI4XItMllnU89ptIQXaZ/m7dGn+JMg2KU7LSWeDN1xkYypzNDSeZZna7cn4qknP3ZRsAIO1wQIdpnUpNKyF4bSNTI9WT6WLwIVbSfOXXLeAaGRX5VbVBkZ5DaClR50t4/cPlZECAzD0MsXSaS/gA2Y9hgP/hYSxiIhK628ErSxVnRHxRPA+LSIbccpq5hR9Mu7Yxlf0IJpMkiRJW7L699yzat1yYfGRGp4j2zbb/LjsIGDQkunHTRkXtw== From: John Levon To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , John Levon , Thanos Makatos , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/3] tests/functional: add vm param to console routines Date: Mon, 18 Aug 2025 12:05:45 +0100 Message-ID: <20250818110546.2159622-3-john.levon@nutanix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250818110546.2159622-1-john.levon@nutanix.com> References: <20250818110546.2159622-1-john.levon@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR02MB6760:EE_|MN2PR02MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 2400623b-444b-44df-ac9d-08ddde47327d x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vSfkDSaCab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hu5mUuiNA41BaiabRR/6J2Da?= =?us-ascii?Q?XhTkgPx3nIUcLPC/USUfUv3vdHRCW7Us5OfkoLGeuFjSiZQ806b50X5XSjTz?= =?us-ascii?Q?ZDDFLkJKC+zfNG2m2fX8cN/oqfSwpf5WRvCo2OCB+a0OzXA+2ckuodlRkPFE?= =?us-ascii?Q?TEhr8QFvyhRxsXNT1Z42O9/kK5oilFfavbhXOQ67+Z/om7oR/7NlF90eqSQv?= =?us-ascii?Q?+KhE1UjPffzLi3Djo9qN/aF7s4icaoQ2S3iKPgjV7LlwPLYc1zEzAPU7rDQI?= =?us-ascii?Q?o6ZWD5ol9O2YMHDAMl7sVUa/zocg47f0x0Ky47+fSUiqgiGeiSO5uOjLSOmn?= =?us-ascii?Q?m7E2G9pH5VNPcWJ48oHGg4ZAIUN6rG+UdCLKGiHpmbHeNlDH4XOMuketB/Bp?= =?us-ascii?Q?Uc63D4BD66dtra7h4Y0IhhBGBImYx4F0LreBnsXKgzA3O8IKYC0SErnXvnhZ?= =?us-ascii?Q?3X3+81L4rYtCioSQpu095SzJrlMl9z8iYUZG65sgoQqUrzg5k9VfXuPBQkj/?= =?us-ascii?Q?C8FGZfbV6CBfaOt8LHTAF0wtAZ3dt/BYqEmgb9M+2cRwj1YPhHVdwXewAswH?= =?us-ascii?Q?has6tJi7FEk=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR02MB6760.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Uy7zbusYgnFp3OKtfq5T9EzI0zWf56XgxxXOr/aHDeiQ7U37cd2GpjDng2jY?= =?us-ascii?Q?7RjfldraCP2uUCl/daK6x/RfJxth/klUpnEdHy+/0daP18KlWT529BRQEH8I?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Lnnb4VRTaFGmJpIO/9ZC3?= =?us-ascii?Q?RKsuMe3R8UpaedeQiqmK2RceOToF07YUu/+TURBgz7I37gzPiM6E5xUNtk6P?= =?us-ascii?Q?qdgypdiEEBRa8HQYdt27SPrCKYUTk6lcDtJMWjsPxAE97/HGTngZXetJFLC2?= =?us-ascii?Q?LQjlB0n/3MPzZ92zvlcYxMGavw1Tdn1b3a9MFc5UT33NvtGXAhHhxzNCYbhF?= =?us-ascii?Q?3V1n+GCI9qx3G+4H816jTplOCxXqSCb1kQRheZtEQmjJTbgYBEiXtNwAJEji?= =?us-ascii?Q?K80lnnIxUC1Co8UP3Jzd6lISPUaEURVBgMaLbewBfEqxBpxPrqJkxyGrdkqx?= =?us-ascii?Q?34cRJM8PzvhLzU6cgAICANdlyMPFHeqJQvWn1Umsx4+vVN0JI8ibFhzCCLKB?= =?us-ascii?Q?qpWDVBkHKT6bVeOGge9ekXw3N3jBJeTO6Fz2KwMexymnUpqESj9aWdJGXWLK?= =?us-ascii?Q?/05+BlqBJoC7OPsoiO11+5/ZUH0vKkzCJpjKQL2D83mS4zTSiJGq0panUUhg?= =?us-ascii?Q?69y5YVhJyi4INUxr7jEEtvFoqHnyQnP8kB9wcQWe2YKKpOf+uJKwUvIuqpOR?= =?us-ascii?Q?uR4GQURM5uDhL+FJlLYQ+wpc5IUJnAM833+nTC09?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2400623b-444b-44df-ac9d-08ddde47327d X-MS-Exchange-CrossTenant-AuthSource: CH2PR02MB6760.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2025 11:05:52.8910 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8ocYQS8JJmdjp9YbFcio3uhUz4VS3Woek64jG0xNbGRF7oa1ez4GD0xJq/35//UNAHRA6Yv0nCmq3DJrwcoMhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6814 X-Authority-Analysis: v=2.4 cv=BIizrEQG c=1 sm=1 tr=0 ts=68a30912 cx=c_pps a=mNDmJ1XC7hJeB1Yk8AIX0A==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=2OwXVqhp2XgA:10 a=0kUYKlekyDsA:10 a=64Cc0HZtAAAA:8 a=boAznzkDS1D7gNr825kA:9 X-Proofpoint-GUID: _S5c1vk_6SxW7wbCdIHlEvQA8e9wkb9s X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODE4MDEwNiBTYWx0ZWRfXxKeeEJKuX3Qs Iw4jZ1LRYa0OViVXE4iZE2B7gLUmzwbPxR+LqwAeamy4/ju4CFFAy/wWvvywbgBjAa05IwcFmh1 N+F80TYVDfvc6gEpAWJj4AjH7WVk1bJgsLk2NfsFR+uX9P6BPG+bjGtuHdFYXw6WfY5+CBqZwT0 ZC1sgvydDQFUSWzv/y9LZ+V1lNl6kqdSecX4m6woxveOQNZevbYtMXZy6U/hvksKh3z5CrjVIuf 3OWkyeoPT1KV4oss32DhnLfi4vnk32Z0xq2T7hH/cDEnbPW5cpKS2oROCP7bFuT1Vz8Av3OWgn9 c00lcOWkEd1PhkeBKkrJmDU4TQCMTP27agz5jFcGwqonFZH/40zL2mceY47VIE= X-Proofpoint-ORIG-GUID: _S5c1vk_6SxW7wbCdIHlEvQA8e9wkb9s X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-18_04,2025-08-14_01,2025-03-28_01 X-Proofpoint-Spam-Reason: safe 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=148.163.155.12; envelope-from=john.levon@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Precedence: list 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 @nutanix.com) X-ZM-MESSAGEID: 1755515224989124100 Content-Type: text/plain; charset="utf-8" Extend the "vm" parameter of wait_for_console_pattern() to all the other utility functions; this allows them to be used on a VM other than test.vm. Signed-off-by: John Levon Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/cmd.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test= /cmd.py index 6355b1a683..ae13de0aea 100644 --- a/tests/functional/qemu_test/cmd.py +++ b/tests/functional/qemu_test/cmd.py @@ -144,7 +144,8 @@ def _console_interaction(test, success_message, failure= _message, =20 def interrupt_interactive_console_until_pattern(test, success_message, failure_message=3DNone, - interrupt_string=3D'\r'): + interrupt_string=3D'\r', + vm=3DNone): """ Keep sending a string to interrupt a console prompt, while logging the console output. Typical use case is to break a boot loader prompt, suc= h: @@ -164,10 +165,11 @@ def interrupt_interactive_console_until_pattern(test,= success_message, :param failure_message: if this message appears, test fails :param interrupt_string: a string to send to the console before trying to read a new line + :param vm: VM to use """ assert success_message _console_interaction(test, success_message, failure_message, - interrupt_string, True) + interrupt_string, True, vm=3Dvm) =20 def wait_for_console_pattern(test, success_message, failure_message=3DNone, vm=3DNone): @@ -179,11 +181,12 @@ def wait_for_console_pattern(test, success_message, f= ailure_message=3DNone, :type test: :class:`qemu_test.QemuSystemTest` :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails + :param vm: VM to use """ assert success_message _console_interaction(test, success_message, failure_message, None, vm= =3Dvm) =20 -def exec_command(test, command): +def exec_command(test, command, vm=3DNone): """ Send a command to a console (appending CRLF characters), while logging the content. @@ -191,12 +194,14 @@ def exec_command(test, command): :param test: a test containing a VM. :type test: :class:`qemu_test.QemuSystemTest` :param command: the command to send + :param vm: VM to use :type command: str """ - _console_interaction(test, None, None, command + '\r') + _console_interaction(test, None, None, command + '\r', vm=3Dvm) =20 def exec_command_and_wait_for_pattern(test, command, - success_message, failure_message=3DN= one): + success_message, failure_message=3DN= one, + vm=3DNone): """ Send a command to a console (appending CRLF characters), then wait for success_message to appear on the console, while logging the. @@ -208,13 +213,14 @@ def exec_command_and_wait_for_pattern(test, command, :param command: the command to send :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails + :param vm: VM to use =20 :return: The collected output (in bytes form). """ assert success_message =20 return _console_interaction(test, success_message, failure_message, - command + '\r') + command + '\r', vm=3Dvm) =20 def get_qemu_img(test): test.log.debug('Looking for and selecting a qemu-img binary') --=20 2.43.0 From nobody Sat Nov 15 05:35:25 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; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1755515221; cv=pass; d=zohomail.com; s=zohoarc; b=LHn8ZGgiu/LTBb7IN0fAn0U6z3flalnTpjVIsVHnd1ZB14sJj+zE2h8tiSVERTuNcDiR+Utfxsd3MQCkhsyMUEzKMaHmRuNTGakHTxWyVWjta/IbuNA4Tx9u6JDklSiMudeIC1wzJBhDXJsXd+CG+87rREf4EFmOCo7DqzdWM9c= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755515221; h=Content-Type: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=YF3Hsb+jjK8ynrqHB+yugg947jpgbObP7CVyCp/Y6sI=; b=jijGhJ97Bc3l/w/u4UVqTbdO85Mj4OqcHVDJ9MEtzBqvH6GsCGgAXAvthTksTGgyg4dUK8UwkdhEza72A4jp1Yflq7e09V88LklCJLZ2QNF1j/pO/cFW0XU/eS21nnftQ/yudzaenkYubw5X7/KfaP7Rk57fpni0CMxKCdw2L8s= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); 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 1755515221306409.0929137295532; Mon, 18 Aug 2025 04:07:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1unxgk-0008RB-1Y; Mon, 18 Aug 2025 07:06:06 -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 1unxgh-0008QM-Dj for qemu-devel@nongnu.org; Mon, 18 Aug 2025 07:06:04 -0400 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unxge-0001QG-En for qemu-devel@nongnu.org; Mon, 18 Aug 2025 07:06:03 -0400 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 57IAOMuA052491; Mon, 18 Aug 2025 04:05:57 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10on2114.outbound.protection.outlook.com [40.107.92.114]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 48k9kn1x0a-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 18 Aug 2025 04:05:57 -0700 (PDT) Received: from CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) by MN2PR02MB6814.namprd02.prod.outlook.com (2603:10b6:208:199::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.24; Mon, 18 Aug 2025 11:05:54 +0000 Received: from CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51]) by CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51%7]) with mapi id 15.20.9031.023; Mon, 18 Aug 2025 11:05:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint20171006; bh=YF3Hsb+jjK8ynrqHB+yugg947jpgbObP7CVyCp/Y6 sI=; b=p3t3ZIxRI5FssjFiWHO/GfgoSjtEKeE4Y/SMApbiJtB9KY20Wo/rNnI5e iHa+x7trT/i1EmaUHaHjUsFgf9YvOmMYjpnBNGT8Nf+tUWpgarT9VH4YSN6sESOf 9DQqdtUFhQvNTU3nPlip43wFMctAHDApmfikD3uhh97Dd94QStRH1x4jIim0ph7w oqd7jndfa8+gv0t87WEo1nxFsauaQMjX5ryOzVD7fqYWlMulqCUTcshxMvcpsAGz 8weAatYzW+TQ3B/5bxEYpHuraDSOG3Tv4mpAzHVB+X4APLj++wySHbWFExuLW5AG n/NiFxObECF45W3vAvsqrGEpQS4Mg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aB9Xv7DrnF+QZnB9S84ATVD8/7m0BmoMBftmw0OHLFCXcS7Lzpmia61uJhosBAMTfWC1LUvgGD528grg1T4gOvg+JO/6/QQ8FewSvrnHhI88Umw7+W0dQrmgViq6x6L7BQG92GLZzFjYJMhD909gHaKf4xn7WNwx7oeeIsVpYN+TcAwuB/1sM8WgkkkfpUnXvFfqiIapTpyUpa5VDlp+QUiTp5aV349HvW8bDDDt9w84mDkKEKx2tschP3EsFt/DNFQ6FtD6P/CL1uf2klWg353GH91iMJGXqpd1xcrhn58gZ5w2ToV1eMFHdNBwJ/fQTMfMwHfNYw1Dn4EG2yWF7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YF3Hsb+jjK8ynrqHB+yugg947jpgbObP7CVyCp/Y6sI=; b=JQ4ePqFClJouTDdDbOUY+8Pgf41YAW6A7mTufi89+MCm146Wv0S7rcqnOahNoEPBIzLSxD3U5Pnfc/F00e1TiozNiK9PodW6T/BJp1YE1BtZibh2Hx/KHSDcphd6YApIZer6dkEvSBxbcxLUu8gfezoky7gfoymCWzPhR8reR0Y7tc+ts7WLopmZ0ZGaTHcGT5hQRqyCG1GzsYl+rcZtzq6if0dhw1ast6rfBRQXAN8Q1bgwHokhU1G16uxKUFDgyfnN2ZFHj31XJ3BYMo4sbYIGwz2BAjtLYq5km4N/QL+Y+aBNvdHZigHEFzepGVrKn1hQmrenrcPZ4xGABl9Qzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YF3Hsb+jjK8ynrqHB+yugg947jpgbObP7CVyCp/Y6sI=; b=XqbW80DWyjjEpuRDIoBpXQC39kWubMLjf515ecMz0Rl8KDUuDA1pn4Lz9xwEpgjIOUZV3XUKMtVNNm7XUM/UXOjFWr718s7M2Ggw9RtR0mAxysds84d/EdlbPiiSXUTGJgKlFKj/m0GyPzjgXRK9qNTprNlzuSmNCrP8aBQeXgc8oyhBptwwpidH0INShtfJyWGx+cxbdQV26Sr2Z5O3PDlEXCizXFgXK0ADD4CZCa4A9WyNzxxQpt9JO8u48gZ52msgm/MlqmbV4rCSLrtrG6g5OY3Yxr3Y0wwRJn2GO6UspBgMbphpeHhTz0nuF1N1dJEEI3Vt2xQj1cGuZ/gRPQ== From: John Levon To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , John Levon , Thanos Makatos , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland Subject: [PATCH 3/3] tests/functional: add a vfio-user smoke test Date: Mon, 18 Aug 2025 12:05:46 +0100 Message-ID: <20250818110546.2159622-4-john.levon@nutanix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250818110546.2159622-1-john.levon@nutanix.com> References: <20250818110546.2159622-1-john.levon@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR02MB6760:EE_|MN2PR02MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 497270d7-53cb-463f-023b-08ddde473363 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?AQ/LrDE5MdgW9QHItW2scbpTCxQKWh8GlHgbRmiYtJPb/4pk27sZ27eqzVes?= =?us-ascii?Q?o+j36J6JGjERLpZxM25LtyR5yc9SUIvJ2qwhqXiCCT9gGltG/BPkpNIDlqWL?= =?us-ascii?Q?tLgaZUNxGDhygA4W5ABnlxIXbW6Ch9l7qbcisO6+mZSMvcQwrK07Oy7/ouXv?= =?us-ascii?Q?wfCrDdOgwtvDnzriaGDE140EiFinuGjaeGUtPvBQF4YVwyCvIXhaNKLep+e2?= =?us-ascii?Q?Q7FcIGAq3kkhv6ChIParud92u2MHfmBDxbowUjexw3Z8wxzTM68NwMiJZYzP?= =?us-ascii?Q?cx4VnPGZpkHnzLxlWe5wBBtqKp1mUgUvFFNWN8heDID8LVkklomNoX3ZfdWt?= =?us-ascii?Q?oy3el2b8FG6bn/OGpOo58z7FxP3fpoSzqE1EJI6Uyzecj89V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dVwBiX+0btmSUxxo0Tkr6pKifrr//Th5+?= =?us-ascii?Q?+jgDyMXBaG7BEPLP+dy0PBPXTaH1XvL56YuWbZmUMDk/Ifxd1KSfUBhOrvIE?= =?us-ascii?Q?+PfmRVIGESXp+j9yaIm/Y3OryLWr?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR02MB6760.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jFQVPzX+Mj5f2UzSiF0j5nifIHm3R5YogOtO465fERtwmRsuA2DoLmRlWlgq?= =?us-ascii?Q?xBQpU8uYM7WxjG+1lOLPgIBsb3kHKslZ4XHwjlbDyFFKWmK/uKQcpyhX74/9?= =?us-ascii?Q?kapNVdPnUgETYhU+HNjDCc15+U6H4PZhUyHD0ivLykaA7UFP4iqTeRVGoyjR?= =?us-ascii?Q?W1X5Kh+i3fU3JpG4ZoIG9syeDG6vG+TW39omETVNk8TubjK1fpsPGfsOQhgE?= =?us-ascii?Q?Y7W2xqhJMGbQQqoAfDJYlVJ6mve1r4SBwNQ2d2rfkfkXn0CLLv2P3a0DWaUI?= =?us-ascii?Q?SPw3MMxSDs8hOvzJ7VWuyqcKE67pWAIzUGEYALFcfayWLUTUzx+LnGtUudmg?= =?us-ascii?Q?eEnEyeB5wtbgeOENm3WJUSlslFPwkUXiHoK+slX2aIar/fvHJkfat1acjwId?= =?us-ascii?Q?s3jWaSNZjo6Dfjmiz6WlL3/93zOVuCAG11o3A1Kx0fhP3fPmfrLL5iL6nlSD?= =?us-ascii?Q?7TqJIGr6NBJDEKs3Zmh2K3DjRSybc764ke+liBy3oHlYlVMfIM5TE0yw+o8S?= =?us-ascii?Q?Ktm1pymEjK3MGA7lAZnUY7Jkz8eNjJAD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ascii?Q?frIp8WjgDup66eXH2iwccdYX4JFq74h40NY7VEaIS5L0Ny6KjVbREFSvFCv8?= =?us-ascii?Q?PzDUPFiJlV/Q9zi55PlXDJBtAOXCYWdcpGwYOf3qe5N829sN/yl6m76m4ACg?= =?us-ascii?Q?zNgAZkfDMnE0oY2da5TQPU5+7iWJMBGq5xe2QjiI?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 497270d7-53cb-463f-023b-08ddde473363 X-MS-Exchange-CrossTenant-AuthSource: CH2PR02MB6760.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2025 11:05:54.5298 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bBy7ABsSFfMU1F1ZevXdVO1O3spuzfQLIbIc8BgppVIGF7ws9jGNc9mBnJcwYonoX+IZCZqdIVW4hpN6LjHsTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6814 X-Proofpoint-GUID: jNCY-dxTOTLqX4n7eSK6s0s9G_GrqG0D X-Proofpoint-ORIG-GUID: jNCY-dxTOTLqX4n7eSK6s0s9G_GrqG0D X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODE4MDEwNiBTYWx0ZWRfXxU+oeqOWs9xI OXZoCG0Gah0rtCz+vDJtVS2u3+AmDL6id1NZ3emD5re7x4jOwjndxf3fDyGzValR1nkZaIrbYs/ remibcimSJIMBl2yJV1qLCeiiPaNeGL7S94lYtLXcf0UoRyv+UYasTR6uH+1OpbQz+Kbr8TRZuz VsteCXmOyCZ/AtQgEK8aeyQnttMFCG93hvrmq9mxHBcCvvf94MugBpa0xzBHOcBQlFKLzTcbKhB oMR9hq//14VcNLgo+uXTN32fNHYXwcWzykdW/3ttWj7KIU4PXpMQzszn18tuq0dySdKyZ/ZrARn 5y8KhVwRLFhobiWhD572xtqEE077Gj8WCdqeUPiXsOlNHb1ZMjrJ1wtuJaYSws= X-Authority-Analysis: v=2.4 cv=H8nbw/Yi c=1 sm=1 tr=0 ts=68a30915 cx=c_pps a=1agHWDAk2Ff3ek/eqE8klw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=2OwXVqhp2XgA:10 a=0kUYKlekyDsA:10 a=NEAV23lmAAAA:8 a=64Cc0HZtAAAA:8 a=20KFwNOVAAAA:8 a=bGJ7yUH-iEoZGlg0rpsA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-18_04,2025-08-14_01,2025-03-28_01 X-Proofpoint-Spam-Reason: safe 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=148.163.151.68; envelope-from=john.levon@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Precedence: list 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 @nutanix.com) X-ZM-MESSAGEID: 1755515223410116600 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Add a basic test of the vfio-user PCI client implementation. Co-authored-by: John Levon Signed-off-by: Mark Cave-Ayland Signed-off-by: John Levon Reviewed-by: Daniel P. Berrang=C3=A9 --- MAINTAINERS | 1 + tests/functional/meson.build | 1 + tests/functional/test_vfio_user_client.py | 407 ++++++++++++++++++++++ 3 files changed, 409 insertions(+) create mode 100755 tests/functional/test_vfio_user_client.py diff --git a/MAINTAINERS b/MAINTAINERS index a07086ed76..5627a05f87 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4298,6 +4298,7 @@ F: docs/system/devices/vfio-user.rst F: hw/vfio-user/* F: include/hw/vfio-user/* F: subprojects/libvfio-user +F: tests/functional/test_vfio_user_client.py =20 EBPF: M: Jason Wang diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 311c6f1806..b786f5e5cf 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -334,6 +334,7 @@ tests_x86_64_system_thorough =3D [ 'linux_initrd', 'multiprocess', 'netdev_ethtool', + 'vfio_user_client', 'virtio_balloon', 'virtio_gpu', 'x86_64_hotplug_blk', diff --git a/tests/functional/test_vfio_user_client.py b/tests/functional/t= est_vfio_user_client.py new file mode 100755 index 0000000000..51676dbf8e --- /dev/null +++ b/tests/functional/test_vfio_user_client.py @@ -0,0 +1,407 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2025 Nutanix, Inc. +# +# Author: +# Mark Cave-Ayland +# John Levon +# +# SPDX-License-Identifier: GPL-2.0-or-later +""" +Check basic vfio-user-pci client functionality. The test starts two VMs: + + - the server VM runs the libvfio-user "gpio" example server inside it, + piping vfio-user traffic between a local UNIX socket and a virtio-se= rial + port. On the host, the virtio-serial port is backed by a local socke= t. + + - the client VM loads the gpio-pci-idio-16 kernel module, with the + vfio-user client connecting to the above local UNIX socket. + +This way, we don't depend on trying to run a vfio-user server on the host +itself. + +Once both VMs are running, we run some basic configuration on the gpio dev= ice +and verify that the server is logging the expected out. As this is consist= ent +given the same VM images, we just do a simple direct comparison. +""" + +import difflib +import logging +import os +import re +import select +import shutil +import socket +import subprocess +import time + +from qemu_test import Asset +from qemu_test import QemuSystemTest +from qemu_test import exec_command +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern + +EXPECTED_SERVER_OUT=3D\ +"""gpio: adding DMA region [0, 0xc0000) offset=3D0 flags=3D0x3 +gpio: adding DMA region [0xc0000, 0xe0000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0xe0000, 0x100000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0x100000, 0x8000000) offset=3D0 flags=3D0x3 +gpio: adding DMA region [0xfffc0000, 0x100000000) offset=3D0 flags=3D0x1 +gpio: devinfo flags 0x3, num_regions 9, num_irqs 5 +gpio: region_info[0] offset 0 flags 0 size 0 argsz 32 +gpio: region_info[1] offset 0 flags 0 size 0 argsz 32 +gpio: region_info[2] offset 0 flags 0x3 size 256 argsz 32 +gpio: region_info[3] offset 0 flags 0 size 0 argsz 32 +gpio: region_info[4] offset 0 flags 0 size 0 argsz 32 +gpio: region_info[5] offset 0 flags 0 size 0 argsz 32 +gpio: region_info[7] offset 0 flags 0x3 size 256 argsz 32 +gpio: region7: read 256 bytes at 0 +gpio: region7: read 0 from (0x30:4) +gpio: write mask to EROM ignored +gpio: region7: wrote 0xfffff800 to (0x30:4) +gpio: region7: read 0 from (0x30:4) +gpio: cleared EROM +gpio: region7: wrote 0 to (0x30:4) +gpio: region7: read 0x1 from (0x18:4) +gpio: region7: read 0x1 from (0x3d:1) +gpio: region7: read 0x1 from (0x3d:1) +gpio: disabling IRQ type INTx range [0, 1) +gpio: disabling IRQ type ERR range [0, 1) +gpio: disabling IRQ type INTx range [0, 1) +gpio: region7: read 0 from (0x4:2) +gpio: region7: wrote 0 to (0x4:2) +gpio: device reset by client +gpio: region7: read 0x1 from (0x3d:1) +gpio: disabling IRQ type INTx range [0, 1) +gpio: region7: wrote 0 to (0x10:4) +gpio: region7: wrote 0 to (0x14:4) +gpio: BAR2 addr 0x0 +gpio: region7: wrote 0 to (0x18:4) +gpio: region7: wrote 0 to (0x1c:4) +gpio: region7: wrote 0 to (0x20:4) +gpio: region7: wrote 0 to (0x24:4) +gpio: removing DMA region [0, 0xc0000) flags=3D0 +gpio: removing DMA region [0xc0000, 0xe0000) flags=3D0 +gpio: removing DMA region [0xe0000, 0x100000) flags=3D0 +gpio: removing DMA region [0x100000, 0x8000000) flags=3D0 +gpio: adding DMA region [0, 0xd0000) offset=3D0 flags=3D0x3 +gpio: adding DMA region [0xd0000, 0xe0000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0xe0000, 0xf0000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0xf0000, 0x8000000) offset=3D0 flags=3D0x3 +gpio: removing DMA region [0, 0xd0000) flags=3D0 +gpio: removing DMA region [0xd0000, 0xe0000) flags=3D0 +gpio: removing DMA region [0xe0000, 0xf0000) flags=3D0 +gpio: removing DMA region [0xf0000, 0x8000000) flags=3D0 +gpio: adding DMA region [0, 0x8000000) offset=3D0 flags=3D0x3 +gpio: region7: read 0x494f from (0:2) +gpio: region7: read 0 from (0xe:1) +gpio: region7: read 0x494f from (0:2) +gpio: region7: read 0 from (0xe:1) +gpio: region7: read 0x494f from (0:2) +gpio: region7: read 0xdc8494f from (0:4) +gpio: region7: read 0 from (0x8:4) +gpio: region7: read 0 from (0xe:1) +gpio: region7: read 0 from (0xe:1) +gpio: region7: wrote 0xffffffff to (0x10:4) +gpio: region7: wrote 0 to (0x10:4) +gpio: region7: wrote 0xffffffff to (0x14:4) +gpio: region7: wrote 0 to (0x14:4) +gpio: BAR2 addr 0xffffffff +gpio: region7: wrote 0xffffffff to (0x18:4) +gpio: BAR2 addr 0x1 +gpio: region7: wrote 0x1 to (0x18:4) +gpio: region7: wrote 0xffffffff to (0x1c:4) +gpio: region7: wrote 0 to (0x1c:4) +gpio: region7: wrote 0xffffffff to (0x20:4) +gpio: region7: wrote 0 to (0x20:4) +gpio: region7: wrote 0xffffffff to (0x24:4) +gpio: region7: wrote 0 to (0x24:4) +gpio: write mask to EROM ignored +gpio: region7: wrote 0xfffff800 to (0x30:4) +gpio: cleared EROM +gpio: region7: wrote 0 to (0x30:4) +gpio: BAR2 addr 0xc000 +gpio: region7: wrote 0xc000 to (0x18:4) +gpio: region7: read 0x1 from (0x3d:1) +gpio: ILINE=3Db +gpio: region7: wrote 0xb to (0x3c:1) +gpio: region7: read 0 from (0x4:2) +gpio: I/O space enabled +gpio: memory space enabled +gpio: SERR# enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x1 from (0x3d:1) +gpio: region7: read 0xb from (0x3c:1) +gpio: adding DMA region [0xfeb80000, 0xfebc0000) offset=3D0 flags=3D0x1 +gpio: removing DMA region [0xfeb80000, 0xfebc0000) flags=3D0 +gpio: EROM disable ignored +gpio: region7: wrote 0xfffffffe to (0x30:4) +gpio: cleared EROM +gpio: region7: wrote 0 to (0x30:4) +gpio: removing DMA region [0, 0x8000000) flags=3D0 +gpio: adding DMA region [0, 0xc0000) offset=3D0 flags=3D0x3 +gpio: adding DMA region [0xc0000, 0xc1000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0xc1000, 0xc4000) offset=3D0 flags=3D0x3 +gpio: adding DMA region [0xc4000, 0xd0000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0xd0000, 0xf0000) offset=3D0 flags=3D0x3 +gpio: adding DMA region [0xf0000, 0x100000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0x100000, 0x8000000) offset=3D0 flags=3D0x3 +gpio: removing DMA region [0xc4000, 0xd0000) flags=3D0 +gpio: removing DMA region [0xd0000, 0xf0000) flags=3D0 +gpio: adding DMA region [0xc4000, 0xe8000) offset=3D0 flags=3D0x1 +gpio: adding DMA region [0xe8000, 0xf0000) offset=3D0 flags=3D0x3 +gpio: region7: read 0x494f from (0:2) +gpio: region7: read 0xdc8 from (0x2:2) +gpio: region7: read 0 from (0xe:1) +gpio: region7: read 0xdc8494f from (0:4) +gpio: region7: read 0 from (0xe:1) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x8:4) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: INTx emulation disabled +gpio: region7: wrote 0x503 to (0x4:2) +gpio: region7: read 0x503 from (0x4:2) +gpio: INTx emulation enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x1 from (0x3d:1) +gpio: region7: read 0xb from (0x3c:1) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: region7: wrote 0xffffffff to (0x10:4) +gpio: region7: wrote 0 to (0x10:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: region7: wrote 0xffffffff to (0x14:4) +gpio: region7: wrote 0 to (0x14:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: BAR2 addr 0xffffffff +gpio: region7: wrote 0xffffffff to (0x18:4) +gpio: BAR2 addr 0xc001 +gpio: region7: wrote 0xc001 to (0x18:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: region7: wrote 0xffffffff to (0x1c:4) +gpio: region7: wrote 0 to (0x1c:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: region7: wrote 0xffffffff to (0x20:4) +gpio: region7: wrote 0 to (0x20:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: region7: wrote 0xffffffff to (0x24:4) +gpio: region7: wrote 0 to (0x24:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: I/O space disabled +gpio: memory space disabled +gpio: region7: wrote 0x100 to (0x4:2) +gpio: write mask to EROM ignored +gpio: region7: wrote 0xfffff800 to (0x30:4) +gpio: cleared EROM +gpio: region7: wrote 0 to (0x30:4) +gpio: I/O space enabled +gpio: memory space enabled +gpio: region7: wrote 0x103 to (0x4:2) +gpio: region7: read 0 from (0x2c:2) +gpio: region7: read 0 from (0x2e:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0 from (0x6:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: region7: read 0x103 from (0x4:2) +gpio: region7: read 0 from (0xc:1) +gpio: region7: read 0x103 from (0x4:2) +gpio: region7: read 0x1 from (0x3d:1) +gpio: region7: read 0x103 from (0x4:2) +gpio: region2: wrote 0 to (0x3:1) +gpio: region2: wrote 0 to (0x2:1) +gpio: region2: wrote 0 to (0x1:1)""" + + +class VfioUserClient(QemuSystemTest): + + ASSET_REPO =3D 'https://github.com/mcayland-ntx/libvfio-user-test' + + ASSET_KERNEL =3D Asset( + f'{ASSET_REPO}/raw/refs/heads/main/images/bzImage', + '40292fa6ce95d516e26bccf5974e138d0db65a6de0bc540cabae060fe9dea605' + ) + + ASSET_ROOTFS =3D Asset( + f'{ASSET_REPO}/raw/refs/heads/main/images/rootfs.ext2', + 'e1e3abae8aebb8e6e77f08b1c531caeacf46250c94c815655c6bbea59fc3d1c1' + ) + + + def prepare_images(self): + """Set up the images for the VMs.""" + self.kernel_path =3D self.ASSET_KERNEL.fetch() + rootfs_path =3D self.ASSET_ROOTFS.fetch() + + self.server_rootfs_path =3D self.scratch_file('server.ext2') + shutil.copy(rootfs_path, self.server_rootfs_path) + os.chmod(self.server_rootfs_path, 0o600) + self.client_rootfs_path =3D self.scratch_file('client.ext2') + shutil.copy(rootfs_path, self.client_rootfs_path) + os.chmod(self.client_rootfs_path, 0o600) + + def configure_server_vm_args(self, server_vm, sock_path): + """ + Configuration for the server VM. Set up virtio-serial device backe= d by + the given socket path. + """ + server_vm.add_args('-kernel', self.kernel_path) + server_vm.add_args('-append', 'console=3DttyS0 root=3D/dev/sda') + server_vm.add_args('-drive', + f"file=3D{self.server_rootfs_path},if=3Dide,format=3Draw,id=3D= drv0") + server_vm.add_args('-snapshot') + server_vm.add_args('-chardev', + f"socket,id=3Dsock0,path=3D{sock_path},telnet=3Doff,server=3Do= n,wait=3Doff") + server_vm.add_args('-device', 'virtio-serial') + server_vm.add_args('-device', + 'virtserialport,chardev=3Dsock0,name=3Dorg.fedoraproject.port.= 0') + + def configure_client_vm_args(self, client_vm, sock_path): + """ + Configuration for the client VM. Point the vfio-user-pci device to= the + socket path configured above. + """ + + client_vm.add_args('-kernel', self.kernel_path) + client_vm.add_args('-append', 'console=3DttyS0 root=3D/dev/sda') + client_vm.add_args('-drive', + f'file=3D{self.client_rootfs_path},if=3Dide,format=3Draw,id=3D= drv0') + client_vm.add_args('-device', + '{"driver":"vfio-user-pci",' + + '"socket":{"path": "%s", "type": "unix"}}' % sock_path) + + def setup_vfio_user_pci_server(self, server_vm): + """ + Start the libvfio-user server within the server VM, and arrange + for data to shuttle between its socket and the virtio serial port. + """ + wait_for_console_pattern(self, 'login:', None, server_vm) + exec_command_and_wait_for_pattern(self, 'root', '#', None, server_= vm) + + exec_command_and_wait_for_pattern(self, + 'gpio-pci-idio-16 -v /tmp/vfio-user.sock >/var/tmp/gpio.out 2>= &1 &', + '#', None, server_vm) + # wait for libvfio-user to initialize properly + exec_command_and_wait_for_pattern(self, 'sleep 5', '#', None, serv= er_vm) + exec_command_and_wait_for_pattern(self, + 'socat UNIX-CONNECT:/tmp/vfio-user.sock /dev/vport0p1,ignoreeo= f ' + + ' &', '#', None, server_vm) + + def test_vfio_user_pci(self): + self.prepare_images() + self.set_machine('pc') + self.require_device('virtio-serial') + self.require_device('vfio-user-pci') + + sock_dir =3D self.socket_dir() + socket_path =3D sock_dir.name + '/vfio-user.sock' + socket_path =3D '/tmp/vfio-user.sock' + + server_vm =3D self.get_vm(name=3D'server') + server_vm.set_console() + self.configure_server_vm_args(server_vm, socket_path) + + server_vm.launch() + + self.log.debug('starting libvfio-user server') + + self.setup_vfio_user_pci_server(server_vm) + + client_vm =3D self.get_vm(name=3D"client") + client_vm.set_console() + self.configure_client_vm_args(client_vm, socket_path) + + try: + client_vm.launch() + except: + self.log.error('client VM failed to start, dumping server logs= ') + exec_command_and_wait_for_pattern(self, 'cat /var/tmp/gpio.out= ', + '#', None, server_vm) + raise + + self.log.debug('waiting for client VM boot') + + wait_for_console_pattern(self, 'login:', None, client_vm) + exec_command_and_wait_for_pattern(self, 'root', '#', None, client_= vm) + + # + # Here, we'd like to actually interact with the gpio device a litt= le + # more as described at: + # + # https://github.com/nutanix/libvfio-user/blob/master/docs/qemu.md + # + # Unfortunately, the buildroot Linux kernel has some undiagnosed i= ssue + # so we don't get /sys/class/gpio. Nonetheless just the basic + # initialization and setup is enough for basic testing of vfio-use= r. + # + + self.log.debug('collecting libvfio-user server output') + + out =3D exec_command_and_wait_for_pattern(self, + 'cat /var/tmp/gpio.out', + 'gpio: region2: wrote 0 to (0x1:1)', + None, server_vm) + + pattern =3D re.compile(r'^gpio:') + + gpio_server_out =3D [s for s in out.decode().splitlines() + if pattern.search(s)] + + expected_server_out =3D EXPECTED_SERVER_OUT.splitlines() + + if gpio_server_out !=3D expected_server_out: + self.log.error('Server logs did not match:') + print("orig") + print(gpio_server_out) + print("second") + print(expected_server_out) + for line in difflib.unified_diff(expected_server_out, + gpio_server_out): + self.log.error(line) + + self.assertTrue(gpio_server_out =3D=3D expected_server_out) + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.43.0