From patchwork Tue Jun 18 18:02:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 1118267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Swv62G2Hz9sDX for ; Wed, 19 Jun 2019 04:04:02 +1000 (AEST) Received: from localhost ([::1]:60820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdISd-0007Lq-9W for incoming@patchwork.ozlabs.org; Tue, 18 Jun 2019 14:03:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50938) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdIR4-0007Fs-Mj for qemu-devel@nongnu.org; Tue, 18 Jun 2019 14:02:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdIR3-0003dp-28 for qemu-devel@nongnu.org; Tue, 18 Jun 2019 14:02:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdIR2-0003cl-LV for qemu-devel@nongnu.org; Tue, 18 Jun 2019 14:02:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9F4C23E6E7; Tue, 18 Jun 2019 18:02:19 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A1495E7C6; Tue, 18 Jun 2019 18:02:16 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org, Peter Maydell Date: Tue, 18 Jun 2019 14:02:15 -0400 Message-Id: <20190618180215.25896-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 18 Jun 2019 18:02:19 +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] Acceptance tests: workaround for serial devices / console socket issue 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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)