qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: [Qemu-devel] [PATCH] Acceptance tests: workaround for serial devices / console socket issue
Date: Tue, 18 Jun 2019 14:02:15 -0400	[thread overview]
Message-ID: <20190618180215.25896-1-crosa@redhat.com> (raw)

We're seeing constant failures on aarch64 and arm targets on CI
on tests that have a kernel writing to a serial device used as console,
and a socket file connected to it.

After investigation, it was noticed that when interacting with some
devices, by means of the sockets around serial devices used as
console, QEMU may block an entire thread (see 6ab3fc32e).

This attempts to work around the behavior of those devices, by
closing the socket file connected to the chardev given to the
serial device.

Related to bug: https://bugs.launchpad.net/qemu/+bug/1829779

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 32159503e9..ae31d914a8 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -30,12 +30,15 @@ class BootLinuxConsole(Test):
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
 
     def wait_for_console_pattern(self, success_message,
-                                 failure_message='Kernel panic - not syncing'):
+                                 failure_message='Kernel panic - not syncing',
+                                 close=True):
         """
         Waits for messages to appear on the console, while logging the content
 
         :param success_message: if this message appears, test succeeds
         :param failure_message: if this message appears, test fails
+        :param close: close the socket file once the a final (success or
+                      failure) message is found
         """
         console = self.vm.console_socket.makefile()
         console_logger = logging.getLogger('console')
@@ -45,15 +48,20 @@ class BootLinuxConsole(Test):
                 continue
             console_logger.debug(msg)
             if success_message in msg:
+                if close:
+                    self.vm.console_socket.close()
                 break
             if failure_message in msg:
+                if close:
+                    self.vm.console_socket.close()
                 fail = 'Failure message found in console: %s' % failure_message
                 self.fail(fail)
 
-    def exec_command_and_wait_for_pattern(self, command, success_message):
+    def exec_command_and_wait_for_pattern(self, command, success_message,
+                                          close):
         command += '\n'
         self.vm.console_socket.sendall(command.encode())
-        self.wait_for_console_pattern(success_message)
+        self.wait_for_console_pattern(success_message, close=close)
 
     def extract_from_deb(self, deb, path):
         """
@@ -180,14 +188,15 @@ class BootLinuxConsole(Test):
                          '-append', kernel_command_line,
                          '-no-reboot')
         self.vm.launch()
-        self.wait_for_console_pattern('Boot successful.')
+        self.wait_for_console_pattern('Boot successful.', close=False)
 
         self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo',
-                                               'BogoMIPS')
+                                               'BogoMIPS', close=False)
         self.exec_command_and_wait_for_pattern('uname -a',
-                                               'Debian')
+                                               'Debian', close=False)
         self.exec_command_and_wait_for_pattern('reboot',
-                                               'reboot: Restarting system')
+                                               'reboot: Restarting system',
+                                               close=True)
 
     def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
         kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-- 
2.21.0



                 reply	other threads:[~2019-06-18 18:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190618180215.25896-1-crosa@redhat.com \
    --to=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).