qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Samuel Ortiz" <sameo@linux.intel.com>
Subject: [Qemu-devel] [PATCH v6 7/7] [RFC]: use Avocado data drainer for console logging
Date: Thu,  6 Jun 2019 17:14:14 -0400	[thread overview]
Message-ID: <20190606211414.8681-8-crosa@redhat.com> (raw)
In-Reply-To: <20190606211414.8681-1-crosa@redhat.com>

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 <crosa@redhat.com>
---
 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
 
-- 
2.21.0



  parent reply	other threads:[~2019-06-06 22:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 21:14 [Qemu-devel] [PATCH v6 0/7] Add "boot_linux" acceptance test Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 1/7] Acceptance tests: use relative location for tests Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 2/7] Acceptance tests: keep a stable reference to the QEMU build dir Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 3/7] Acceptance tests: add the build directory to the system PATH Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 4/7] Acceptance tests: depend on qemu-img Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 5/7] Add "boot_linux" test for x86_64 and pc and q35 machine types Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 6/7] Add "boot_linux" test for aarch64 and virt machine type Cleber Rosa
2019-06-06 21:14 ` Cleber Rosa [this message]
2019-06-06 23:03 ` [Qemu-devel] [PATCH v6 0/7] Add "boot_linux" acceptance test no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190606211414.8681-8-crosa@redhat.com \
    --to=crosa@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sameo@linux.intel.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).