From patchwork Tue Apr 21 18:34:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2228 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796547; bh=lz3W7MCZuUSCQG8pt5r1HfafPjr/7OO2me/zmpUYdno=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KDX/2kxhx09SdZlky1u9gRp6SQgFBkLUIKJFYcw+3aqxT9zu6q5+puLDFUAj7x8ty T0GOan7qN1kTgXTWMnSEai/p+/fsPN5z3Bm9Nhlfj8AZx8ifyNuTrsn4qEBRFS/EEh LHAirUhc1jgRC21sbDBZTWE4vXT/3fUNAn5fXKbg= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5D0F96A608 for ; Tue, 21 Apr 2026 12:35:47 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id K7ihO3agkhHX for ; Tue, 21 Apr 2026 12:35:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796547; bh=lz3W7MCZuUSCQG8pt5r1HfafPjr/7OO2me/zmpUYdno=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KDX/2kxhx09SdZlky1u9gRp6SQgFBkLUIKJFYcw+3aqxT9zu6q5+puLDFUAj7x8ty T0GOan7qN1kTgXTWMnSEai/p+/fsPN5z3Bm9Nhlfj8AZx8ifyNuTrsn4qEBRFS/EEh LHAirUhc1jgRC21sbDBZTWE4vXT/3fUNAn5fXKbg= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 45F4B6A528 for ; Tue, 21 Apr 2026 12:35:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796544; bh=sdsa7EYJYMTs7Egikmf0L8kSNuSgbbfzpElnApgCs70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtQtro/x1lCYGvITe+iyiTIuiAfmjzv8XDY9qkPLqHohUaj9nWSdOnaH0Ive7uOZd Rn2GB4qQqt+gUVj9pBpNCK4glv3NVQK1mVbBG93xln/SpMFim4TVKCHAllwE/x7vb/ A3OqJwlvIGLSV8xbecuLvMMPoroQG8aR3x35NLY4= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A64B76A604; Tue, 21 Apr 2026 12:35:44 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id QPLUHweXDjOU; Tue, 21 Apr 2026 12:35:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796543; bh=KrOHRHPlwjaWGnVnR1ywtvwQEw0ODalog/Y2FZB4yNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DK0qmOZZsCnCpOWhieAFCbdx7kYxGH8dPYFBA8S2goMmZY2JBKg/EtHSpDyAbTq71 xCaK7G9KfH6UxOYxP+5ZvwniFK/UFFw6jGvYjUP9m3ErQSDCHncNoCpxGC89nLfcli YTor9yIwJUsUM0BHoR9Y/mQ2eWnkhGQ42jwiCfD0= Received: from u-boot.org (unknown [174.51.25.52]) by mail.u-boot.org (Postfix) with ESMTPSA id E87F36A60D; Tue, 21 Apr 2026 12:35:42 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 21 Apr 2026 12:34:42 -0600 Message-ID: <20260421183511.2044469-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260421183511.2044469-1-sjg@u-boot.org> References: <20260421183511.2044469-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BKBSD6ZJXR2TLFPXM7JLNQSGBAXOWPVL X-Message-ID-Hash: BKBSD6ZJXR2TLFPXM7JLNQSGBAXOWPVL X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/16] test: py: Always consume {lab ready} marker in lab mode List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass _wait_for_boot_prompt() loops on either '=>' or on the labgrid '{lab ready in s: }' marker, breaking on whichever arrives first. In lab mode U-Boot prints '=>' before labgrid emits the marker, so the plain prompt wins the race and the marker stays in the receive buffer. The marker has the U-Boot banner embedded in it, so the very next command run in the test scans forward, trips the main_signon bad-pattern inside the marker and aborts with: Failed to get echo on console (cmd 'boot':rem ''): main_signon In lab mode, only wait for the '{lab ready...}' marker (plus the autoboot prompt so we can interrupt it). Drop the raw '=>' match from that path so the marker and its embedded banner are always consumed before the test runs its first command. The non-lab flow is unchanged. Signed-off-by: Simon Glass --- test/py/console_base.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test/py/console_base.py b/test/py/console_base.py index 7f044b587b6..1afeee50c81 100644 --- a/test/py/console_base.py +++ b/test/py/console_base.py @@ -331,25 +331,38 @@ class ConsoleBase(): if not self.lab_mode: self._wait_for_banner(loop_num) self.u_boot_version_string = self.after + # In lab mode the '{lab ready in s: }' marker is + # the authoritative ready signal and must be consumed so + # the embedded banner does not trip the signon bad-pattern + # when the next command runs. Skip the plain '=>' prompt + # match in that case. + if self.lab_mode: + wait_patterns = [pattern_ready_prompt, + pattern_stop_autoboot_prompt] + else: + wait_patterns = [self.prompt_compiled, pattern_ready_prompt, + pattern_stop_autoboot_prompt] + ready_idx = wait_patterns.index(pattern_ready_prompt) + autoboot_idx = wait_patterns.index(pattern_stop_autoboot_prompt) + base = len(wait_patterns) while True: - m = self.expect([self.prompt_compiled, pattern_ready_prompt, - pattern_stop_autoboot_prompt] + self.bad_patterns) - if m == 0: + m = self.expect(wait_patterns + self.bad_patterns) + if not self.lab_mode and m == 0: self.log.info(f'Found ready prompt {m}') break - if m == 1: + if m == ready_idx: m = pattern_ready_prompt.search(self.after) self.u_boot_version_string = m.group(2) self.log.info('Lab: Board is ready') self.timeout = self.get_default_timeout() break - if m == 2: + if m == autoboot_idx: self.log.info(f'Found autoboot prompt {m}') self.p.send(' ') continue if not self.lab_mode: raise BootFail('Missing prompt / ready message on console: ' + - self.bad_pattern_ids[m - 3]) + self.bad_pattern_ids[m - base]) self.log.info('U-Boot is ready') finally: