Acceptance tests: workaround for serial devices / console socket issue
diff mbox series

Message ID
State New
Headers show
  • Acceptance tests: workaround for serial devices / console socket issue
Related show

Commit Message

Cleber Rosa June 18, 2019, 6:02 p.m. UTC
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:

Signed-off-by: Cleber Rosa <>
 tests/acceptance/ | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff mbox series

diff --git a/tests/acceptance/ b/tests/acceptance/
index 32159503e9..ae31d914a8 100644
--- a/tests/acceptance/
+++ b/tests/acceptance/
@@ -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):
             if success_message in msg:
+                if close:
+                    self.vm.console_socket.close()
             if failure_message in msg:
+                if close:
+                    self.vm.console_socket.close()
                 fail = 'Failure message found in console: %s' % failure_message
-    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.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,
-        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)
-                                               '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)