From patchwork Thu Jun 6 21:14:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10980539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A824924 for ; Thu, 6 Jun 2019 22:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECD591FFE4 for ; Thu, 6 Jun 2019 22:29:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF0A527EE2; Thu, 6 Jun 2019 22:29:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.47]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D62A51FFE4 for ; Thu, 6 Jun 2019 22:29:41 +0000 (UTC) Received: from localhost ([::1]:42842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZ00G-0001iQ-Fh for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Jun 2019 17:32:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51595) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hYzu5-0005bg-GE for qemu-devel@nongnu.org; Thu, 06 Jun 2019 17:26:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYziZ-00087g-Ic for qemu-devel@nongnu.org; Thu, 06 Jun 2019 17:14:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54712) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYziZ-00086W-AC for qemu-devel@nongnu.org; Thu, 06 Jun 2019 17:14:39 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF9F1330247; Thu, 6 Jun 2019 21:14:31 +0000 (UTC) Received: from dhcp-17-47.bos.redhat.com (dhcp-17-47.bos.redhat.com [10.18.17.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBB9610ABD9F; Thu, 6 Jun 2019 21:14:30 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 6 Jun 2019 17:14:14 -0400 Message-Id: <20190606211414.8681-8-crosa@redhat.com> In-Reply-To: <20190606211414.8681-1-crosa@redhat.com> References: <20190606211414.8681-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 06 Jun 2019 21:14:31 +0000 (UTC) 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] [PATCH v6 7/7] [RFC]: use Avocado data drainer for console logging 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: Fam Zheng , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?utf-8?q?Alex_Benn=C3=A9e?= , Samuel Ortiz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This depends on a proposed feature to Avocado, a new module that "drains" data and processes it. In this case, a drainer for the console socket file descriptor is used, and the data is sent to the "console" logger. This allows for a much better feedback of the test process, showing boot data from the guest as it happens, without obstructing the test code path. Signed-off-by: Cleber Rosa --- tests/acceptance/boot_linux.py | 14 +++++++++++--- tests/requirements.txt | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py index 9b54a0241f..f3507f519e 100644 --- a/tests/acceptance/boot_linux.py +++ b/tests/acceptance/boot_linux.py @@ -15,6 +15,7 @@ from avocado_qemu import Test, SRC_ROOT_DIR from avocado.utils import cloudinit from avocado.utils import network from avocado.utils import vmimage +from avocado.utils import datadrainer class BootLinux(Test): @@ -55,6 +56,13 @@ class BootLinux(Test): phone_home_port=self.phone_home_port) self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) + def launch(self): + self.vm.set_console() + self.vm.launch() + console_drainer = datadrainer.LineLogger(self.vm.console_socket.fileno(), + logger=self.log.getChild('console')) + console_drainer.start() + def wait_for_boot_confirmation(self): self.log.info('VM launched, waiting for boot confirmation from guest') cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), self.name) @@ -70,7 +78,7 @@ class BootLinuxX8664(BootLinux): :avocado: tags=machine:pc """ self.vm.set_machine('pc') - self.vm.launch() + self.launch() self.wait_for_boot_confirmation() def test_q35(self): @@ -79,7 +87,7 @@ class BootLinuxX8664(BootLinux): :avocado: tags=machine:q35 """ self.vm.set_machine('q35') - self.vm.launch() + self.launch() self.wait_for_boot_confirmation() @@ -99,5 +107,5 @@ class BootLinuxAarch64(BootLinux): 'edk2-aarch64-code.fd')) self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0') self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom') - self.vm.launch() + self.launch() self.wait_for_boot_confirmation() diff --git a/tests/requirements.txt b/tests/requirements.txt index 9d2c79b146..28eaf7b61e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ # Add Python module requirements, one per line, to be installed # in the tests/venv Python virtual environment. For more info, # refer to: https://pip.pypa.io/en/stable/user_guide/#id1 -avocado-framework==68.0 +-e git+https://github.com/clebergnu/avocado@datadrainer#egg=avocado_framework paramiko pycdlib==1.6.0