From patchwork Mon Aug 19 22:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 820291 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c8:0:b0:367:895a:4699 with SMTP id m8csp1653604wrb; Mon, 19 Aug 2024 15:54:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVl2zNm1GVN/3itkBuWQ1kIxypwrfM3ZVHC+x1oec3ezCxR6LOmV3ZnzaR8gVNREnz5G1CVIA==@linaro.org X-Google-Smtp-Source: AGHT+IGG9ezoL+hJG9RmPV8iLmJSC5eu8RgiZB//880wJNUudhmCIbSzWcFS1N/AqpDZdqE3bbJB X-Received: by 2002:a05:620a:4010:b0:7a1:e4bf:276 with SMTP id af79cd13be357-7a6695ac6a0mr63642985a.20.1724108089671; Mon, 19 Aug 2024 15:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724108089; cv=none; d=google.com; s=arc-20160816; b=IqhW6jGABlzoJKQSGFdyKkNYIHB1XSlNau5jpnoju7q5MaMLDCFTC4dahRfGOYdYyw hCTzY5vQdgdDSwvvIoN5WMil8RTfpAe+429/xVO23Tu9BIBsSx76UQB3qX2YrfNelHUE t++eEeK80hT7pr2ATh5xycs51RggEpWkJsiNuQ2mnmfvWCjEF3d0RpZJZNLsnZldYC/i +6hpvo26mUPEmEweysAEeVTBoHcJ3+q+uZ+h+dbp66i7O052DGQ/UWEIpKqrvt7ETwWf nx6xv8gqbNxl7b3/R+EKkxTNiLga7JNi8f238v6HuejfY2t/QT6Tf7/juUKeayCaOtCB CXmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i525VHbDEEdaYNDK1SbTy9eAffjoVCoTHAg3yOkOeL4=; fh=PX7yrrOrQfXD9ZvKQmdhoalGl4f2XKZ1HIsuPPnm7lU=; b=CXM7vWfhRdweL3vKxjEy58QRHhRrzZfHdZTX2FHZDy8sGE+VQykgMu5VuSFL0X6kkt dlfzW36rZAwg25bZvH0JmEDHZr2dft0ArLZKCvSlFXmhOnPt9wPRTKiC1rqI1GTlEdAG LumnAXwANEYOgQ0eVUrQ7QBIxn8+HlvjO+62Gk/0oC7ex/BT5Btf1AXGHptF5egCSv13 MoSlCzsIr6+F0cWnEf5LjMZq5dZSQbn3w7ZlPHp1lx/m0/m8ROuNZJEZ/TFmLRbMgVzV 84cNOcTWqY5z+E49we/GaSio3XQ1HLPoaA8xB8HoK8jiYAQoV8dKEZLo0HMcEwy7SG+M hPYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCbxlXOc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a4feffe37csi1132429185a.51.2024.08.19.15.54.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2024 15:54:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCbxlXOc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgBG7-00078d-Ko; Mon, 19 Aug 2024 18:53:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgBEd-00013p-0Q for qemu-devel@nongnu.org; Mon, 19 Aug 2024 18:52:25 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgBEb-0000kR-Ct for qemu-devel@nongnu.org; Mon, 19 Aug 2024 18:52:22 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3718706cf8aso3057250f8f.3 for ; Mon, 19 Aug 2024 15:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724107940; x=1724712740; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i525VHbDEEdaYNDK1SbTy9eAffjoVCoTHAg3yOkOeL4=; b=YCbxlXOcQw/1wfI80a4tUMlaW6O/Ls60Tspa/tcTA3iyMCyKIzdFGO27njlsjeM3Bs ouwNO03szdjhn1KD4eRxpWSxgmuYn5txOeziivBVJCzWRMaJDIvkO9cbIHy3fgTjtkgY xBUR+EuGzX8kJF/LOAaMUKFoRT35k/3H/iQHT+3qMfGveiw7pKmyMgNy7Rtq8kUDHkPy hcsBcH9cm/BT4XHFHsQHDhXy8w+DJVy55KsHxNl+UfwE8szbBjyfZ1XQfYDkiKnIxzE+ JsFjOeOBXHAaMaAXVtG0md3glm+R1lt3sj8Gu0txXrFcBAyrJJS+PnoPhCzFYlhzsFYu 2BIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724107940; x=1724712740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i525VHbDEEdaYNDK1SbTy9eAffjoVCoTHAg3yOkOeL4=; b=oiSxYU42J+WwZHkkZ1NMKDqQeHvdn0p2U6qjr5f0muT/xQvaxh0GKsHlj3/owBKXM1 +CjQyBk+ZBDRxlr+ewKJxUtK7NMsBFAQO0YMywnV0nppzOhQp36gUb8BZG9raoNkVQmu BVbjzb74lWOn+VKc+n26JPEV+lNkV1UB6Wd5DNrIa2IsWsU2RdZDMVokxBBMo+Ugvz7w G3KJMevpqGWDrcJJbhMCLj0KqOrmf49Xc9uLtlm+68FZ8DWYAVftQJNEHSO+HhtepmQp W8sRLjlod5EhtOQ0U8z4AdXLrHlY+T0HgyfVcnvWHxo7pdZWY2VddnYZ2Ql3kn53EoJ5 elRw== X-Gm-Message-State: AOJu0YwEkmNQifVOtuswNAVhC15gyEFZOTfXCzETQ3YjLKH0r8xIJLzd UQFbIHYBfMliK4lAyzV0FpUFZcHnDAIVVKNz78xYayoPeBDyUFmLtRV65TUhG4XiKqhSJ7WH0tm nozg= X-Received: by 2002:adf:b307:0:b0:368:4edc:611e with SMTP id ffacd0b85a97d-37194344041mr7950257f8f.14.1724107939545; Mon, 19 Aug 2024 15:52:19 -0700 (PDT) Received: from localhost.localdomain (88-178-97-237.subs.proxad.net. [88.178.97.237]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded367ebsm179600455e9.25.2024.08.19.15.52.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Aug 2024 15:52:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 13/20] tests/avocado: exec_command should not consume console output Date: Tue, 20 Aug 2024 00:51:09 +0200 Message-ID: <20240819225116.17928-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240819225116.17928-1-philmd@linaro.org> References: <20240819225116.17928-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Nicholas Piggin _console_interaction reads data from the console even when there is only an input string to send, and no output data to wait on. This can cause lines to be missed by wait_for_console_pattern calls that follows an exec_command. Fix this by not reading the console if there is no pattern to wait for. This solves occasional hangs in ppc_hv_tests.py, usually when run on KVM hosts that are fast enough to output important lines quickly enough to be consumed by exec_command, so they get missed by subsequent wait for pattern calls. Signed-off-by: Nicholas Piggin Reviewed-by: Thomas Huth Message-ID: <20240805232814.267843-2-npiggin@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/avocado/avocado_qemu/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py index a3da2a96bb..ef935614cf 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -135,6 +135,13 @@ def _console_interaction(test, success_message, failure_message, vm.console_socket.sendall(send_string.encode()) if not keep_sending: send_string = None # send only once + + # Only consume console output if waiting for something + if success_message is None and failure_message is None: + if send_string is None: + break + continue + try: msg = console.readline().decode().strip() except UnicodeDecodeError: