From nobody Mon Feb 9 06:51:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614804865; cv=none; d=zohomail.com; s=zohoarc; b=O3q53z4YmgBGeKgUw33Ue2Mthv+3e8n0r2Q5TEZ0MQcUc5BCgVMcvnnOShVFM0P9lgRjtYKCDDFEVZlH7YYoB7p1hZGQOh2dL6RiXT211cVLwgrw2a96VcnoasN8XGQYjI2+wubMZuU1zNlAhodT668PTjMYYcmu9Potwg33bPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614804865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KjQON6tisg+MAZ9d85raTMvrdkdo5ud9vbk1AJHPzpg=; b=LpMEkby2RgvK7jrKj6ivaYwSSU12Mv89n8V1hv/pHy6LqH3IWgSXdzLX4WIuah0Yx64M31DLhd6Ft4B1S0IYapwQUOFqXPQ8bB5XeeKw5pekmRH3e+64UGeD+hjgyItV7GUdpeBhsEtoGVMGSyj6PJgRar2XCCTfahDNdwPLvMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161480486505084.11125296094053; Wed, 3 Mar 2021 12:54:25 -0800 (PST) Received: from localhost ([::1]:40368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHYVj-0007p0-Lp for importer@patchew.org; Wed, 03 Mar 2021 15:54:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHYV1-0006z0-2E for qemu-devel@nongnu.org; Wed, 03 Mar 2021 15:53:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:54423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHYUz-0003h7-Gn for qemu-devel@nongnu.org; Wed, 03 Mar 2021 15:53:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-MOkBuEPJPNm3BUY0c0aURQ-1; Wed, 03 Mar 2021 15:53:34 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B772D195D562 for ; Wed, 3 Mar 2021 20:53:33 +0000 (UTC) Received: from wrampazz.redhat.com (ovpn-112-215.rdu2.redhat.com [10.10.112.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 344B35C241; Wed, 3 Mar 2021 20:53:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614804816; 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=KjQON6tisg+MAZ9d85raTMvrdkdo5ud9vbk1AJHPzpg=; b=e7ewrSK5nL5j2NWKtY9agR1q9m4CPRBhibuLCm3iJWiEZ+LvXyuK1LPHuGfP3BIxdu6jPU SaNlEs/u3u3OcKBO78+QsVA5RTY60x78g/rDo+7kM5cHUlpnlRIodzal2ICQgKVcvkOw8W C5RRtOd7BvDhDlNr0SAbdD705tCbVJs= X-MC-Unique: MOkBuEPJPNm3BUY0c0aURQ-1 From: Willian Rampazzo To: qemu-devel@nongnu.org Subject: [PATCH v3 1/2] avocado_qemu: add exec_command function Date: Wed, 3 Mar 2021 17:53:19 -0300 Message-Id: <20210303205320.146047-2-willianr@redhat.com> In-Reply-To: <20210303205320.146047-1-willianr@redhat.com> References: <20210303205320.146047-1-willianr@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=willianr@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=63.128.21.124; envelope-from=willianr@redhat.com; helo=us-smtp-delivery-124.mimecast.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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Sometimes a test needs to send a command to a console without waiting for a pattern as a result, or the command issued do not produce any kind of output, like, for example, a `mount` command. This introduces the `exec_command` function to the avocado_qemu, allowing the test to send a command to the console without the need to match a pattern produced as a result. Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Cleber Rosa --- tests/acceptance/avocado_qemu/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index df167b142c..0e6d286403 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -93,7 +93,7 @@ def _console_interaction(test, success_message, failure_m= essage, if not msg: continue console_logger.debug(msg) - if success_message in msg: + if success_message is None or success_message in msg: break if failure_message and failure_message in msg: console.close() @@ -139,6 +139,18 @@ def wait_for_console_pattern(test, success_message, fa= ilure_message=3DNone, """ _console_interaction(test, success_message, failure_message, None, vm= =3Dvm) =20 +def exec_command(test, command): + """ + Send a command to a console (appending CRLF characters), while logging + the content. + + :param test: an Avocado test containing a VM. + :type test: :class:`avocado_qemu.Test` + :param command: the command to send + :type command: str + """ + _console_interaction(test, None, None, command + '\r') + def exec_command_and_wait_for_pattern(test, command, success_message, failure_message=3DN= one): """ --=20 2.29.2 From nobody Mon Feb 9 06:51:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614804965; cv=none; d=zohomail.com; s=zohoarc; b=ZhX5rBCw1V/U0p3DZIsdg0hTcI4UEb5alW9yH8gqHHfPtTHT3ieSAzR4HDLDFvC96jXYzUTMx5zIwLv7Sc90ZRD1BKATjSgQ99YhxFK1YrJ5JsemgXS4zU6nh+6/9yN0n5w6hkAfDhROlwLpOzK37lH8pYT4E8qaLerfNgYPfZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614804965; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iSsFL0mSoxuU0L2Nc4slpBU7x3GuS3vF0ixTSXznRz0=; b=CsXW1FBraO0ktO0FIgr6KwUzsx8xXrxYeRxLT5Z5Z1Afj/bbHbV2DIGd6eqp8jMFB+E//yIK9DYgFbrEBc83LQWGk0TQeVMklLLFuVBnPTfcSDMAFfzJGCpYGd1qJBl3hrMKcEmiMGP28O+G+WxyKpFFUCR7V/8iY/R3awPansU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161480496573663.15585922952266; Wed, 3 Mar 2021 12:56:05 -0800 (PST) Received: from localhost ([::1]:43616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHYXM-0000kl-Ol for importer@patchew.org; Wed, 03 Mar 2021 15:56:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHYV9-0007C2-IC for qemu-devel@nongnu.org; Wed, 03 Mar 2021 15:53:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23855) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHYV7-0003j6-On for qemu-devel@nongnu.org; Wed, 03 Mar 2021 15:53:47 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-4xJKxpwHPfqkWoKO9v10lQ-1; Wed, 03 Mar 2021 15:53:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70D6D107ACC7; Wed, 3 Mar 2021 20:53:40 +0000 (UTC) Received: from wrampazz.redhat.com (ovpn-112-215.rdu2.redhat.com [10.10.112.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E4D25C6B8; Wed, 3 Mar 2021 20:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614804825; 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=iSsFL0mSoxuU0L2Nc4slpBU7x3GuS3vF0ixTSXznRz0=; b=I+YkC2AdttGIKGycTr3H6rX7Uqx8lFwlcrkfg4i9/wD3g1bvZH4ZM/m6kPVRum5hDbeSpT rsGLjOKR6wP4lew19ZCdmnIDAo4Q9PbRJpdqIsDIjNixIJ0LG+9bxiLXsykk6N1msp7i83 aLQ3sV3QBZ5FU/c7VluwpLZBi+LGQS8= X-MC-Unique: 4xJKxpwHPfqkWoKO9v10lQ-1 From: Willian Rampazzo To: qemu-devel@nongnu.org Subject: [PATCH v3 2/2] tests: Add functional test for out-of-process device emulation Date: Wed, 3 Mar 2021 17:53:20 -0300 Message-Id: <20210303205320.146047-3-willianr@redhat.com> In-Reply-To: <20210303205320.146047-1-willianr@redhat.com> References: <20210303205320.146047-1-willianr@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=willianr@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=216.205.24.124; envelope-from=willianr@redhat.com; helo=us-smtp-delivery-124.mimecast.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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John G Johnson , Jagannathan Raman , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Jagannathan Raman Runs the Avocado acceptance test to check if a remote lsi53c895a device gets identified by the guest. Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Marc-Andr=C3=A9 Lureau [WR: Refactored code] Signed-off-by: Willian Rampazzo Tested-by: Wainer dos Santos Moschetta Reviewed-by: Cleber Rosa Tested-by: Cleber Rosa --- tests/acceptance/multiprocess.py | 95 ++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tests/acceptance/multiprocess.py diff --git a/tests/acceptance/multiprocess.py b/tests/acceptance/multiproce= ss.py new file mode 100644 index 0000000000..96627f022a --- /dev/null +++ b/tests/acceptance/multiprocess.py @@ -0,0 +1,95 @@ +# Test for multiprocess qemu +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + + +import os +import socket + +from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import exec_command +from avocado_qemu import exec_command_and_wait_for_pattern + +class Multiprocess(Test): + """ + :avocado: tags=3Dmultiprocess + """ + KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' + + def do_test(self, kernel_url, initrd_url, kernel_command_line, + machine_type): + """Main test method""" + self.require_accelerator('kvm') + + # Create socketpair to connect proxy and remote processes + proxy_sock, remote_sock =3D socket.socketpair(socket.AF_UNIX, + socket.SOCK_STREAM) + os.set_inheritable(proxy_sock.fileno(), True) + os.set_inheritable(remote_sock.fileno(), True) + + kernel_path =3D self.fetch_asset(kernel_url) + initrd_path =3D self.fetch_asset(initrd_url) + + # Create remote process + remote_vm =3D self.get_vm() + remote_vm.add_args('-machine', 'x-remote') + remote_vm.add_args('-nodefaults') + remote_vm.add_args('-device', 'lsi53c895a,id=3Dlsi1') + remote_vm.add_args('-object', 'x-remote-object,id=3Drobj1,' + 'devid=3Dlsi1,fd=3D'+str(remote_sock.fileno())) + remote_vm.launch() + + # Create proxy process + self.vm.set_console() + self.vm.add_args('-machine', machine_type) + self.vm.add_args('-accel', 'kvm') + self.vm.add_args('-cpu', 'host') + self.vm.add_args('-object', + 'memory-backend-memfd,id=3Dsysmem-file,size=3D2G') + self.vm.add_args('--numa', 'node,memdev=3Dsysmem-file') + self.vm.add_args('-m', '2048') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line) + self.vm.add_args('-device', + 'x-pci-proxy-dev,' + 'id=3Dlsi1,fd=3D'+str(proxy_sock.fileno())) + self.vm.launch() + wait_for_console_pattern(self, 'as init process', + 'Kernel panic - not syncing') + exec_command(self, 'mount -t sysfs sysfs /sys') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/*/ueve= nt', + 'PCI_ID=3D1000:0012') + + def test_multiprocess_x86_64(self): + """ + :avocado: tags=3Darch:x86_64 + """ + kernel_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora' + '/linux/releases/31/Everything/x86_64/os/images' + '/pxeboot/vmlinuz') + initrd_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora' + '/linux/releases/31/Everything/x86_64/os/images' + '/pxeboot/initrd.img') + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyS0 rdinit=3D/bin/bash') + machine_type =3D 'pc' + self.do_test(kernel_url, initrd_url, kernel_command_line, machine_= type) + + def test_multiprocess_aarch64(self): + """ + :avocado: tags=3Darch:aarch64 + """ + kernel_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora' + '/linux/releases/31/Everything/aarch64/os/images' + '/pxeboot/vmlinuz') + initrd_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora' + '/linux/releases/31/Everything/aarch64/os/images' + '/pxeboot/initrd.img') + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'rdinit=3D/bin/bash console=3DttyAMA0') + machine_type =3D 'virt,gic-version=3D3' + self.do_test(kernel_url, initrd_url, kernel_command_line, machine_= type) --=20 2.29.2