From nobody Wed Apr 24 14:24:50 2024 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=1620083859; cv=none; d=zohomail.com; s=zohoarc; b=YVNbFCKhrgXUWXXGjMjDZsKAe/hTN9/5c7NkQUluMkDUK9t7FaVnIPo7/7dbAlpt8M1tQildkCUfhkxMwBqBQPJDy8HyInnO6GR+WOaZhzJ7UX4w46BIBmkQnVzU9cS7lGOov/bt3h8FRcC9rMUyqx7HBzswCv9b+KR13ZBHVW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620083859; 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=sVGGxRmryoN3O41NzZEQDV26ZA/0SnU3HZG5IX6YOAw=; b=kHMdOQHuJVK47WNapo+T2oaJRUM2LBN4CRL9NgqTqVA4p7woW5sTrkP0rkHmLlZ92nWvxt69iny2ZjuDV6kPjgY6uJ28F4PxgY9bayCmHDIPdM0XPeD57WF2rebZt4SYzYuy/58CIztHT8nJjZKPlLetxGn+cXBO22mStxiVEwA= 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 1620083859948643.1367305620845; Mon, 3 May 2021 16:17:39 -0700 (PDT) Received: from localhost ([::1]:55850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhoo-0000FF-TY for importer@patchew.org; Mon, 03 May 2021 19:17:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhI3-00026B-IT for qemu-devel@nongnu.org; Mon, 03 May 2021 18:43:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhI1-0007Bc-Mq for qemu-devel@nongnu.org; Mon, 03 May 2021 18:43:47 -0400 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-428-_L65d9xoMdSvrQeeH_OJKA-1; Mon, 03 May 2021 18:43:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6859F801106 for ; Mon, 3 May 2021 22:43:42 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id B15D660937; Mon, 3 May 2021 22:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081825; 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=sVGGxRmryoN3O41NzZEQDV26ZA/0SnU3HZG5IX6YOAw=; b=VnXWH/W7824sw3E2Z6KHh/nIe7PhY5SV/Fo2DJoOgmIHc8IcDqG1g13ebzSXjYiM+q1Wq6 PXPrXnlgb5DaySLNm13qjfqpqsEPMYbK4xUxlzhWmAFlV5ctOG7SAMIOlurdzEyYDSLe8G UzyXfqnf6j1x893tBWS2yB94Lz5D2nI= X-MC-Unique: _L65d9xoMdSvrQeeH_OJKA-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 1/7] tests/acceptance: Introduce the ConsoleMixIn class Date: Mon, 3 May 2021 19:43:20 -0300 Message-Id: <20210503224326.206208-2-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This created the ConsoleMixIn class to wrap the methods related with console interaction with the guest that currently are loose in the avocado_qemu package. It should be used as a mixin on the test classes. At this point only the interrupt_interactive_console_until_pattern() was mo= ved to ConsoleMixIn. This method is only used in boot_linux_console.py tests, so there was needed to adapt them. Signed-off-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 52 +++++++++++------------ tests/acceptance/boot_linux_console.py | 10 ++--- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 83b1741ec8..6f4e0edfa3 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -101,32 +101,6 @@ def _console_interaction(test, success_message, failur= e_message, (failure_message, success_message) test.fail(fail) =20 -def interrupt_interactive_console_until_pattern(test, success_message, - failure_message=3DNone, - interrupt_string=3D'\r'): - """ - 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: - - Press a key within 5 seconds to interrupt boot process. - 5 - 4 - 3 - 2 - 1 - Booting default image... - - :param test: an Avocado test containing a VM that will have its console - read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` - :param success_message: if this message appears, test succeeds - :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 - """ - _console_interaction(test, success_message, failure_message, - interrupt_string, True) - def wait_for_console_pattern(test, success_message, failure_message=3DNone, vm=3DNone): """ @@ -168,6 +142,32 @@ def exec_command_and_wait_for_pattern(test, command, """ _console_interaction(test, success_message, failure_message, command += '\r') =20 +class ConsoleMixIn(): + """Contains utilities for interacting with a guest via Console.""" + + def interrupt_interactive_console_until_pattern(self, success_message, + failure_message=3DNone, + interrupt_string=3D'\r= '): + """ + Keep sending a string to interrupt a console prompt, while logging= the + console output. Typical use case is to break a boot loader prompt,= such: + + Press a key within 5 seconds to interrupt boot process. + 5 + 4 + 3 + 2 + 1 + Booting default image... + + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + :param interrupt_string: a string to send to the console before tr= ying + to read a new line + """ + _console_interaction(self, success_message, failure_message, + interrupt_string, True) + class Test(avocado.Test): def _get_unique_tag_val(self, tag_name): """ diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 1ca32ecf25..10317b232b 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -17,7 +17,7 @@ from avocado import skipUnless from avocado_qemu import Test from avocado_qemu import exec_command_and_wait_for_pattern -from avocado_qemu import interrupt_interactive_console_until_pattern +from avocado_qemu import ConsoleMixIn from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive @@ -45,7 +45,7 @@ def image_pow2ceil_expand(path): with open(path, 'ab+') as fd: fd.truncate(size_aligned) =20 -class LinuxKernelTest(Test): +class LinuxKernelTest(Test, ConsoleMixIn): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 def wait_for_console_pattern(self, success_message, vm=3DNone): @@ -626,8 +626,8 @@ def test_arm_quanta_gsj(self): self.wait_for_console_pattern('>Device: Poleg BMC NPCM730') self.wait_for_console_pattern('>Skip DDR init.') self.wait_for_console_pattern('U-Boot ') - interrupt_interactive_console_until_pattern( - self, 'Hit any key to stop autoboot:', 'U-Boot>') + self.interrupt_interactive_console_until_pattern( + 'Hit any key to stop autoboot:', 'U-Boot>') exec_command_and_wait_for_pattern( self, "setenv bootargs ${bootargs} " + kernel_command_line, 'U-Boot>') @@ -879,7 +879,7 @@ def test_arm_orangepi_uboot_netbsd9(self): '-no-reboot') self.vm.launch() wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1') - interrupt_interactive_console_until_pattern(self, + self.interrupt_interactive_console_until_pattern( 'Hit any key to stop autoboot:', 'switch to partitions #0, OK') =20 --=20 2.29.2 From nobody Wed Apr 24 14:24:50 2024 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=1620083069; cv=none; d=zohomail.com; s=zohoarc; b=TZLaOIZK+rYPhB/zU9I4etNjPBERpUiVZ/NcwemMs/tdtnbjKu9kXW6cdFk99qnH7JsM2EkkRU8Z091vQv2ZnYl83+AghMIEKz7XCEM/HBxH8vY912tm8VqyAhht3zoHBNJMq8IULYSQdcVIx2wM0RlINekWtHUfaOEz7/rnifo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620083069; 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=+C14LeSAWSNkxm/A+5bC2ZEsXaXapDFhzDpcd9j4pfw=; b=TRdlFA8Ukwy5ld6kI4DgB9Zox5cxL6XpgqYv1EYMzOP/6JJ0SdBSfP5GVR7B58jNBOqQoGHQaYjiz2/ptClYMtTgShbBmnEuHk0XXE4F5jYRov12V4GGDx/xSZ1RK3UpbWPrD6rd7LLIqbhfE/tFF3shp4zKEEi4I5YjTKn2sU4= 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 162008306948283.28631846616929; Mon, 3 May 2021 16:04:29 -0700 (PDT) Received: from localhost ([::1]:33738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhc4-0007av-A0 for importer@patchew.org; Mon, 03 May 2021 19:04:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhI8-0002HF-BF for qemu-devel@nongnu.org; Mon, 03 May 2021 18:43:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhI6-0007EK-HB for qemu-devel@nongnu.org; Mon, 03 May 2021 18:43:52 -0400 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-387-ARz_xlIpNjyeRVnb5Xmm-w-1; Mon, 03 May 2021 18:43:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E2D51922035 for ; Mon, 3 May 2021 22:43:46 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 680D460C5C; Mon, 3 May 2021 22:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081829; 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=+C14LeSAWSNkxm/A+5bC2ZEsXaXapDFhzDpcd9j4pfw=; b=HsW1tL1VmwVHS0k8/4cOaKu4REjhZY2oJDjAw3/aVJ3Cm6DAE2BxEg9drklBcsKpc4g2z/ jciRjqPR7QrOLckPb/wHui2qiqdKn6ToP3X7EbhTJchM8wUCtVnK2ZHQdYO7QnO9kZtH1q K4RnWaNp1aWMBGRt/5RQvcYmBFm6fP8= X-MC-Unique: ARz_xlIpNjyeRVnb5Xmm-w-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 2/7] tests/acceptance: Move exec_command to ConsoleMixIn Date: Mon, 3 May 2021 19:43:21 -0300 Message-Id: <20210503224326.206208-3-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This moved exec_command() to ConsoleMixIn class. Only the multiprocess.py file were touched by that change, so its tests were adapted. Signed-off-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 22 ++++++++++------------ tests/acceptance/multiprocess.py | 6 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 6f4e0edfa3..4d3b869765 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -114,18 +114,6 @@ 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): """ @@ -145,6 +133,16 @@ def exec_command_and_wait_for_pattern(test, command, class ConsoleMixIn(): """Contains utilities for interacting with a guest via Console.""" =20 + def exec_command(self, command): + """ + Send a command to a console (appending CRLF characters), while log= ging + the content. + + :param command: the command to send + :type command: str + """ + _console_interaction(self, None, None, command + '\r') + def interrupt_interactive_console_until_pattern(self, success_message, failure_message=3DNone, interrupt_string=3D'\r= '): diff --git a/tests/acceptance/multiprocess.py b/tests/acceptance/multiproce= ss.py index 96627f022a..41d3e51164 100644 --- a/tests/acceptance/multiprocess.py +++ b/tests/acceptance/multiprocess.py @@ -9,10 +9,10 @@ =20 from avocado_qemu import Test from avocado_qemu import wait_for_console_pattern -from avocado_qemu import exec_command +from avocado_qemu import ConsoleMixIn from avocado_qemu import exec_command_and_wait_for_pattern =20 -class Multiprocess(Test): +class Multiprocess(Test, ConsoleMixIn): """ :avocado: tags=3Dmultiprocess """ @@ -59,7 +59,7 @@ def do_test(self, kernel_url, initrd_url, kernel_command_= line, self.vm.launch() wait_for_console_pattern(self, 'as init process', 'Kernel panic - not syncing') - exec_command(self, 'mount -t sysfs sysfs /sys') + self.exec_command('mount -t sysfs sysfs /sys') exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/*/ueve= nt', 'PCI_ID=3D1000:0012') --=20 2.29.2 From nobody Wed Apr 24 14:24:50 2024 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=1620084069; cv=none; d=zohomail.com; s=zohoarc; b=a/1N6c0FNECpM6qzb/vsViSC+MZKx44qaw51DYLKW087rTa3/GcsLiz12l+HDPFUzL54iFIryAFsB/fWzoc/zKxDd7ug72VepYSWYVtjt+u+6XQtDTQKGoaV565BgQsU47u9z049dfO/Q0iimJN6j137Z+glH/Q3duadH2MErWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620084069; 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=oHQqw87MkCtXD/OLZu48M60oAB2ElURJbeSvmem+tH8=; b=WyErCaioMmaGne+vUSmeR2CTPqwAPSsBGXQrgzAdYXaqq6w0PrB9TsTDsr2l3i3VXu0nydam9sJBQ+yTYCXT8ZTLSPpzNHmJJaqre70zlbLxlf/qBbaSBJzSOsRWUreSzVlKSdOP9uWfzf4n9ObTuxLa0nUjgnE9/9wUf1A2mGg= 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 1620084069311707.385059539171; Mon, 3 May 2021 16:21:09 -0700 (PDT) Received: from localhost ([::1]:60816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhsC-0002XX-6S for importer@patchew.org; Mon, 03 May 2021 19:21:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhID-0002Rf-40 for qemu-devel@nongnu.org; Mon, 03 May 2021 18:43:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhI9-0007GO-QZ for qemu-devel@nongnu.org; Mon, 03 May 2021 18:43:56 -0400 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-364-diHcQkTVOAiGqkmSlYh8VA-1; Mon, 03 May 2021 18:43:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2971A107ACCD for ; Mon, 3 May 2021 22:43:50 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 041D06060F; Mon, 3 May 2021 22:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081833; 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=oHQqw87MkCtXD/OLZu48M60oAB2ElURJbeSvmem+tH8=; b=hdLf87gIPe3mzk9BzwtCris5Q0wxzqmBAILFw3xhcFtg2n/XgnNPMXR8eqFHvcIM7HNHUt Dgg2qaqdoyM/H3PdDiZIhzJApvMuld1xUqQyMLHYrxD0H0dO6twntYHrUcBvsOFk0OdIy7 J8fVS9T9XG/z6yrV8BUA82m29H7z6ok= X-MC-Unique: diHcQkTVOAiGqkmSlYh8VA-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 3/7] tests/acceptance: Move exec_command_and_wait_for_pattern to ConsoleMixIn Date: Mon, 3 May 2021 19:43:22 -0300 Message-Id: <20210503224326.206208-4-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" It was the time of exec_command_and_wait_for_pattern() to find a new home at ConsoleMixIn. This time various tests needed to be adapted. Signed-off-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 29 +++--- tests/acceptance/boot_linux_console.py | 107 ++++++++++---------- tests/acceptance/machine_rx_gdbsim.py | 8 +- tests/acceptance/machine_s390_ccw_virtio.py | 72 ++++++------- tests/acceptance/multiprocess.py | 3 +- tests/acceptance/virtio-gpu.py | 12 +-- 6 files changed, 111 insertions(+), 120 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 4d3b869765..4a0129c0eb 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -114,22 +114,6 @@ 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_and_wait_for_pattern(test, command, - success_message, failure_message=3DN= one): - """ - Send a command to a console (appending CRLF characters), then wait - for success_message to appear on the console, while logging the. - content. Mark the test as failed if failure_message is found instead. - - :param test: an Avocado test containing a VM that will have its console - read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` - :param command: the command to send - :param success_message: if this message appears, test succeeds - :param failure_message: if this message appears, test fails - """ - _console_interaction(test, success_message, failure_message, command += '\r') - class ConsoleMixIn(): """Contains utilities for interacting with a guest via Console.""" =20 @@ -143,6 +127,19 @@ def exec_command(self, command): """ _console_interaction(self, None, None, command + '\r') =20 + def exec_command_and_wait_for_pattern(self, command, + success_message, failure_message= =3DNone): + """ + Send a command to a console (appending CRLF characters), then wait + for success_message to appear on the console, while logging the. + content. Mark the test as failed if failure_message is found inste= ad. + + :param command: the command to send + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + _console_interaction(self, success_message, failure_message, comma= nd + '\r') + def interrupt_interactive_console_until_pattern(self, success_message, failure_message=3DNone, interrupt_string=3D'\r= '): diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 10317b232b..50e0a3fe79 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -16,7 +16,6 @@ from avocado import skip from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import ConsoleMixIn from avocado_qemu import wait_for_console_pattern from avocado.utils import process @@ -223,12 +222,12 @@ def test_mips_malta_cpio(self): self.vm.launch() self.wait_for_console_pattern('Boot successful.') =20 - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'BogoMIPS') - exec_command_and_wait_for_pattern(self, 'uname -a', - 'Debian') - exec_command_and_wait_for_pattern(self, 'reboot', - 'reboot: Restarting system= ') + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'BogoMIPS') + self.exec_command_and_wait_for_pattern('uname -a', + 'Debian') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') # Wait for VM to shut down gracefully self.vm.wait() =20 @@ -265,12 +264,12 @@ def test_mips64el_malta_5KEc_cpio(self): self.vm.launch() wait_for_console_pattern(self, 'Boot successful.') =20 - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'MIPS 5KE') - exec_command_and_wait_for_pattern(self, 'uname -a', - '3.19.3.mtoman.20150408') - exec_command_and_wait_for_pattern(self, 'reboot', - 'reboot: Restarting system= ') + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'MIPS 5KE') + self.exec_command_and_wait_for_pattern('uname -a', + '3.19.3.mtoman.20150408') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') # Wait for VM to shut down gracefully self.vm.wait() =20 @@ -422,9 +421,9 @@ def test_arm_emcraft_sf2(self): self.vm.launch() self.wait_for_console_pattern('Enter \'help\' for a list') =20 - exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15', - 'eth0: link becomes ready= ') - exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + self.exec_command_and_wait_for_pattern('ifconfig eth0 10.0.2.15', + 'eth0: link becomes ready') + self.exec_command_and_wait_for_pattern('ping -c 3 10.0.2.2', '3 packets transmitted, 3 packets received, 0% packet loss') =20 def do_test_arm_raspi2(self, uart_id): @@ -541,10 +540,10 @@ def test_arm_cubieboard_initrd(self): self.vm.launch() self.wait_for_console_pattern('Boot successful.') =20 - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun4i/sun5i') - exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', - 'system-control@1c00000') + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'Allwinner sun4i/sun5i') + self.exec_command_and_wait_for_pattern('cat /proc/iomem', + 'system-control@1c00000') # cubieboard's reboot is not functioning; omit reboot test. =20 def test_arm_cubieboard_sata(self): @@ -584,10 +583,10 @@ def test_arm_cubieboard_sata(self): self.vm.launch() self.wait_for_console_pattern('Boot successful.') =20 - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun4i/sun5i') - exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', - 'sda') + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'Allwinner sun4i/sun5i') + self.exec_command_and_wait_for_pattern('cat /proc/partitions', + 'sda') # cubieboard's reboot is not functioning; omit reboot test. =20 @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout= ') @@ -628,11 +627,11 @@ def test_arm_quanta_gsj(self): self.wait_for_console_pattern('U-Boot ') self.interrupt_interactive_console_until_pattern( 'Hit any key to stop autoboot:', 'U-Boot>') - exec_command_and_wait_for_pattern( - self, "setenv bootargs ${bootargs} " + kernel_command_line, + self.exec_command_and_wait_for_pattern( + "setenv bootargs ${bootargs} " + kernel_command_line, 'U-Boot>') - exec_command_and_wait_for_pattern( - self, 'run romboot', 'Booting Kernel from flash') + self.exec_command_and_wait_for_pattern( + 'run romboot', 'Booting Kernel from flash') self.wait_for_console_pattern('Booting Linux on physical CPU 0x0') self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0') self.wait_for_console_pattern('OpenBMC Project Reference Distro') @@ -732,12 +731,12 @@ def test_arm_orangepi_initrd(self): self.vm.launch() self.wait_for_console_pattern('Boot successful.') =20 - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun8i Family') - exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', - 'system-control@1c00000') - exec_command_and_wait_for_pattern(self, 'reboot', - 'reboot: Restarting system= ') + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'Allwinner sun8i Family') + self.exec_command_and_wait_for_pattern('cat /proc/iomem', + 'system-control@1c00000') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') # Wait for VM to shut down gracefully self.vm.wait() =20 @@ -777,18 +776,18 @@ def test_arm_orangepi_sd(self): shell_ready =3D "/bin/sh: can't access tty; job control turned off" self.wait_for_console_pattern(shell_ready) =20 - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun8i Family') - exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', - 'mmcblk0') - exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', - 'eth0: Link is Up') - exec_command_and_wait_for_pattern(self, 'udhcpc eth0', + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'Allwinner sun8i Family') + self.exec_command_and_wait_for_pattern('cat /proc/partitions', + 'mmcblk0') + self.exec_command_and_wait_for_pattern('ifconfig eth0 up', + 'eth0: Link is Up') + self.exec_command_and_wait_for_pattern('udhcpc eth0', 'udhcpc: lease of 10.0.2.15 obtained') - exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + self.exec_command_and_wait_for_pattern('ping -c 3 10.0.2.2', '3 packets transmitted, 3 packets received, 0% packet loss') - exec_command_and_wait_for_pattern(self, 'reboot', - 'reboot: Restarting system= ') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') # Wait for VM to shut down gracefully self.vm.wait() =20 @@ -829,10 +828,10 @@ def test_arm_orangepi_bionic_20_08(self): =20 self.wait_for_console_pattern('U-Boot SPL') self.wait_for_console_pattern('Autoboot in ') - exec_command_and_wait_for_pattern(self, ' ', '=3D>') - exec_command_and_wait_for_pattern(self, "setenv extraargs '" + - kernel_command_line + "'",= '=3D>') - exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel .= ..'); + self.exec_command_and_wait_for_pattern(' ', '=3D>') + self.exec_command_and_wait_for_pattern("setenv extraargs '" + + kernel_command_line + "'", = '=3D>') + self.exec_command_and_wait_for_pattern('boot', 'Starting kernel ..= .'); =20 self.wait_for_console_pattern('systemd[1]: Set hostname ' + 'to ') @@ -883,20 +882,20 @@ def test_arm_orangepi_uboot_netbsd9(self): 'Hit any key to stop autoboot:', 'switch to partitions #0, OK') =20 - exec_command_and_wait_for_pattern(self, '', '=3D>') + self.exec_command_and_wait_for_pattern('', '=3D>') cmd =3D 'setenv bootargs root=3Dld0a' - exec_command_and_wait_for_pattern(self, cmd, '=3D>') + self.exec_command_and_wait_for_pattern(cmd, '=3D>') cmd =3D 'setenv kernel netbsd-GENERIC.ub' - exec_command_and_wait_for_pattern(self, cmd, '=3D>') + self.exec_command_and_wait_for_pattern(cmd, '=3D>') cmd =3D 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb' - exec_command_and_wait_for_pattern(self, cmd, '=3D>') + self.exec_command_and_wait_for_pattern(cmd, '=3D>') cmd =3D ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kerne= l}; " "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; " "fdt addr ${fdt_addr_r}; " "bootm ${kernel_addr_r} - ${fdt_addr_r}'") - exec_command_and_wait_for_pattern(self, cmd, '=3D>') + self.exec_command_and_wait_for_pattern(cmd, '=3D>') =20 - exec_command_and_wait_for_pattern(self, 'boot', + self.exec_command_and_wait_for_pattern('boot', 'Booting kernel from Legacy Imag= e') wait_for_console_pattern(self, 'Starting kernel ...') wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)') diff --git a/tests/acceptance/machine_rx_gdbsim.py b/tests/acceptance/machi= ne_rx_gdbsim.py index 32b737b6d8..a893273bad 100644 --- a/tests/acceptance/machine_rx_gdbsim.py +++ b/tests/acceptance/machine_rx_gdbsim.py @@ -12,12 +12,12 @@ =20 from avocado import skipIf from avocado_qemu import Test -from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import ConsoleMixIn from avocado_qemu import wait_for_console_pattern from avocado.utils import archive =20 =20 -class RxGdbSimMachine(Test): +class RxGdbSimMachine(Test, ConsoleMixIn): =20 timeout =3D 30 KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' @@ -44,7 +44,7 @@ def test_uboot(self): wait_for_console_pattern(self, uboot_version) gcc_version =3D 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experi= mental)' # FIXME limit baudrate on chardev, else we type too fast - #exec_command_and_wait_for_pattern(self, 'version', gcc_version) + #self.exec_command_and_wait_for_pattern('version', gcc_version) =20 @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') def test_linux_sash(self): @@ -70,4 +70,4 @@ def test_linux_sash(self): self.vm.launch() wait_for_console_pattern(self, 'Sash command shell (version 1.1.1)= ', failure_message=3D'Kernel panic - not syn= cing') - exec_command_and_wait_for_pattern(self, 'printenv', 'TERM=3Dlinux') + self.exec_command_and_wait_for_pattern('printenv', 'TERM=3Dlinux') diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance= /machine_s390_ccw_virtio.py index 4028c99afc..537393c42f 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -14,11 +14,11 @@ =20 from avocado import skipIf from avocado_qemu import Test -from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import ConsoleMixIn from avocado_qemu import wait_for_console_pattern from avocado.utils import archive =20 -class S390CCWVirtioMachine(Test): +class S390CCWVirtioMachine(Test, ConsoleMixIn): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 timeout =3D 120 @@ -29,13 +29,13 @@ def wait_for_console_pattern(self, success_message, vm= =3DNone): vm=3Dvm) =20 def wait_for_crw_reports(self): - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'while ! (dmesg -c | grep CRW) ; do sleep 1 ; done= ', 'CRW reports') =20 dmesg_clear_count =3D 1 def clear_guest_dmesg(self): - exec_command_and_wait_for_pattern(self, 'dmesg -c > /dev/null; ' + self.exec_command_and_wait_for_pattern('dmesg -c > /dev/null; ' 'echo dm_clear\ ' + str(self.dmesg_clear_count), 'dm_clear ' + str(self.dmesg_clear_count)) self.dmesg_clear_count +=3D 1 @@ -81,13 +81,13 @@ def test_s390x_devices(self): shell_ready =3D "sh: can't access tty; job control turned off" self.wait_for_console_pattern(shell_ready) # first debug shell is too early, we need to wait for device detec= tion - exec_command_and_wait_for_pattern(self, 'exit', shell_ready) + self.exec_command_and_wait_for_pattern('exit', shell_ready) =20 ccw_bus_ids=3D"0.1.1111 0.2.0000 0.3.1234" pci_bus_ids=3D"0005:00:00.0 000a:00:00.0" - exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', + self.exec_command_and_wait_for_pattern('ls /sys/bus/ccw/devices/', ccw_bus_ids) - exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', + self.exec_command_and_wait_for_pattern('ls /sys/bus/pci/devices/', pci_bus_ids) # check that the device at 0.2.0000 is in legacy mode, while the # device at 0.3.1234 has the virtio-1 feature bit set @@ -95,14 +95,14 @@ def test_s390x_devices(self): "10000000000000000000000000000000" virtio_rng_features_legacy=3D"00000000000000000000000000001100" + \ "00000000000000000000000000000000" - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/ccw/devices/0.2.0000/virtio?/feature= s', virtio_rng_features_legacy) - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/feature= s', virtio_rng_features) # check that /dev/hwrng works - and that it's gone after ejecting - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'dd if=3D/dev/hwrng of=3D/dev/null bs=3D1k count= =3D10', '10+0 records out') self.clear_guest_dmesg() @@ -111,22 +111,22 @@ def test_s390x_devices(self): self.clear_guest_dmesg() self.vm.command('device_del', id=3D'rn2') self.wait_for_crw_reports() - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'dd if=3D/dev/hwrng of=3D/dev/null bs=3D1k count= =3D10', 'dd: /dev/hwrng: No such device') # verify that we indeed have virtio-net devices (without having the # virtio-net driver handy) - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/ccw/devices/0.1.1111/cut= ype', '3832/01') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_ven= dor', '0x1af4') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_dev= ice', '0x0001') # check fid propagation - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_= id', '0x0000000c') # add another device @@ -134,7 +134,7 @@ def test_s390x_devices(self): self.vm.command('device_add', driver=3D'virtio-net-ccw', devno=3D'fe.0.4711', id=3D'net_4711') self.wait_for_crw_reports() - exec_command_and_wait_for_pattern(self, 'for i in 1 2 3 4 5 6 7 ; = do ' + self.exec_command_and_wait_for_pattern('for i in 1 2 3 4 5 6 7 ; d= o ' 'if [ -e /sys/bus/ccw/devices/*4711 ]; then break; fi = ;' 'sleep 1 ; done ; ls /sys/bus/ccw/devices/', '0.0.4711') @@ -144,17 +144,17 @@ def test_s390x_devices(self): self.vm.event_wait(name=3D'DEVICE_DELETED', match=3D{'data': {'device': 'net_4711'}}) self.wait_for_crw_reports() - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'ls /sys/bus/ccw/devices/0.0.471= 1', 'No such file or directory') # test the virtio-balloon device - exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo', + self.exec_command_and_wait_for_pattern('head -n 1 /proc/meminfo', 'MemTotal: 115640 kB') self.vm.command('human-monitor-command', command_line=3D'balloon 9= 6') - exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo', + self.exec_command_and_wait_for_pattern('head -n 1 /proc/meminfo', 'MemTotal: 82872 kB') self.vm.command('human-monitor-command', command_line=3D'balloon 1= 28') - exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo', + self.exec_command_and_wait_for_pattern('head -n 1 /proc/meminfo', 'MemTotal: 115640 kB') =20 =20 @@ -203,23 +203,23 @@ def test_s390x_fedora(self): =20 # Some tests to see whether the CLI options have been considered: self.log.info("Test whether QEMU CLI options have been considered") - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'while ! (dmesg | grep enP7p0s0) ; do sleep 1 ; do= ne', 'virtio_net virtio0 enP7p0s0: renamed') - exec_command_and_wait_for_pattern(self, 'lspci', + self.exec_command_and_wait_for_pattern('lspci', '0007:00:00.0 Class 0200: Device 1af4:1000') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/class/net/enP7p0s0/address', '02:ca:fe:fa:ce:12') - exec_command_and_wait_for_pattern(self, 'lscss', '0.1.9876') - exec_command_and_wait_for_pattern(self, 'lscss', '0.2.5432') - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + self.exec_command_and_wait_for_pattern('lscss', '0.1.9876') + self.exec_command_and_wait_for_pattern('lscss', '0.2.5432') + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', 'processors : 4') - exec_command_and_wait_for_pattern(self, 'grep MemTotal /proc/memin= fo', + self.exec_command_and_wait_for_pattern('grep MemTotal /proc/meminf= o', 'MemTotal: 499848 kB') - exec_command_and_wait_for_pattern(self, 'grep Name /proc/sysinfo', + self.exec_command_and_wait_for_pattern('grep Name /proc/sysinfo', 'Extended Name: Some Guest Name') - exec_command_and_wait_for_pattern(self, 'grep UUID /proc/sysinfo', + self.exec_command_and_wait_for_pattern('grep UUID /proc/sysinfo', '30de4fd9-b4d5-409e-86a5-09b387f70bfa') =20 # Disable blinking cursor, then write some stuff into the framebuf= fer. @@ -229,16 +229,16 @@ def test_s390x_fedora(self): # can simply read the written "magic bytes" back from the PPM file= to # check whether the framebuffer is working as expected. self.log.info("Test screendump of virtio-gpu device") - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'while ! (dmesg | grep gpudrmfb) ; do sleep 1 ; do= ne', 'virtio_gpudrmfb frame buffer device') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'echo -e "\e[?25l" > /dev/tty0', ':/#') - exec_command_and_wait_for_pattern(self, 'for ((i=3D0;i<250;i++)); = do ' + self.exec_command_and_wait_for_pattern('for ((i=3D0;i<250;i++)); d= o ' 'echo " The qu ick fo x j ump s o ver a laz y d og" >> fox= .txt;' 'done', ':/#') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'dd if=3Dfox.txt of=3D/dev/fb0 bs=3D1000 oflag=3Dsync,nocache = ; rm fox.txt', '12+0 records out') with tempfile.NamedTemporaryFile(suffix=3D'.ppm', @@ -261,12 +261,12 @@ def test_s390x_fedora(self): id=3D'cbe0') self.vm.command('device_add', driver=3D'virtio-crypto-ccw', id=3D'= crypdev0', cryptodev=3D'cbe0', devno=3D'fe.0.2342') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'while ! (dmesg -c | grep Accelerator.device) ; do' ' sleep 1 ; done', 'Accelerator device is ready') - exec_command_and_wait_for_pattern(self, 'lscss', '0.0.2342') + self.exec_command_and_wait_for_pattern('lscss', '0.0.2342') self.vm.command('device_del', id=3D'crypdev0') self.vm.command('object-del', id=3D'cbe0') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'while ! (dmesg -c | grep Start.virtcrypto_remove)= ; do' ' sleep 1 ; done', 'Start virtcrypto_remove.') diff --git a/tests/acceptance/multiprocess.py b/tests/acceptance/multiproce= ss.py index 41d3e51164..b4a6d20770 100644 --- a/tests/acceptance/multiprocess.py +++ b/tests/acceptance/multiprocess.py @@ -10,7 +10,6 @@ from avocado_qemu import Test from avocado_qemu import wait_for_console_pattern from avocado_qemu import ConsoleMixIn -from avocado_qemu import exec_command_and_wait_for_pattern =20 class Multiprocess(Test, ConsoleMixIn): """ @@ -60,7 +59,7 @@ def do_test(self, kernel_url, initrd_url, kernel_command_= line, wait_for_console_pattern(self, 'as init process', 'Kernel panic - not syncing') self.exec_command('mount -t sysfs sysfs /sys') - exec_command_and_wait_for_pattern(self, + self.exec_command_and_wait_for_pattern( 'cat /sys/bus/pci/devices/*/ueve= nt', 'PCI_ID=3D1000:0012') =20 diff --git a/tests/acceptance/virtio-gpu.py b/tests/acceptance/virtio-gpu.py index ab18cddbb7..4d65431ef1 100644 --- a/tests/acceptance/virtio-gpu.py +++ b/tests/acceptance/virtio-gpu.py @@ -7,7 +7,7 @@ from avocado_qemu import Test from avocado_qemu import BUILD_DIR from avocado_qemu import wait_for_console_pattern -from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import ConsoleMixIn from avocado_qemu import is_readable_executable_file =20 from qemu.accel import kvm_available @@ -31,7 +31,7 @@ def pick_default_vug_bin(): return bld_dir_path =20 =20 -class VirtioGPUx86(Test): +class VirtioGPUx86(Test, ConsoleMixIn): """ :avocado: tags=3Dvirtio-gpu """ @@ -92,9 +92,7 @@ def test_virtio_vga_virgl(self): self.cancel("VirGL not enabled?") =20 self.wait_for_console_pattern("as init process") - exec_command_and_wait_for_pattern( - self, "/usr/sbin/modprobe virtio_gpu", "" - ) + self.exec_command_and_wait_for_pattern("/usr/sbin/modprobe virtio_= gpu", "") self.wait_for_console_pattern("features: +virgl +edid") =20 def test_vhost_user_vga_virgl(self): @@ -157,9 +155,7 @@ def test_vhost_user_vga_virgl(self): ) self.vm.launch() self.wait_for_console_pattern("as init process") - exec_command_and_wait_for_pattern( - self, "/usr/sbin/modprobe virtio_gpu", "" - ) + self.exec_command_and_wait_for_pattern("/usr/sbin/modprobe virtio_= gpu", "") self.wait_for_console_pattern("features: +virgl -edid") self.vm.shutdown() qemu_sock.close() --=20 2.29.2 From nobody Wed Apr 24 14:24:50 2024 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=1620082191; cv=none; d=zohomail.com; s=zohoarc; b=EkittCTM2nqAXNJ0Cys8zNNGttCTRAyj4t/9G94ED1zrxklKFXdMt6wq4pSkT2Mv30TZq6IViq4KMoKtZtJK5j8wUt11E+oWXOt6zZ4nHtw5jyTD/hGJLHoqGlOxJL8iVdDG0n4xGBstp5toSdSrG5Oxc3sISq5A+atV2KIGGrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620082191; 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=KBxptsirqWb42qHL38h+a1bt+GldxVZqVHh2gUbIJ8Y=; b=VuDhhJ6ZJcmz5Xs6u5ZGCKNKuB50ifX/KYxXfXgKgw35dKs/MmKGonCPtt11wzmKY0XOzjB2+XcSOoJvgMDSj8+YFXA/wgE2xf6BNhSYmkG1kQLs16e3atI3I0cz8UBm+Y6L7SDgYecS87fQNQ2VRDYLoqIp+ymIFFYPcIRRTqs= 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 1620082191815963.8349552240504; Mon, 3 May 2021 15:49:51 -0700 (PDT) Received: from localhost ([::1]:53690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhNu-0000bq-QR for importer@patchew.org; Mon, 03 May 2021 18:49:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIQ-0002Zd-1Y for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIG-0007K3-Ma for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:09 -0400 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-126-kxiLUSQ1PAmh6tTiFPvzNw-1; Mon, 03 May 2021 18:43:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB01C107ACCA for ; Mon, 3 May 2021 22:43:56 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B17E60937; Mon, 3 May 2021 22:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081839; 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=KBxptsirqWb42qHL38h+a1bt+GldxVZqVHh2gUbIJ8Y=; b=hUKXp0FM3tIfqGHKzTyy90dWXVliOKap+v25LK4ZPQ2Y1hP0KwoEOKe5cdxH3L5/AfQxA4 R0/r+vr2cKWCL5lWueasxRmGwZePoAEXeKmzqFyz9u9HW6N9j2ioS7dX4J99H0kJAPMbro pu2d+vP24EY1dCV8X87Nn6mm4+MJYW8= X-MC-Unique: kxiLUSQ1PAmh6tTiFPvzNw-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 4/7] tests/acceptance: Sun4uMachine: Remove dependency to LinuxKernelTest Date: Mon, 3 May 2021 19:43:23 -0300 Message-Id: <20210503224326.206208-5-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The Sun4uMachine class inherit from LinuxKernelTest to effectively only use the KERNEL_COMMON_COMMAND_LINE attribute. This change remove that unneeded dependency, making Sun4uMachine self-content. I took the occasion to delint the code: the unused os import was removed, imports were reordered, and the module has a docstring now. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo --- tests/acceptance/machine_sparc64_sun4u.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/machine_sparc64_sun4u.py b/tests/acceptance/m= achine_sparc64_sun4u.py index 458165500e..c7ad474bdc 100644 --- a/tests/acceptance/machine_sparc64_sun4u.py +++ b/tests/acceptance/machine_sparc64_sun4u.py @@ -1,4 +1,4 @@ -# Functional test that boots a Linux kernel and checks the console +"""Functional test that boots a Linux kernel and checks the console""" # # Copyright (c) 2020 Red Hat, Inc. # @@ -8,16 +8,15 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -import os - -from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -from boot_linux_console import LinuxKernelTest +from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern =20 -class Sun4uMachine(LinuxKernelTest): +class Sun4uMachine(Test): """Boots the Linux kernel and checks that the console is operational""" =20 timeout =3D 90 + KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 def test_sparc64_sun4u(self): """ --=20 2.29.2 From nobody Wed Apr 24 14:24:50 2024 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=1620083265; cv=none; d=zohomail.com; s=zohoarc; b=ZK7eQ2M9u2DZ5mWXsb9jj689OsW9PiDlzBkYoHpEiZrgeZDM90gA61oWkXWigctvKMbWxHP0sn3/GsCWSW3mT1c3NYbuctoa+Y/sH6syP09iWyzdgiJFIRHvKckOsr9WOofEelnTyFvJUDJVXtoKfuwuFd0sndqpI+Bu5OlCJ28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620083265; 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=aYCiztV39YHwEV3sqrXCCHIgKfbUf8r53FvbNUnCnCI=; b=Cq1DEED27uU+veL+0+RVkFkSJh9Q7mtWd1yvr851vubJJudK/QYO8yy2RiINbtxgW1/SeYVLOQYyIyHeMUbcpQjMXPluXmH5htGPLUBycNGiXsHMBHNzhw6JXBbERjIduQJnj5nHQ7SG0Gak0hlRx9+BIGbV9kfFbCgXSp6sxMw= 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 1620083265234124.47821548478043; Mon, 3 May 2021 16:07:45 -0700 (PDT) Received: from localhost ([::1]:41202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhfD-0002Kj-UJ for importer@patchew.org; Mon, 03 May 2021 19:07:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIR-0002Zg-6N for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54211) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIK-0007L3-Jk for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:10 -0400 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-46-9gt7kKS8MGuQqMGXbFmXWA-1; Mon, 03 May 2021 18:44:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B60F5107ACCA for ; Mon, 3 May 2021 22:44:00 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4FFC60C5C; Mon, 3 May 2021 22:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081843; 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=aYCiztV39YHwEV3sqrXCCHIgKfbUf8r53FvbNUnCnCI=; b=hAqCRXwxZZqPVkg7o3W7Q4HYssI7E+k0n/S9dQrePjJ1w5Vk4JklV0Q2eVEXmVfZlIEVsn VZMzyyDTXUeZfHPHhNSZY2StXyx0d+0PKFXIBjGOp9JhyiwJfUJuAS8S3sLrD3MLUHRr8l hEP5wD7TrUZpVvhx0V13Ti1XBxPhmHA= X-MC-Unique: 9gt7kKS8MGuQqMGXbFmXWA-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 5/7] tests/acceptance: replay_kernel: Remove unused wait_for_console_pattern Date: Mon, 3 May 2021 19:43:24 -0300 Message-Id: <20210503224326.206208-6-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The ReplayKernelBase class uses the wait_for_console_pattern from its parent LinuxKernelTest class, thus it doesn't need to import that method from avocado_qemu. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo --- tests/acceptance/replay_kernel.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_ke= rnel.py index 71facdaa75..6d4e202723 100644 --- a/tests/acceptance/replay_kernel.py +++ b/tests/acceptance/replay_kernel.py @@ -17,7 +17,6 @@ from avocado import skip from avocado import skipIf from avocado import skipUnless -from avocado_qemu import wait_for_console_pattern from avocado.utils import archive from avocado.utils import process from boot_linux_console import LinuxKernelTest --=20 2.29.2 From nobody Wed Apr 24 14:24:50 2024 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=1620084342; cv=none; d=zohomail.com; s=zohoarc; b=Hj7TEj2QJ4fuBOaVzVoZ28rSZyu0EIT9GWqITKkQFpzV6CwCcYTlwIa+ipnCsa9yFjBkFskTCNCMdLUDELf3NJ1sXpWlR7I3pfdSnvj0Q6arZBteKM4d9ScRJgdU0jfFUM2HN1DdD4vuWlgrnACV+u5ZXNW4EhtIRAjKt6bU420= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620084342; 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=KMtJt5XBtvo1jrR71Hr9QYznAUGCS99ndKySs7xNSUs=; b=cXNYpiHijB1n/mTJmt+qZt95wfrn250N2YkDne/ZeMcg/hBqSt4oujx3flmXcKWIAWoJzAhIzezfH0+QTa0MaFaWmumF+I7jnM1mxZlXy808yyjRrOXxv1H+fy8BSWTuwZAvQJKwjmwLISViPlJ8E1Fo/qTE3sn5WpNjOVAJRuk= 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 1620084342906807.5841174001898; Mon, 3 May 2021 16:25:42 -0700 (PDT) Received: from localhost ([::1]:38846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhwb-0005FI-LX for importer@patchew.org; Mon, 03 May 2021 19:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIb-0002l8-Ma for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIY-0007OR-32 for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:21 -0400 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-531-lHHRBrMZPo-b1q6r0h-Lwg-1; Mon, 03 May 2021 18:44:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6ECE48189C4 for ; Mon, 3 May 2021 22:44:06 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6EB36060F; Mon, 3 May 2021 22:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081856; 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=KMtJt5XBtvo1jrR71Hr9QYznAUGCS99ndKySs7xNSUs=; b=D9ugGKYp1i9RnW4AKaM89xjbNdbDMXe2sYOijIhXWwLxyOv5zABhYN3iWv+vONSIEZ86MA /dUe6vekg2brOeOQmu5bzdvFY9bZBcIKxo4xTSJT/w8ldU2Su7gZWL9epNRhY+LC/fOD2I kQ7wS0fp3p+W7tOfqJkIdPL3jzuOnLQ= X-MC-Unique: lHHRBrMZPo-b1q6r0h-Lwg-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 6/7] tests/acceptance: Move wait_for_console_pattern to ConsoleMixIn Date: Mon, 3 May 2021 19:43:25 -0300 Message-Id: <20210503224326.206208-7-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This moved wait_for_console_pattern() to ConsoleMixIn. By far this change required the most adaptations on tests. Notice that: 1) Some tests from boot_linux_console.py were using the wait_for_console_p= attern() from the avocado_qemu package rather than the overloaded method on the LinuxKernelTest class, and that explains the explict calls to ConsoleMixIn.wait_for_console_pattern(). Likewise in boot_xen.py file. 2) In virtiofs_submounts.py, wait_for_console_pattern() was imported but n= ot used. Signed-off-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 23 +++++++++----------- tests/acceptance/boot_linux_console.py | 14 ++++++------ tests/acceptance/boot_xen.py | 5 +++-- tests/acceptance/linux_ssh_mips_malta.py | 8 +++---- tests/acceptance/machine_arm_canona1100.py | 6 ++--- tests/acceptance/machine_arm_integratorcp.py | 8 +++---- tests/acceptance/machine_arm_n8x0.py | 6 ++--- tests/acceptance/machine_microblaze.py | 8 +++---- tests/acceptance/machine_mips_loongson3v.py | 6 ++--- tests/acceptance/machine_mips_malta.py | 6 ++--- tests/acceptance/machine_ppc.py | 10 ++++----- tests/acceptance/machine_rx_gdbsim.py | 7 +++--- tests/acceptance/machine_s390_ccw_virtio.py | 7 +++--- tests/acceptance/machine_sparc64_sun4u.py | 6 ++--- tests/acceptance/machine_sparc_leon3.py | 8 +++---- tests/acceptance/multiprocess.py | 5 ++--- tests/acceptance/ppc_prep_40p.py | 16 +++++++------- tests/acceptance/virtio-gpu.py | 4 +--- tests/acceptance/virtiofs_submounts.py | 1 - 19 files changed, 73 insertions(+), 81 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 4a0129c0eb..b21f9ea3ff 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -101,19 +101,6 @@ def _console_interaction(test, success_message, failur= e_message, (failure_message, success_message) test.fail(fail) =20 -def wait_for_console_pattern(test, success_message, failure_message=3DNone, - vm=3DNone): - """ - Waits for messages to appear on the console, while logging the content - - :param test: an Avocado test containing a VM that will have its console - read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` - :param success_message: if this message appears, test succeeds - :param failure_message: if this message appears, test fails - """ - _console_interaction(test, success_message, failure_message, None, vm= =3Dvm) - class ConsoleMixIn(): """Contains utilities for interacting with a guest via Console.""" =20 @@ -163,6 +150,16 @@ def interrupt_interactive_console_until_pattern(self, = success_message, _console_interaction(self, success_message, failure_message, interrupt_string, True) =20 + def wait_for_console_pattern(self, success_message, failure_message=3D= None, + vm=3DNone): + """ + Waits for messages to appear on the console, while logging the con= tent + + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + _console_interaction(self, success_message, failure_message, None,= vm=3Dvm) + class Test(avocado.Test): def _get_unique_tag_val(self, tag_name): """ diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 50e0a3fe79..e8d7a127fe 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -17,7 +17,6 @@ from avocado import skipUnless from avocado_qemu import Test from avocado_qemu import ConsoleMixIn -from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive from avocado.utils.path import find_command, CmdNotFoundError @@ -48,7 +47,7 @@ class LinuxKernelTest(Test, ConsoleMixIn): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 def wait_for_console_pattern(self, success_message, vm=3DNone): - wait_for_console_pattern(self, success_message, + super().wait_for_console_pattern(success_message, failure_message=3D'Kernel panic - not syn= cing', vm=3Dvm) =20 @@ -262,7 +261,7 @@ def test_mips64el_malta_5KEc_cpio(self): '-append', kernel_command_line, '-no-reboot') self.vm.launch() - wait_for_console_pattern(self, 'Boot successful.') + ConsoleMixIn.wait_for_console_pattern(self, 'Boot successful.') =20 self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', 'MIPS 5KE') @@ -877,7 +876,7 @@ def test_arm_orangepi_uboot_netbsd9(self): '-global', 'allwinner-rtc.base-year=3D2000', '-no-reboot') self.vm.launch() - wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1') + ConsoleMixIn.wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1= ') self.interrupt_interactive_console_until_pattern( 'Hit any key to stop autoboot:', 'switch to partitions #0, OK') @@ -897,10 +896,11 @@ def test_arm_orangepi_uboot_netbsd9(self): =20 self.exec_command_and_wait_for_pattern('boot', 'Booting kernel from Legacy Imag= e') - wait_for_console_pattern(self, 'Starting kernel ...') - wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)') + ConsoleMixIn.wait_for_console_pattern(self, 'Starting kernel ...') + ConsoleMixIn.wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)') # Wait for user-space - wait_for_console_pattern(self, 'Starting root file system check') + ConsoleMixIn.wait_for_console_pattern(self, + 'Starting root file system che= ck') =20 def test_aarch64_raspi3_atf(self): """ diff --git a/tests/acceptance/boot_xen.py b/tests/acceptance/boot_xen.py index 75c2d44492..9b5506398e 100644 --- a/tests/acceptance/boot_xen.py +++ b/tests/acceptance/boot_xen.py @@ -14,7 +14,6 @@ import os =20 from avocado import skipIf -from avocado_qemu import wait_for_console_pattern from boot_linux_console import LinuxKernelTest =20 =20 @@ -59,7 +58,9 @@ def launch_xen(self, xen_path): self.vm.launch() =20 console_pattern =3D 'VFS: Cannot open root device' - wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:") + # pylint: disable=3DE1003 + super(LinuxKernelTest, self).wait_for_console_pattern(console_patt= ern, + "Panic on CPU 0:") =20 =20 class BootXen(BootXenBase): diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/li= nux_ssh_mips_malta.py index 6dbd02d49d..8d8531b6c5 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -13,13 +13,13 @@ =20 from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn from avocado.utils import process from avocado.utils import archive from avocado.utils import ssh =20 =20 -class LinuxSSH(Test): +class LinuxSSH(Test, ConsoleMixIn): =20 timeout =3D 150 # Not for 'configure --enable-debug --enable-debug-tcg' =20 @@ -126,7 +126,7 @@ def boot_debian_wheezy_image_and_ssh_login(self, endian= ess, kernel_path): =20 self.log.info('VM launched, waiting for sshd') console_pattern =3D 'Starting OpenBSD Secure Shell server: sshd' - wait_for_console_pattern(self, console_pattern, 'Oops') + self.wait_for_console_pattern(console_pattern, 'Oops') self.log.info('sshd ready') =20 self.ssh_connect('root', 'root') @@ -134,7 +134,7 @@ def boot_debian_wheezy_image_and_ssh_login(self, endian= ess, kernel_path): def shutdown_via_ssh(self): self.ssh_command('poweroff') self.ssh_disconnect_vm() - wait_for_console_pattern(self, 'Power down', 'Oops') + self.wait_for_console_pattern('Power down', 'Oops') =20 def ssh_command_output_contains(self, cmd, exp): stdout, _ =3D self.ssh_command(cmd) diff --git a/tests/acceptance/machine_arm_canona1100.py b/tests/acceptance/= machine_arm_canona1100.py index 0e5c43dbcf..945aa83270 100644 --- a/tests/acceptance/machine_arm_canona1100.py +++ b/tests/acceptance/machine_arm_canona1100.py @@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. =20 from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn from avocado.utils import archive =20 -class CanonA1100Machine(Test): +class CanonA1100Machine(Test, ConsoleMixIn): """Boots the barebox firmware and checks that the console is operation= al""" =20 timeout =3D 90 @@ -32,4 +32,4 @@ def test_arm_canona1100(self): self.vm.add_args('-bios', self.workdir + '/day18/barebox.canon-a1100.bin') self.vm.launch() - wait_for_console_pattern(self, 'running /env/bin/init') + self.wait_for_console_pattern('running /env/bin/init') diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptanc= e/machine_arm_integratorcp.py index 49c8ebff78..490bafa571 100644 --- a/tests/acceptance/machine_arm_integratorcp.py +++ b/tests/acceptance/machine_arm_integratorcp.py @@ -13,7 +13,7 @@ =20 from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn =20 =20 NUMPY_AVAILABLE =3D True @@ -29,7 +29,7 @@ CV2_AVAILABLE =3D False =20 =20 -class IntegratorMachine(Test): +class IntegratorMachine(Test, ConsoleMixIn): =20 timeout =3D 90 =20 @@ -59,7 +59,7 @@ def test_integratorcp_console(self): :avocado: tags=3Ddevice:pl011 """ self.boot_integratorcp() - wait_for_console_pattern(self, 'Log in as root') + self.wait_for_console_pattern('Log in as root') =20 @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') @@ -80,7 +80,7 @@ def test_framebuffer_tux_logo(self): =20 self.boot_integratorcp() framebuffer_ready =3D 'Console: switching to colour frame buffer d= evice' - wait_for_console_pattern(self, framebuffer_ready) + self.wait_for_console_pattern(framebuffer_ready) self.vm.command('human-monitor-command', command_line=3D'stop') self.vm.command('human-monitor-command', command_line=3D'screendump %s' % screendump_path) diff --git a/tests/acceptance/machine_arm_n8x0.py b/tests/acceptance/machin= e_arm_n8x0.py index e5741f2d8d..403415243e 100644 --- a/tests/acceptance/machine_arm_n8x0.py +++ b/tests/acceptance/machine_arm_n8x0.py @@ -12,9 +12,9 @@ =20 from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn =20 -class N8x0Machine(Test): +class N8x0Machine(Test, ConsoleMixIn): """Boots the Linux kernel and checks that the console is operational""" =20 timeout =3D 90 @@ -30,7 +30,7 @@ def __do_test_n8x0(self): self.vm.add_args('-kernel', kernel_path, '-append', 'printk.time=3D0 console=3DttyS1') self.vm.launch() - wait_for_console_pattern(self, 'TSC2005 driver initializing') + self.wait_for_console_pattern('TSC2005 driver initializing') =20 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') def test_n800(self): diff --git a/tests/acceptance/machine_microblaze.py b/tests/acceptance/mach= ine_microblaze.py index 7f6d18495d..d6ecd69e95 100644 --- a/tests/acceptance/machine_microblaze.py +++ b/tests/acceptance/machine_microblaze.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. =20 from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn from avocado.utils import archive =20 -class MicroblazeMachine(Test): +class MicroblazeMachine(Test, ConsoleMixIn): =20 timeout =3D 90 =20 @@ -27,8 +27,8 @@ def test_microblaze_s3adsp1800(self): self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/day17/ballerina.bin') self.vm.launch() - wait_for_console_pattern(self, 'This architecture does not have ' - 'kernel memory protection') + self.wait_for_console_pattern('This architecture does not have ' + 'kernel memory protection') # Note: # The kernel sometimes gets stuck after the "This architecture ..." # message, that's why we don't test for a later string here. This diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance= /machine_mips_loongson3v.py index 85b131a40f..58242d5c9b 100644 --- a/tests/acceptance/machine_mips_loongson3v.py +++ b/tests/acceptance/machine_mips_loongson3v.py @@ -12,9 +12,9 @@ =20 from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn =20 -class MipsLoongson3v(Test): +class MipsLoongson3v(Test, ConsoleMixIn): timeout =3D 60 =20 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') @@ -36,4 +36,4 @@ def test_pmon_serial_console(self): self.vm.set_console() self.vm.add_args('-bios', pmon_path) self.vm.launch() - wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:') + self.wait_for_console_pattern('CPU GODSON3 BogoMIPS:') diff --git a/tests/acceptance/machine_mips_malta.py b/tests/acceptance/mach= ine_mips_malta.py index 7c9a4ee4d2..e05fa862cc 100644 --- a/tests/acceptance/machine_mips_malta.py +++ b/tests/acceptance/machine_mips_malta.py @@ -13,7 +13,7 @@ =20 from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn from avocado.utils import archive from avocado import skipIf =20 @@ -33,7 +33,7 @@ =20 @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') -class MaltaMachineFramebuffer(Test): +class MaltaMachineFramebuffer(Test, ConsoleMixIn): =20 timeout =3D 30 =20 @@ -68,7 +68,7 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_count): '-append', kernel_command_line) self.vm.launch() framebuffer_ready =3D 'Console: switching to colour frame buffer d= evice' - wait_for_console_pattern(self, framebuffer_ready, + self.wait_for_console_pattern(framebuffer_ready, failure_message=3D'Kernel panic - not syn= cing') self.vm.command('human-monitor-command', command_line=3D'stop') self.vm.command('human-monitor-command', diff --git a/tests/acceptance/machine_ppc.py b/tests/acceptance/machine_ppc= .py index a836e2496f..61f378a3a2 100644 --- a/tests/acceptance/machine_ppc.py +++ b/tests/acceptance/machine_ppc.py @@ -7,9 +7,9 @@ =20 from avocado.utils import archive from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn =20 -class PpcMachine(Test): +class PpcMachine(Test, ConsoleMixIn): =20 timeout =3D 90 KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' @@ -32,7 +32,7 @@ def test_ppc64_pseries(self): '-append', kernel_command_line) self.vm.launch() console_pattern =3D 'Kernel command line: %s' % kernel_command_line - wait_for_console_pattern(self, console_pattern, self.panic_message) + self.wait_for_console_pattern(console_pattern, self.panic_message) =20 def test_ppc_mpc8544ds(self): """ @@ -47,7 +47,7 @@ def test_ppc_mpc8544ds(self): self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/creek/creek.bin') self.vm.launch() - wait_for_console_pattern(self, 'QEMU advent calendar 2020', + self.wait_for_console_pattern('QEMU advent calendar 2020', self.panic_message) =20 def test_ppc_virtex_ml507(self): @@ -65,5 +65,5 @@ def test_ppc_virtex_ml507(self): '-dtb', self.workdir + '/hippo/virtex440-ml507.dt= b', '-m', '512') self.vm.launch() - wait_for_console_pattern(self, 'QEMU advent calendar 2020', + self.wait_for_console_pattern('QEMU advent calendar 2020', self.panic_message) diff --git a/tests/acceptance/machine_rx_gdbsim.py b/tests/acceptance/machi= ne_rx_gdbsim.py index a893273bad..7a77cfe116 100644 --- a/tests/acceptance/machine_rx_gdbsim.py +++ b/tests/acceptance/machine_rx_gdbsim.py @@ -13,7 +13,6 @@ from avocado import skipIf from avocado_qemu import Test from avocado_qemu import ConsoleMixIn -from avocado_qemu import wait_for_console_pattern from avocado.utils import archive =20 =20 @@ -41,7 +40,7 @@ def test_uboot(self): '-no-reboot') self.vm.launch() uboot_version =3D 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' - wait_for_console_pattern(self, uboot_version) + self.wait_for_console_pattern(uboot_version) gcc_version =3D 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experi= mental)' # FIXME limit baudrate on chardev, else we type too fast #self.exec_command_and_wait_for_pattern('version', gcc_version) @@ -68,6 +67,6 @@ def test_linux_sash(self): '-dtb', dtb_path, '-no-reboot') self.vm.launch() - wait_for_console_pattern(self, 'Sash command shell (version 1.1.1)= ', - failure_message=3D'Kernel panic - not syn= cing') + self.wait_for_console_pattern('Sash command shell (version 1.1.1)', + failure_message=3D'Kernel panic - no= t syncing') self.exec_command_and_wait_for_pattern('printenv', 'TERM=3Dlinux') diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance= /machine_s390_ccw_virtio.py index 537393c42f..bc1606ae43 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -15,7 +15,6 @@ from avocado import skipIf from avocado_qemu import Test from avocado_qemu import ConsoleMixIn -from avocado_qemu import wait_for_console_pattern from avocado.utils import archive =20 class S390CCWVirtioMachine(Test, ConsoleMixIn): @@ -24,9 +23,9 @@ class S390CCWVirtioMachine(Test, ConsoleMixIn): timeout =3D 120 =20 def wait_for_console_pattern(self, success_message, vm=3DNone): - wait_for_console_pattern(self, success_message, - failure_message=3D'Kernel panic - not syn= cing', - vm=3Dvm) + super().wait_for_console_pattern(success_message, + failure_message=3D'Kernel panic - n= ot syncing', + vm=3Dvm) =20 def wait_for_crw_reports(self): self.exec_command_and_wait_for_pattern( diff --git a/tests/acceptance/machine_sparc64_sun4u.py b/tests/acceptance/m= achine_sparc64_sun4u.py index c7ad474bdc..810f11b049 100644 --- a/tests/acceptance/machine_sparc64_sun4u.py +++ b/tests/acceptance/machine_sparc64_sun4u.py @@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. =20 from avocado.utils import archive +from avocado_qemu import ConsoleMixIn from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern =20 -class Sun4uMachine(Test): +class Sun4uMachine(Test, ConsoleMixIn): """Boots the Linux kernel and checks that the console is operational""" =20 timeout =3D 90 @@ -32,4 +32,4 @@ def test_sparc64_sun4u(self): self.vm.add_args('-kernel', self.workdir + '/day23/vmlinux', '-append', self.KERNEL_COMMON_COMMAND_LINE) self.vm.launch() - wait_for_console_pattern(self, 'Starting logging: OK') + self.wait_for_console_pattern('Starting logging: OK') diff --git a/tests/acceptance/machine_sparc_leon3.py b/tests/acceptance/mac= hine_sparc_leon3.py index 2405cd7a0d..1bf7812987 100644 --- a/tests/acceptance/machine_sparc_leon3.py +++ b/tests/acceptance/machine_sparc_leon3.py @@ -6,11 +6,11 @@ # later. See the COPYING file in the top-level directory. =20 from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn from avocado import skip =20 =20 -class Leon3Machine(Test): +class Leon3Machine(Test, ConsoleMixIn): =20 timeout =3D 60 =20 @@ -33,5 +33,5 @@ def test_leon3_helenos_uimage(self): =20 self.vm.launch() =20 - wait_for_console_pattern(self, 'Copyright (c) 2001-2014 HelenOS pr= oject') - wait_for_console_pattern(self, 'Booting the kernel ...') + self.wait_for_console_pattern('Copyright (c) 2001-2014 HelenOS pro= ject') + self.wait_for_console_pattern('Booting the kernel ...') diff --git a/tests/acceptance/multiprocess.py b/tests/acceptance/multiproce= ss.py index b4a6d20770..9f487fb7bc 100644 --- a/tests/acceptance/multiprocess.py +++ b/tests/acceptance/multiprocess.py @@ -8,7 +8,6 @@ import socket =20 from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern from avocado_qemu import ConsoleMixIn =20 class Multiprocess(Test, ConsoleMixIn): @@ -56,8 +55,8 @@ def do_test(self, kernel_url, initrd_url, kernel_command_= line, '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') + self.wait_for_console_pattern('as init process', + 'Kernel panic - not syncing') self.exec_command('mount -t sysfs sysfs /sys') self.exec_command_and_wait_for_pattern( 'cat /sys/bus/pci/devices/*/ueve= nt', diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_4= 0p.py index 96ba13b894..35475892be 100644 --- a/tests/acceptance/ppc_prep_40p.py +++ b/tests/acceptance/ppc_prep_40p.py @@ -10,10 +10,10 @@ from avocado import skipIf from avocado import skipUnless from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern +from avocado_qemu import ConsoleMixIn =20 =20 -class IbmPrep40pMachine(Test): +class IbmPrep40pMachine(Test, ConsoleMixIn): =20 timeout =3D 60 =20 @@ -44,8 +44,8 @@ def test_factory_firmware_and_netbsd(self): '-fda', drive_path) self.vm.launch() os_banner =3D 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 20= 07' - wait_for_console_pattern(self, os_banner) - wait_for_console_pattern(self, 'Model: IBM PPS Model 6015') + self.wait_for_console_pattern(os_banner) + self.wait_for_console_pattern('Model: IBM PPS Model 6015') =20 def test_openbios_192m(self): """ @@ -56,9 +56,9 @@ def test_openbios_192m(self): self.vm.add_args('-m', '192') # test fw_cfg =20 self.vm.launch() - wait_for_console_pattern(self, '>> OpenBIOS') - wait_for_console_pattern(self, '>> Memory: 192M') - wait_for_console_pattern(self, '>> CPU type PowerPC,604') + self.wait_for_console_pattern('>> OpenBIOS') + self.wait_for_console_pattern('>> Memory: 192M') + self.wait_for_console_pattern('>> CPU type PowerPC,604') =20 def test_openbios_and_netbsd(self): """ @@ -75,4 +75,4 @@ def test_openbios_and_netbsd(self): '-boot', 'd') =20 self.vm.launch() - wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') + self.wait_for_console_pattern('NetBSD/prep BOOT, Revision 1.9') diff --git a/tests/acceptance/virtio-gpu.py b/tests/acceptance/virtio-gpu.py index 4d65431ef1..a7e6bbb8a2 100644 --- a/tests/acceptance/virtio-gpu.py +++ b/tests/acceptance/virtio-gpu.py @@ -6,7 +6,6 @@ =20 from avocado_qemu import Test from avocado_qemu import BUILD_DIR -from avocado_qemu import wait_for_console_pattern from avocado_qemu import ConsoleMixIn from avocado_qemu import is_readable_executable_file =20 @@ -49,8 +48,7 @@ class VirtioGPUx86(Test, ConsoleMixIn): ) =20 def wait_for_console_pattern(self, success_message, vm=3DNone): - wait_for_console_pattern( - self, + super().wait_for_console_pattern( success_message, failure_message=3D"Kernel panic - not syncing", vm=3Dvm, diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virt= iofs_submounts.py index 46fa65392a..ad1999a372 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -6,7 +6,6 @@ =20 from avocado import skipUnless from avocado_qemu import LinuxTest, BUILD_DIR -from avocado_qemu import wait_for_console_pattern from avocado.utils import ssh =20 =20 --=20 2.29.2 From nobody Wed Apr 24 14:24:50 2024 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=1620084184; cv=none; d=zohomail.com; s=zohoarc; b=h+J0wkuInvwVFca5xBhhFk8DCpXLGI9J47p3j+dK/FMo+x8Y/ffRW7OdHWvixYiNKoadr/9XVyeQ1CGr+phXwex4B5gppUOeaqXGmwAD1hdbP4pYWr9QRzeT/W4221PJ0keu/zyAWWPVoSZjQpjXogWmFL7tvJMhytS1gVenSaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620084184; 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=oWmBDj0X7pqBTNb7vLvWwbmx9NBQbuoI3GJsk/rhxT8=; b=iJqxa4eM/B0ogsvhQvv9z1bmdqaaFl+YIo9X4M8gXGP4J4dogQ5Z/E8solW7lVcgUH/DaQPzCmK5eu/C7dgZPL3gnp+Or7FWqUKM3oEmpj2aCUUQGO4o36pHy6n83Bw3I8Wc65W4HUGiOgm/ulDcEmamaNYh2wqunV17wein16E= 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 1620084184770176.21276138588007; Mon, 3 May 2021 16:23:04 -0700 (PDT) Received: from localhost ([::1]:34716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhu3-0003Sg-Ou for importer@patchew.org; Mon, 03 May 2021 19:23:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIY-0002d4-Dg for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhIU-0007O9-4L for qemu-devel@nongnu.org; Mon, 03 May 2021 18:44:18 -0400 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-474-RCOZiWqxOKeOGkL-mWRlPA-1; Mon, 03 May 2021 18:44:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E88731804968 for ; Mon, 3 May 2021 22:44:10 +0000 (UTC) Received: from wainer-laptop.localdomain.com (ovpn-116-131.gru2.redhat.com [10.97.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7ABC560937; Mon, 3 May 2021 22:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620081853; 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=oWmBDj0X7pqBTNb7vLvWwbmx9NBQbuoI3GJsk/rhxT8=; b=RLgTV94KqtkpXTsqR35ZJoU/vsg+cM9sXNssalbdrsBdgyXdBTYl5WUU9hDiN6yHmf2dg3 Ok9jdScliniGHEbtJrLNLXf0QzyuiZH0I85NqmGwI4nm1PtVYl+VBvK4yVJLSf/abrWqGS MDaXONrskDsHvTS0mTzJV3+PwZp3ieU= X-MC-Unique: RCOZiWqxOKeOGkL-mWRlPA-1 From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Subject: [PATCH 7/7] tests/acceptance: Move _console_interaction to ConsoleMixIn Date: Mon, 3 May 2021 19:43:26 -0300 Message-Id: <20210503224326.206208-8-wainersm@redhat.com> In-Reply-To: <20210503224326.206208-1-wainersm@redhat.com> References: <20210503224326.206208-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=wainersm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=wainersm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, 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: willianr@redhat.com, philmd@redhat.com, crosa@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This moved the last remaining _console_interaction() to ConsoleMixIn. None tests call it directly, so only the other methods in ConsoleMixIn needed to be adapted. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo --- tests/acceptance/avocado_qemu/__init__.py | 57 +++++++++++------------ 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index b21f9ea3ff..a6de3fe11a 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -76,34 +76,33 @@ def pick_default_qemu_bin(arch=3DNone): if is_readable_executable_file(qemu_bin_from_bld_dir_path): return qemu_bin_from_bld_dir_path =20 - -def _console_interaction(test, success_message, failure_message, - send_string, keep_sending=3DFalse, vm=3DNone): - assert not keep_sending or send_string - if vm is None: - vm =3D test.vm - console =3D vm.console_socket.makefile() - console_logger =3D logging.getLogger('console') - while True: - if send_string: - vm.console_socket.sendall(send_string.encode()) - if not keep_sending: - send_string =3D None # send only once - msg =3D console.readline().strip() - if not msg: - continue - console_logger.debug(msg) - if success_message is None or success_message in msg: - break - if failure_message and failure_message in msg: - console.close() - fail =3D 'Failure message found in console: "%s". Expected: "%= s"' % \ - (failure_message, success_message) - test.fail(fail) - class ConsoleMixIn(): """Contains utilities for interacting with a guest via Console.""" =20 + def _console_interaction(self, success_message, failure_message, + send_string, keep_sending=3DFalse, vm=3DNone): + assert not keep_sending or send_string + if vm is None: + vm =3D self.vm + console =3D vm.console_socket.makefile() + console_logger =3D logging.getLogger('console') + while True: + if send_string: + vm.console_socket.sendall(send_string.encode()) + if not keep_sending: + send_string =3D None # send only once + msg =3D console.readline().strip() + if not msg: + continue + console_logger.debug(msg) + if success_message is None or success_message in msg: + break + if failure_message and failure_message in msg: + console.close() + fail =3D 'Failure message found in console: "%s". Expected= : "%s"' % \ + (failure_message, success_message) + self.fail(fail) + def exec_command(self, command): """ Send a command to a console (appending CRLF characters), while log= ging @@ -112,7 +111,7 @@ def exec_command(self, command): :param command: the command to send :type command: str """ - _console_interaction(self, None, None, command + '\r') + self._console_interaction(None, None, command + '\r') =20 def exec_command_and_wait_for_pattern(self, command, success_message, failure_message= =3DNone): @@ -125,7 +124,7 @@ def exec_command_and_wait_for_pattern(self, command, :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ - _console_interaction(self, success_message, failure_message, comma= nd + '\r') + self._console_interaction(success_message, failure_message, comman= d + '\r') =20 def interrupt_interactive_console_until_pattern(self, success_message, failure_message=3DNone, @@ -147,7 +146,7 @@ def interrupt_interactive_console_until_pattern(self, s= uccess_message, :param interrupt_string: a string to send to the console before tr= ying to read a new line """ - _console_interaction(self, success_message, failure_message, + self._console_interaction(success_message, failure_message, interrupt_string, True) =20 def wait_for_console_pattern(self, success_message, failure_message=3D= None, @@ -158,7 +157,7 @@ def wait_for_console_pattern(self, success_message, fai= lure_message=3DNone, :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ - _console_interaction(self, success_message, failure_message, None,= vm=3Dvm) + self._console_interaction(success_message, failure_message, None, = vm=3Dvm) =20 class Test(avocado.Test): def _get_unique_tag_val(self, tag_name): --=20 2.29.2