From nobody Mon Feb 9 07:55:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=1556844581; cv=none; d=zoho.com; s=zohoarc; b=DYasz48jIspurB6N5G1k3QEuaAJG4VJIRVqOuBxpQAetGTi4PhJU/lIelZiRJTp2xf1bHN3C4xYCYUH9qtFFToycE4uQpMyeegbv/Ut2vEShA22OIjmpDvZv1ZA/Jlu96I6RjEClkKOOdDP1kock2m7GR3COrcv1TTWy839McK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556844581; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=EL7YCdmDBindu6bdlUOK3mXKffdX5Q8+VRN3ZesINIU=; b=e9fAFqO0kcYeWzyVSoXZeOTWFLg3lTyg4zJ0JCpLL/b2TRErXG1YNRV+NtnPPlTB9TlFUufpDLtwJFQMQ3q7WFpzSvizDAoxvQKKz2hArm4OgGLlVlHLPRmf2TVdoBe/uuEsuySnd4iMcw5XVhEFFKS30SlfObdvVzONXRpxZLI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1556844581890329.84377533613304; Thu, 2 May 2019 17:49:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:60539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMMON-0001Zb-Ox for importer@patchew.org; Thu, 02 May 2019 20:49:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMMHH-0003z2-Q0 for qemu-devel@nongnu.org; Thu, 02 May 2019 20:42:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMMHF-0006wh-2D for qemu-devel@nongnu.org; Thu, 02 May 2019 20:42:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37662) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hMMHE-0006wU-Tr for qemu-devel@nongnu.org; Thu, 02 May 2019 20:42:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0854A3082AF4; Fri, 3 May 2019 00:42:12 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id F380E60BF7; Fri, 3 May 2019 00:42:08 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org, Cleber Rosa Date: Thu, 2 May 2019 21:41:22 -0300 Message-Id: <20190503004130.8285-12-ehabkost@redhat.com> In-Reply-To: <20190503004130.8285-1-ehabkost@redhat.com> References: <20190503004130.8285-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 03 May 2019 00:42:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/19] tests/boot_linux_console: refactor the console watcher into utility method X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Cleber Rosa This introduces a utility method that monitors the console device and looks for either a message that signals the test success or failure. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-12-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index bfcae3771b..32f1d4d0bf 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -23,6 +23,25 @@ class BootLinuxConsole(Test): =20 KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 + def wait_for_console_pattern(self, success_message, + failure_message=3D'Kernel panic - not syn= cing'): + """ + 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 =3D self.vm.console_socket.makefile() + console_logger =3D logging.getLogger('console') + while True: + msg =3D console.readline() + console_logger.debug(msg.strip()) + if success_message in msg: + break + if failure_message in msg: + fail =3D 'Failure message found in console: %s' % failure_= message + self.fail(fail) + def test_x86_64_pc(self): """ :avocado: tags=3Darch:x86_64 @@ -39,12 +58,5 @@ class BootLinuxConsole(Test): self.vm.add_args('-kernel', kernel_path, '-append', kernel_command_line) self.vm.launch() - console =3D self.vm.console_socket.makefile() - console_logger =3D logging.getLogger('console') - while True: - msg =3D console.readline() - console_logger.debug(msg.strip()) - if 'Kernel command line: %s' % kernel_command_line in msg: - break - if 'Kernel panic - not syncing' in msg: - self.fail("Kernel panic reached") + console_pattern =3D 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) --=20 2.18.0.rc1.1.g3f1ff2140