From patchwork Fri Sep 20 06:01:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987639 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=UEFG6wnn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X91z01xpzz1xrD for ; Fri, 20 Sep 2024 16:03:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 17ACF89324; Fri, 20 Sep 2024 08:03:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UEFG6wnn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED7A18933B; Fri, 20 Sep 2024 08:03:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 246B289329 for ; Fri, 20 Sep 2024 08:03:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a83562f9be9so179430766b.0 for ; Thu, 19 Sep 2024 23:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812179; x=1727416979; darn=lists.denx.de; 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=zG2iEQpT6qRzY/eWfMN81JYERjsM+naVtqrVB1W68p0=; b=UEFG6wnnzw2Uryeo2M9Upg/tTB03PzcgCLxwySkeagYcMllNx81JL/9iU5zRqP5U/R cQ+2UuYuU7XOsquDb6OxlxjDoJodpi1TNJmEKEaZBWSjQ7+76x9y6gDW42boR2BTdsal CZcGnUK2MEcub/cyZRb6AFgzXA/6PdceqBhfU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812179; x=1727416979; 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=zG2iEQpT6qRzY/eWfMN81JYERjsM+naVtqrVB1W68p0=; b=DuAmgZvyXKR08EcqWL8VfKufqM4Sq9OB2i7zk9g5NzAn6ZwkZvO/ZufToQjYz3/TK4 ognTCPc5zDugFV196AOBTsi84JBNIKsuNiAAIGfAwMcZxgeLJzGaqUA4tc/2gCPCITaV 3WZcnOPzmleV7ZIOoGAgvcwOC/1+P9J87jPMAuCmAqIYi7Vphbl5F5gt6ZGlEGmqUMp0 cs/XE0oPu4wDTCfMDbt9qqh2V4mPsVIXpNYp1PuulKFPDxggk3qasUDAdtxBZOWYr07s q44+jCv7MivpbDuH8aUeGpgRCPJCSvh7lMlFQyxzPlYd+ksjhVNSyx+8vaHjTQ7zfbW+ 8Utg== X-Gm-Message-State: AOJu0Yy8BY58Q8AfhTsmgVmKQQKfHOFSw9vy8oRrWstuCDmO3g2q5nDH qJPOE0Tde9I/QcOFAPuyqMi07TuNgRh0r0tOQ9u5TnqbvFG5Jzya0IMXGixuXQquk4S/Hw5htnW LNKPV X-Google-Smtp-Source: AGHT+IGV+q3UXNxuWgOxaKyCWioEDKYx7E5DdVYFxwGxUquZ5jtLsst8TdxUXAijJ35sj13nHAMBaA== X-Received: by 2002:a17:907:c7de:b0:a7a:9447:3e8c with SMTP id a640c23a62f3a-a90d4fcc366mr114975166b.3.1726812178942; Thu, 19 Sep 2024 23:02:58 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:02:58 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 01/19] test: Allow signaling that U-Boot is ready Date: Fri, 20 Sep 2024 08:01:36 +0200 Message-ID: <20240920060158.106612-2-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When Labgrid is used, it can get U-Boot ready for running tests. It prints a message when it has done so. Add logic to detect this message and accept it. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index 76a550d45a1..882d04cd1e9 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -22,6 +22,7 @@ pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ') pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'') pattern_error_notification = re.compile('## Error: ') pattern_error_please_reset = re.compile('### ERROR ### Please RESET the board ###') +pattern_ready_prompt = re.compile('U-Boot is ready') PAT_ID = 0 PAT_RE = 1 @@ -196,15 +197,15 @@ class ConsoleBase(object): self.bad_pattern_ids[m - 1]) self.u_boot_version_string = self.p.after while True: - m = self.p.expect([self.prompt_compiled, + m = self.p.expect([self.prompt_compiled, pattern_ready_prompt, pattern_stop_autoboot_prompt] + self.bad_patterns) - if m == 0: + if m == 0 or m == 1: break - if m == 1: + if m == 2: self.p.send(' ') continue raise Exception('Bad pattern found on console: ' + - self.bad_pattern_ids[m - 2]) + self.bad_pattern_ids[m - 3]) except Exception as ex: self.log.error(str(ex)) From patchwork Fri Sep 20 06:01:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=FPOmipHJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X91zd4Zywz1xrD for ; Fri, 20 Sep 2024 16:03:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 80C428933F; Fri, 20 Sep 2024 08:03:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FPOmipHJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA0DD890EC; Fri, 20 Sep 2024 08:03:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 12A5F8932B for ; Fri, 20 Sep 2024 08:03:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a8d0d0aea3cso200160466b.3 for ; Thu, 19 Sep 2024 23:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812180; x=1727416980; darn=lists.denx.de; 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=FdyPAt0Bnlt9kcMvdcuyr4iZ/pPvF/F+OVLjcGkuqGk=; b=FPOmipHJn0MimdC3QaephonM7kZuxZq49dqnJkT6Ieuxt9D7mCyd+aPEyTb7vxPeIM Ij9PHdh6vM1V+S+j3cmS4iOgdHYxtgBN01z+rPqA5lZ5sj45CHkgObcn0dWksXVN6hxk 8G8bi2zQk5oTj6BIs+UFd0KuJmthLZqcdRQsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812180; x=1727416980; 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=FdyPAt0Bnlt9kcMvdcuyr4iZ/pPvF/F+OVLjcGkuqGk=; b=InG2dLar11foxRLo23Dxh3d3kqCxYu43DHTVd+vjTm91YbguvbUK20jevnHBpScvZk Cvh5Vl0ZVnDYtjrFY/d/tAQg1ANplG5+SxivFDZL74uPQWcUa5uF4/Mnxjmn80a2yOst CO42FjGhVHjIcTC2d8iO3ch8zpuC9CrWe8hOw8ynA1D929hOE9M/PCpBG3BqaSOAUCmW DIU5YE7xk/ShnPQzSQX/XU60CeuU3iKK3o3jRYLCfQ/DHXdMDdqOsiZUQetqRWE06g/O u4YGjvSCwLSu8SZfpt4HENHwkTvggtJrmod79skEsLVD2FOc50RmTE6XtjKD6ND28qMw //EA== X-Gm-Message-State: AOJu0Yz5QAqbA7Npn/kLvn/aNxpXfQGSIlJsKg3H7C0YRFd/n6PWInZN fzyz2vt62o63xbcX6CUgXD438lvYTD1Okk5NHkp0LzMCxjYlvwLTCE9s7yJss6ubF6YcJASY9oO e60se X-Google-Smtp-Source: AGHT+IHaRu/XgiAFTp/qi1yzQoly0IioDfGI4YY9o1nAgT9a3odxkdCZdPmiPEpymgwzb//FnJnA3A== X-Received: by 2002:a17:907:f163:b0:a8d:6329:d8cc with SMTP id a640c23a62f3a-a90d4ffe173mr126461666b.25.1726812180217; Thu, 19 Sep 2024 23:03:00 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:02:59 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 02/19] test: Use a constant for the test timeout Date: Fri, 20 Sep 2024 08:01:37 +0200 Message-ID: <20240920060158.106612-3-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Declare a constant rather than open-coding the same value twice. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index 882d04cd1e9..9cc0af66356 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -27,6 +27,9 @@ pattern_ready_prompt = re.compile('U-Boot is ready') PAT_ID = 0 PAT_RE = 1 +# Timeout before expecting the console to be ready (in milliseconds) +TIMEOUT_MS = 30000 + bad_pattern_defs = ( ('spl_signon', pattern_u_boot_spl_signon), ('main_signon', pattern_u_boot_main_signon), @@ -423,7 +426,7 @@ class ConsoleBase(object): # Reset the console timeout value as some tests may change # its default value during the execution if not self.config.gdbserver: - self.p.timeout = 30000 + self.p.timeout = TIMEOUT_MS return try: self.log.start_section('Starting U-Boot') @@ -434,7 +437,7 @@ class ConsoleBase(object): # future, possibly per-test to be optimal. This works for 'help' # on board 'seaboard'. if not self.config.gdbserver: - self.p.timeout = 30000 + self.p.timeout = TIMEOUT_MS self.p.logfile_read = self.logstream if expect_reset: loop_num = 2 From patchwork Fri Sep 20 06:01:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=aAFnyLy9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X91zC6LRXz1xrD for ; Fri, 20 Sep 2024 16:03:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7DB858932F; Fri, 20 Sep 2024 08:03:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aAFnyLy9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1CFAA89322; Fri, 20 Sep 2024 08:03:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 32A4C8931B for ; Fri, 20 Sep 2024 08:03:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5369f1c7cb8so2196908e87.1 for ; Thu, 19 Sep 2024 23:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812181; x=1727416981; darn=lists.denx.de; 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=USuJFRobrGDAy5YRP/GRrPkrQKUHCIcpx7GrBQq5jbE=; b=aAFnyLy99iQLScVrpc2eVKUL6ctMFokJ9H6V1VBRRIcDn9cl09tLWaqiQpQOfLrBcc jxgl8iE4ioK4mRf7jqfgEKrFAP1jl/rqr56V74KPBpqljznrV30e+NXLvsd+FVJMNXbk pXrLusOSfPq9QjLskWFxFeAdPndjGhidHlNyM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812181; x=1727416981; 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=USuJFRobrGDAy5YRP/GRrPkrQKUHCIcpx7GrBQq5jbE=; b=ElZO/4n7jlPl6wCsOfBnEq7cpnclDS9wdIFRXpUaXq4kZd+I8AOcns0Qhw4tZAtbK4 V1TySDxjjlrKLIr6ZIrB2M6HAyRyrD+KSaO9VLA8oeL5AdxWUGbFjQwTDzdEwTrIz3dr 5+o19SpNJQC8szn5X4mbJ+XmgZLJrSFUXDUSJPS3kVTvdWKpytaXN7VNcNimMXZswxKp LBetT2p/kh+SGMkt2l9heqHu/2U3XyUJOhkyov96fS7uaUKp0ZoXv9KAYIRaMgWelR9U bgr5WS9elNOiMK0ZgHkOdcH3MnQbb4QeWuUDdk/h1MV1FUZGjJNOhJ9zvSbNxeg0tWgo bfoA== X-Gm-Message-State: AOJu0YzYi9M4kFJzTEng8rV0a+1rK7bf1aWuqtvSG80BhFv4cEl7sLxU RLrX55XFTBenPX+bBWhoTWYaBN8ODA7MVXMSpA27jh67/3PXQosu6PSjoGwZuD5hWdx5F5H9sii I/B73 X-Google-Smtp-Source: AGHT+IHLDdHUClJBCDuZtjhTzI2tWGHzMDTbaBH9W9PH+Dg4NwxuO6UWUhkOi1VBXO0IfYq+Y6SOQg== X-Received: by 2002:a05:6512:158e:b0:533:d3e:16f5 with SMTP id 2adb3069b0e04-536ac334255mr934340e87.38.1726812181202; Thu, 19 Sep 2024 23:03:01 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:00 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 03/19] test: Release board after tests complete Date: Fri, 20 Sep 2024 08:01:38 +0200 Message-ID: <20240920060158.106612-4-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When a board is finished with, the lab may want to power it off, or perform some other function. Add a new script which is called when tests are complete. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_exec_attach.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py index 8dd8cc1230c..5f4916b7da2 100644 --- a/test/py/u_boot_console_exec_attach.py +++ b/test/py/u_boot_console_exec_attach.py @@ -70,3 +70,13 @@ class ConsoleExecAttach(ConsoleBase): raise return s + + def close(self): + super().close() + + self.log.action('Releasing board') + args = [self.config.board_type, self.config.board_identity] + cmd = ['u-boot-test-release'] + args + runner = self.log.get_runner(cmd[0], sys.stdout) + runner.run(cmd) + runner.close() From patchwork Fri Sep 20 06:01:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=myZWpZwT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X921205dlz1y1t for ; Fri, 20 Sep 2024 16:05:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9E0689362; Fri, 20 Sep 2024 08:03:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="myZWpZwT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E678789325; Fri, 20 Sep 2024 08:03:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 13F1A89339 for ; Fri, 20 Sep 2024 08:03:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x643.google.com with SMTP id a640c23a62f3a-a8d13b83511so184121066b.2 for ; Thu, 19 Sep 2024 23:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812182; x=1727416982; darn=lists.denx.de; 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=UMqemo9yAz81CFX+6vs9ZIdl+j7POUx/2fudsivcxSo=; b=myZWpZwTRe3NgcRdZbqmIRwH8X5g/TYfVeRyhzbpGHlCnZPmsclnpXQx9CPJHnj0l8 0Oknjqi7FONLRxCYMEg/KTbVMA8FeHKnWsOzKW5pTvLOVOd5Bf3HG4tgnd4BqJR58oh7 yD2Eae5ToWOulU975uHzkB3BvHJ7ryN3sVQ14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812182; x=1727416982; 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=UMqemo9yAz81CFX+6vs9ZIdl+j7POUx/2fudsivcxSo=; b=XVj0wc78kzf8srapEStncpMWwLMF8uKsnZcahWefMuAnxeMNQI6VVLqtrZW04iIbuH RA7Gr0e+LitJFyLDr1L46lN5R2tUJb/A7QmGeXVqbUTbWkiJrVoK9MtD6fzGarLDIPGs nWPPYEFlc0c2jElatEIINDhJ6LtbnOEl/uyNsRrNTP4FQyiaonzRBpSQXaHYvVPYaad0 sQmR+eoH0SduhY3SeV+OuFslUEhoCoxZORarVw0zoFiJoHZOSZrslAkmbQwi3XOtPELn bx+1LnvaYvJicrC18ohpkdwI0ISA7zB7hm0DhOThvTdWN2RkhznuGwYb9ioL6ny/A4AY MqSA== X-Gm-Message-State: AOJu0YwLPyIg6rRHxXNHXcK338TBRs99PmpFkCMfrUD4Wlt2SWtvlxEj hygUiNeJ4WeosIcEZsLpgLqzjEdQFQtrm6+Zz7ZZFvYUq/A8cctszLk7j7k1eYLC618aZtlzxPr 7dKONfGw= X-Google-Smtp-Source: AGHT+IFHFhCq25BGikPp6AZhHFh8O4YYl2gbZ33tRuP9YdVd9yIE/P9OSSk/qfUzp6aJBOQTevE06w== X-Received: by 2002:a17:907:a4b:b0:a86:aee7:9736 with SMTP id a640c23a62f3a-a90d59257d4mr107733466b.46.1726812182079; Thu, 19 Sep 2024 23:03:02 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:01 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 04/19] test: Allow connecting to a running board Date: Fri, 20 Sep 2024 08:01:39 +0200 Message-ID: <20240920060158.106612-5-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Sometimes we know that the board is already running the right software, so provide an option to allow running of tests directly, without first resetting the board. This saves time when re-running a test where only the Python code is changing. Signed-off-by: Simon Glass --- (no changes since v1) test/py/conftest.py | 3 +++ test/py/u_boot_console_base.py | 14 ++++++++++---- test/py/u_boot_console_exec_attach.py | 21 ++++++++++++--------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/test/py/conftest.py b/test/py/conftest.py index fc9dd3a83f8..ca66b9d9e61 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -79,6 +79,8 @@ def pytest_addoption(parser): parser.addoption('--gdbserver', default=None, help='Run sandbox under gdbserver. The argument is the channel '+ 'over which gdbserver should communicate, e.g. localhost:1234') + parser.addoption('--no-prompt-wait', default=False, action='store_true', + help="Assume that U-Boot is ready and don't wait for a prompt") def run_build(config, source_dir, build_dir, board_type, log): """run_build: Build U-Boot @@ -238,6 +240,7 @@ def pytest_configure(config): ubconfig.board_type = board_type ubconfig.board_identity = board_identity ubconfig.gdbserver = gdbserver + ubconfig.no_prompt_wait = config.getoption('no_prompt_wait') ubconfig.dtb = build_dir + '/arch/sandbox/dts/test.dtb' env_vars = ( diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index 9cc0af66356..8a9c4a576dc 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -439,11 +439,17 @@ class ConsoleBase(object): if not self.config.gdbserver: self.p.timeout = TIMEOUT_MS self.p.logfile_read = self.logstream - if expect_reset: - loop_num = 2 + if self.config.no_prompt_wait: + # Send an empty command to set up the 'expect' logic. This has + # the side effect of ensuring that there was no partial command + # line entered + self.run_command(' ') else: - loop_num = 1 - self.wait_for_boot_prompt(loop_num = loop_num) + if expect_reset: + loop_num = 2 + else: + loop_num = 1 + self.wait_for_boot_prompt(loop_num = loop_num) self.at_prompt = True self.at_prompt_logevt = self.logstream.logfile.cur_evt except Exception as ex: diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py index 5f4916b7da2..42fc15197b9 100644 --- a/test/py/u_boot_console_exec_attach.py +++ b/test/py/u_boot_console_exec_attach.py @@ -59,15 +59,18 @@ class ConsoleExecAttach(ConsoleBase): args = [self.config.board_type, self.config.board_identity] s = Spawn(['u-boot-test-console'] + args) - try: - self.log.action('Resetting board') - cmd = ['u-boot-test-reset'] + args - runner = self.log.get_runner(cmd[0], sys.stdout) - runner.run(cmd) - runner.close() - except: - s.close() - raise + if self.config.no_prompt_wait: + self.log.action('Connecting to board without reset') + else: + try: + self.log.action('Resetting board') + cmd = ['u-boot-test-reset'] + args + runner = self.log.get_runner(cmd[0], sys.stdout) + runner.run(cmd) + runner.close() + except: + s.close() + raise return s From patchwork Fri Sep 20 06:01:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987641 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=LhaNDaX4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X91zP6wthz1xrD for ; Fri, 20 Sep 2024 16:03:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2CA5A8933A; Fri, 20 Sep 2024 08:03:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LhaNDaX4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 27D278933C; Fri, 20 Sep 2024 08:03:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0920689329 for ; Fri, 20 Sep 2024 08:03:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5c42e7adbddso2059045a12.2 for ; Thu, 19 Sep 2024 23:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812183; x=1727416983; darn=lists.denx.de; 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=z6w+vCz3Khe4wx7HAE7P/6ArhEY0L3lZFzeAjpvqqlY=; b=LhaNDaX4TtuoSAvYehl65aaw9vncXmB1CqPYRF+gsPKSZQHaQI23Ru4wecXkCQFZ0z I8OlLHAU65ejnNrhPEW133lrhTo7QfsZ6o+zGbgs6lMC+wuNsDAnlnRBO/8D+gHTYUU4 3lhzsL4Qgee/F/5MYDmKyZHxkwFd8TG+26UtU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812183; x=1727416983; 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=z6w+vCz3Khe4wx7HAE7P/6ArhEY0L3lZFzeAjpvqqlY=; b=ctQd5B9fh4VenYQ1RO/6eZJawgTAcUD/wqgk9X/3qiGj6X/yJV8Hr7tZlHIKp5qkiv 0gE1/8Arxx2lSmEk0fL2Y7igYddWiaSOwk6S7wA9D1xMeSgZEaHb+3YdZfY+nqw5NKPy W2wD1e1DaQAZO5lwLdzcRl3GV29sfiY+mrcdr5k2p6+Dd/ITbJCjfHA3ExeCGTrpDD7u Jdt9p679sO4U4Ek1tSnXfULT8/q5fk2LeqHnlemn3m/AHgWV13xfIKRr8d7V8XJmxLcU L/tB+7rN01OmDhmX4NTPBhDoaS0B55H5HuE+jJySJWj6M3aI6u3tSLtpNUTSaNEXRTUC 3iWQ== X-Gm-Message-State: AOJu0YyPAh8GGRYWoA3lMlTKC6rufDKvoHxwRsIODhCjaCBcz2stik+5 ar0N3qXzUfaOlnERNk1tIj0rVP3oyWTvQFTPrUnLB/MYj8y6N5yQ4r2ArHQI0SNZkuE9lGXtXY0 GHEX8 X-Google-Smtp-Source: AGHT+IEool2gEaT5lpik2kc7LhZFMPYYa29lx8P7xhx56fds1PdCMMwpX1e1fHabws0aQ3fdz1j/6A== X-Received: by 2002:a17:907:d59c:b0:a86:799d:f8d1 with SMTP id a640c23a62f3a-a90d50d1160mr112734366b.47.1726812183149; Thu, 19 Sep 2024 23:03:03 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:02 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 05/19] test: Avoid failing skipped tests Date: Fri, 20 Sep 2024 08:01:40 +0200 Message-ID: <20240920060158.106612-6-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When a test returns -EAGAIN this should not be considered a failure. Fix what seems to be a problem case, where the pytests see a failure when a test has merely been skipped. We cannot squash the -EAGAIN error in ut_run_test() since the failure count is incremented by its caller, ut_run_test_live_flat() The specific example here is on snow, where a test is compiled into the image but cannot run, so returns -EAGAIN to skip: test/py/tests/test_ut.py sssnow # ut bdinfo bdinfo_test_eth Test: bdinfo_test_eth: bdinfo.c Skipping: Console recording disabled test/test-main.c:486, ut_run_test_live_flat(): 0 == ut_run_test(uts, test, test->name): Expected 0x0 (0), got 0xfffffff5 (-11) Test bdinfo_test_eth failed 1 times Skipped: 1, Failures: 1 snow # F+u-boot-test-reset snow snow The fix is simply to respect the return code from ut_run_test(), so do that. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Expand the commit message test/test-main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/test-main.c b/test/test-main.c index b3d3e24cdce..b613fc6a4d3 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -486,7 +486,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test, static int ut_run_test_live_flat(struct unit_test_state *uts, struct unit_test *test) { - int runs; + int runs, ret; if ((test->flags & UTF_OTHER_FDT) && !IS_ENABLED(CONFIG_SANDBOX)) return skip_test(uts); @@ -496,8 +496,11 @@ static int ut_run_test_live_flat(struct unit_test_state *uts, if (CONFIG_IS_ENABLED(OF_LIVE)) { if (!(test->flags & UTF_FLAT_TREE)) { uts->of_live = true; - ut_assertok(ut_run_test(uts, test, test->name)); - runs++; + ret = ut_run_test(uts, test, test->name); + if (ret != -EAGAIN) { + ut_assertok(ret); + runs++; + } } } @@ -521,8 +524,11 @@ static int ut_run_test_live_flat(struct unit_test_state *uts, (!runs || ut_test_run_on_flattree(test)) && !(gd->flags & GD_FLG_FDT_CHANGED)) { uts->of_live = false; - ut_assertok(ut_run_test(uts, test, test->name)); - runs++; + ret = ut_run_test(uts, test, test->name); + if (ret != -EAGAIN) { + ut_assertok(ret); + runs++; + } } return 0; From patchwork Fri Sep 20 06:01:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=n+IabYHp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X91zs6S08z1xrD for ; Fri, 20 Sep 2024 16:04:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA9CE8931D; Fri, 20 Sep 2024 08:03:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="n+IabYHp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E103F89343; Fri, 20 Sep 2024 08:03:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E3D048931A for ; Fri, 20 Sep 2024 08:03:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a8d2b4a5bf1so216809466b.2 for ; Thu, 19 Sep 2024 23:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812184; x=1727416984; darn=lists.denx.de; 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=qPe3fmy3f4uuOOrsJvHKA6PP8a5Pa0C8PYfC90KhFAc=; b=n+IabYHpYMOC3Yol0y2REzPk+WJdCy0JwXft05eO0Fo3uDVTCGbiUnQ2Qt+I8Qmmlb Z1AtdxmiWKo7xPXtxl9vdJrj2n2s1Ko6UFg/p1TshdpRKbxXYDhRZhkKyfp5dHByIJQY +O3Nw+uJ+LnLFwMc0tldAlAYTaSrAPjygmfHc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812184; x=1727416984; 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=qPe3fmy3f4uuOOrsJvHKA6PP8a5Pa0C8PYfC90KhFAc=; b=dZ5NaVOgl2+JOvESyAURfZPnxu6vZE+pLSQcaeKCHRuVy1AWDbGSGY3IG1YKEeXg8z eghMUJEGimffyOKCJdj2YOLSrlQgy6HcDSXh2SAo1GfbDEXFgXfqyonIxlRGiPrjaC+I Hbxo64+ne5KhYIoVZU48LA51XgOrRZOQmIyyUvfDrsw5H+/IEc19QnGkmkt7W/OpV0l6 IacuJ5fV1cYfAa/yZRLAxApPB78EfAimSesGBC/dG/RNJp22yFcvX7N62ecIpA76+Hgi Rdl3KweKHJDf5ezCNTaMF5V8wzVsqALHNvEZa997VEKpys4UvWPpujTABgIBzeeUOQHp zx8A== X-Gm-Message-State: AOJu0Yym5HqpgYt7YVq5qMbqxn7jIQEaQ+5W8Ul5u1GAnP+T38nL280b bd7Pg+N5Jd2r7GFCmhq9aT//qHLRC2qJlWY9eJoRXRwjJO03Sq4LQYOJ5lOxqHrQNb+nJN/BPMP bHi6i X-Google-Smtp-Source: AGHT+IGSon7PEhhKrAWt6ywkkQsdPDdN2QbNSAQoYkr91Jv0z4CiqarhDG61hIjXoOSqVCb6dqzT/Q== X-Received: by 2002:a17:907:efc7:b0:a8d:439d:5c25 with SMTP id a640c23a62f3a-a90d4fdfe99mr137420966b.4.1726812184140; Thu, 19 Sep 2024 23:03:04 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:03 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 06/19] test: Create a common function to get the config Date: Fri, 20 Sep 2024 08:01:41 +0200 Message-ID: <20240920060158.106612-7-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The settings are decoded in two places. Combine them into a new function, before (in a future patch) expanding the number of items. Signed-off-by: Simon Glass --- (no changes since v1) test/py/conftest.py | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/test/py/conftest.py b/test/py/conftest.py index ca66b9d9e61..6547c6922c6 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -117,14 +117,36 @@ def run_build(config, source_dir, build_dir, board_type, log): runner.close() log.status_pass('OK') -def pytest_xdist_setupnodes(config, specs): - """Clear out any 'done' file from a previous build""" - global build_done_file - build_dir = config.getoption('build_dir') +def get_details(config): + """Obtain salient details about the board and directories to use + + Args: + config (pytest.Config): pytest configuration + + Returns: + tuple: + str: Board type (U-Boot build name) + str: Identity for the lab board + str: Build directory + str: Source directory + """ board_type = config.getoption('board_type') + board_identity = config.getoption('board_identity') + build_dir = config.getoption('build_dir') + source_dir = os.path.dirname(os.path.dirname(TEST_PY_DIR)) + default_build_dir = source_dir + '/build-' + board_type if not build_dir: - build_dir = source_dir + '/build-' + board_type + build_dir = default_build_dir + + return board_type, board_identity, build_dir, source_dir + +def pytest_xdist_setupnodes(config, specs): + """Clear out any 'done' file from a previous build""" + global build_done_file + + build_dir = get_details(config)[2] + build_done_file = Path(build_dir) / 'build.done' if build_done_file.exists(): os.remove(build_done_file) @@ -163,17 +185,10 @@ def pytest_configure(config): global console global ubconfig - source_dir = os.path.dirname(os.path.dirname(TEST_PY_DIR)) + board_type, board_identity, build_dir, source_dir = get_details(config) - board_type = config.getoption('board_type') board_type_filename = board_type.replace('-', '_') - - board_identity = config.getoption('board_identity') board_identity_filename = board_identity.replace('-', '_') - - build_dir = config.getoption('build_dir') - if not build_dir: - build_dir = source_dir + '/build-' + board_type mkdir_p(build_dir) result_dir = config.getoption('result_dir') From patchwork Fri Sep 20 06:01:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jz3Oje7O; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X922h1vSVz1y1t for ; Fri, 20 Sep 2024 16:06:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ABED689372; Fri, 20 Sep 2024 08:03:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jz3Oje7O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B2BD389347; Fri, 20 Sep 2024 08:03:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CAA8389333 for ; Fri, 20 Sep 2024 08:03:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-53659867cbdso2538329e87.3 for ; Thu, 19 Sep 2024 23:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812186; x=1727416986; darn=lists.denx.de; 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=PaS64qdPfg65WSR3ojBzmqXsoIfKyBGCD0ldk3Nxg2w=; b=jz3Oje7OjD6FdjtvckCRIEswZ2xc+jejywdnuoK9pnubzGR++8TM8HrpWvqi+NOCAe IS6fT1PQFw5H8lFleTORZYSqs0AsI6of2FUm8GgOq/MOWWKRI6iBD+c0120oIsxbZNNP kM/RnIw5rbSkuov1ULzWuFpmm6Uy21H+V528U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812186; x=1727416986; 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=PaS64qdPfg65WSR3ojBzmqXsoIfKyBGCD0ldk3Nxg2w=; b=Cdx1iUoIztwHSfMNmgJvRYE8wZIVAqjOIElidgPoSjQVq+U/aFQh8X+aMsdXl0ZXwg N24YCpzetGTE0Y5f6tocpeTtFcu7RAnmY4SAPxkuZlBj9GIqcg1E7yqaxph9vyJxyhtg CDHtlWu0opmUkgCTGp5gxeZ4RZhMC2PtJ/TaDmFm2BpW0hKjAxP8TnYwSRewn7pTmQ3I pcQ1UDgt5sJFU5UuQ/vSI8rgvJ1JzOk5Xz6cb1Y7HdMGvGMhAM2es0VYvC1XZGXqMKDa AeBmrZ/O6GquGFYDtBVCbH+MCeVSxSEIo7BzTSxELZzscO33bG37+5TnsJm4ulGpDJhW d6cg== X-Gm-Message-State: AOJu0YzeD+x6u6OJgB+i6AVPxfWdli51W5+XCwHh3eVud8ycm0pWfVLa qCfqFIJGXyCS//PgpKalr4SuAJaiaAOIK9I4sbRE8SIfQIPkkCBTLipyKe+8EM/nj4W7prEHCZb Uz3yA X-Google-Smtp-Source: AGHT+IFC8/5QvcLh9IUBgE22D3OsuC/Im9OL1uN+mSloLj1tB0bF+eq6sB2ARELa53weQ0Sjum06Ew== X-Received: by 2002:a05:6512:3f18:b0:536:7362:5912 with SMTP id 2adb3069b0e04-536ac2f5b3cmr1174795e87.30.1726812185082; Thu, 19 Sep 2024 23:03:05 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:04 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 07/19] test: Introduce the concept of a role Date: Fri, 20 Sep 2024 08:01:42 +0200 Message-ID: <20240920060158.106612-8-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean In Labgrid there is the concept of a 'role', which is similar to the U-Boot board ID in U-Boot's pytest subsystem. The role indicates both the target and information about the U-Boot build to use. It can also provide any amount of other configuration. The information is obtained using the 'labgrid-client query' operation. Make use of this in tests, so that only the role is required in gitlab and other situations. The board type and other things can be queried as needed. Use a new 'u-boot-test-getrole' script to obtain the requested information. With this it is possible to run lab tests in gitlab with just a single 'ROLE' variable for each board. Signed-off-by: Simon Glass --- (no changes since v5) Changes in v5: - Add a few more comments - Comment out the debugging, which might be useful later test/py/conftest.py | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/test/py/conftest.py b/test/py/conftest.py index 6547c6922c6..03dfd8ab562 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -23,6 +23,7 @@ from pathlib import Path import pytest import re from _pytest.runner import runtestprotocol +import subprocess import sys # Globals: The HTML log file, and the connection to the U-Boot console. @@ -79,6 +80,7 @@ def pytest_addoption(parser): parser.addoption('--gdbserver', default=None, help='Run sandbox under gdbserver. The argument is the channel '+ 'over which gdbserver should communicate, e.g. localhost:1234') + parser.addoption('--role', help='U-Boot board role (for Labgrid)') parser.addoption('--no-prompt-wait', default=False, action='store_true', help="Assume that U-Boot is ready and don't wait for a prompt") @@ -130,12 +132,40 @@ def get_details(config): str: Build directory str: Source directory """ - board_type = config.getoption('board_type') - board_identity = config.getoption('board_identity') + role = config.getoption('role') + + # Get a few provided parameters build_dir = config.getoption('build_dir') + if role: + # When using a role, build_dir and build_dir_extra are normally not set, + # since they are picked up from Labgrid via the u-boot-test-getrole + # script + board_identity = role + cmd = ['u-boot-test-getrole', role, '--configure'] + env = os.environ.copy() + if build_dir: + env['U_BOOT_BUILD_DIR'] = build_dir + proc = subprocess.run(cmd, capture_output=True, encoding='utf-8', + env=env) + if proc.returncode: + raise ValueError(proc.stderr) + # For debugging + # print('conftest: lab:', proc.stdout) + vals = {} + for line in proc.stdout.splitlines(): + item, value = line.split(' ', maxsplit=1) + k = item.split(':')[-1] + vals[k] = value + # For debugging + # print('conftest: lab info:', vals) + board_type, default_build_dir, source_dir = (vals['board'], + vals['build_dir'], vals['source_dir']) + else: + board_type = config.getoption('board_type') + board_identity = config.getoption('board_identity') - source_dir = os.path.dirname(os.path.dirname(TEST_PY_DIR)) - default_build_dir = source_dir + '/build-' + board_type + source_dir = os.path.dirname(os.path.dirname(TEST_PY_DIR)) + default_build_dir = source_dir + '/build-' + board_type if not build_dir: build_dir = default_build_dir From patchwork Fri Sep 20 06:01:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bOMdkI7K; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X92086q9Kz1xrD for ; Fri, 20 Sep 2024 16:04:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3E4F589349; Fri, 20 Sep 2024 08:03:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bOMdkI7K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1CB5C8931A; Fri, 20 Sep 2024 08:03:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BF1A789325 for ; Fri, 20 Sep 2024 08:03:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a8d2daa2262so184923766b.1 for ; Thu, 19 Sep 2024 23:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812186; x=1727416986; darn=lists.denx.de; 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=L2xXfu0alHeif1svNJjIFiDVZRcK387y363Qs64PS18=; b=bOMdkI7KmlNGJvCc4sFGkXyeAsLaizzJrdiBvptHZWVmdZVYDMXALex1Y1cBNcXWbW 8lhhV0ERGTpysVra5SsZJRct/Gl8IJbiSOC6eikabmQx7b0RRTcHbHydt4SmsYQiMkvB Bx/VWBDsXqGt9zzqHRsHTDBArYsgdbc3P8bT8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812186; x=1727416986; 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=L2xXfu0alHeif1svNJjIFiDVZRcK387y363Qs64PS18=; b=n6prUKLDTL+lAADO4n171C9cR314Q7nYv95RdknfssnRJWS+ZVkkLWWW0IjE8sEWGA 108jmL8CBi2PUFfwq3IvI++pYeB2kMRl6z9wSeQfiLc2uuwCmB/Cgg0TIVHyHOVHccQV 0sC8yJDn+U8wD0bsPxGEajLgIvEedFFqm/Ci0qoquwKvJU0wjmcZBdzfjsSnDJ8cjIHl 7bT1Vrk0afMBDmQdNlh2/7HHGHle8whnakhesPWnnmM0M8dtH51B8IuvDnxTRC7yY0ak gaHyH84OvvPbBF/+xGtlJoFek7+sFv4S1CtuHtmYdS3Oa7aEb23fC9rfv30XbdEikhw5 2E2A== X-Gm-Message-State: AOJu0Yw1JlepeFit5XpV9MJazNpo63xfQDK8kHy+i1QYj60chl3w4aZk g0olNCfNUBK73mWx1DLG94ZLIyrbSXUnDudbs8qV5yo+c0oHwYwBniOfZM5E8A4MoMZb3oRetzD JEx84 X-Google-Smtp-Source: AGHT+IHNEfQq+378lRuc8kPkWiE1OL8lgNItXgXZOJBhcmHHkunByPagpGtY35VjMohaMtrGJoM0lA== X-Received: by 2002:a17:907:e2a5:b0:a8d:571a:e863 with SMTP id a640c23a62f3a-a90d5001974mr144157966b.25.1726812185979; Thu, 19 Sep 2024 23:03:05 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:05 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 08/19] test: Move the receive code into a function Date: Fri, 20 Sep 2024 08:01:43 +0200 Message-ID: <20240920060158.106612-9-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is quite a bit of code to deal with receiving data from the target so move it into its own receive() function. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_spawn.py | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index 97e95e07c80..69a2cd55816 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -137,6 +137,32 @@ class Spawn: os.write(self.fd, data.encode(errors='replace')) + def receive(self, num_bytes): + """Receive data from the sub-process's stdin. + + Args: + num_bytes (int): Maximum number of bytes to read + + Returns: + str: The data received + + Raises: + ValueError if U-Boot died + """ + try: + c = os.read(self.fd, num_bytes).decode(errors='replace') + except OSError as err: + # With sandbox, try to detect when U-Boot exits when it + # shouldn't and explain why. This is much more friendly than + # just dying with an I/O error + if self.decode_signal and err.errno == 5: # I/O error + alive, _, info = self.checkalive() + if alive: + raise err + raise ValueError('U-Boot exited with %s' % info) + raise + return c + def expect(self, patterns): """Wait for the sub-process to emit specific data. @@ -193,18 +219,7 @@ class Spawn: events = self.poll.poll(poll_maxwait) if not events: raise Timeout() - try: - c = os.read(self.fd, 1024).decode(errors='replace') - except OSError as err: - # With sandbox, try to detect when U-Boot exits when it - # shouldn't and explain why. This is much more friendly than - # just dying with an I/O error - if self.decode_signal and err.errno == 5: # I/O error - alive, _, info = self.checkalive() - if alive: - raise err - raise ValueError('U-Boot exited with %s' % info) - raise + c = self.receive(1024) if self.logfile_read: self.logfile_read.write(c) self.buf += c From patchwork Fri Sep 20 06:01:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=EGxuwzVD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X920L64FNz1xrD for ; Fri, 20 Sep 2024 16:04:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 988668934F; Fri, 20 Sep 2024 08:03:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="EGxuwzVD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 075AE89322; Fri, 20 Sep 2024 08:03:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 073BE8931B for ; Fri, 20 Sep 2024 08:03:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x644.google.com with SMTP id a640c23a62f3a-a8d24f98215so202035466b.1 for ; Thu, 19 Sep 2024 23:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812187; x=1727416987; darn=lists.denx.de; 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=R58sqHGcD4y1xLHd++8m6PcOenHjcIpwQOOAH4wZJ24=; b=EGxuwzVDmfbPkhzBMjcUecTZxcDWSCNRZ5IPqj8K6bX2nyYdpzfL9sISHydYhXI76X JnsBFJNId49q/jkPG97+X0d+lRdBBvKaQEJSJzyjc6xHsPYjcHycEXK9rtGZYAm+ycgD AOrtiNEHObS3n7OeoZzC0VJcnFkTvL+gJpgiE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812187; x=1727416987; 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=R58sqHGcD4y1xLHd++8m6PcOenHjcIpwQOOAH4wZJ24=; b=hWBjXDYrGDD09UyDx9YrJBkHZv458vgLsGJXWK4gFmDCctN/NeGnei53V6KvY4kmCt 1fKDX5D1/TE9X4suLlAavpY2EqXTCMhvZ3HcZxw/V8aoZN7DVYpkdr68bsX3+Ee4L0LJ C0X0oONI75ffVVoazuUvTH9kMwSgi9GAJD8YEr54mDPefkMSE6z0wujF5t7MRBlVIRwH sdUHuXFzVsGdYm4J9SlraKktOSwVAwPKVmBzFuaSpTrqUUgjDC9AlRj10Xp7QwNZKxQ1 zY8Kh8iiZZLq/byEWiTLvNwIUUkYZsJKIyplx/tyC+6ypaqtA84B0XuRPfJ6B6Gh6pdp SR8Q== X-Gm-Message-State: AOJu0Yz9uXw06Hkj6qtZxyAAn8ItjumDDy+vqSE94L9E96OVxjsesx5k Doj84UcHt5G5dZgcyUOfQ6709ceuarVKW7gaFY7Y4UMMAdNgcCHj06kYwBIIC4LUVCQgVqAxLiS ogxFSovY= X-Google-Smtp-Source: AGHT+IF57+v6eD3V40T2nVNi1PjvXQ51xN2Xg/Hhxv2g8A0L7EzeJ0jAhq6Yq/pkRAykrZ8Hy4LCMA== X-Received: by 2002:a17:907:e612:b0:a8d:3e29:a82d with SMTP id a640c23a62f3a-a90d5000fa9mr112021266b.37.1726812187029; Thu, 19 Sep 2024 23:03:07 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:06 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 09/19] test: Separate out the exception handling Date: Fri, 20 Sep 2024 08:01:44 +0200 Message-ID: <20240920060158.106612-10-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The tests currently catch a very board Exception in each case. This is thrown even in the event of a coding error. We want to handle exceptions differently depending on their severity, so that we can avoid hour-long delays waiting for a board that is clearly broken. As a first step, create some new exception types, separating out those which are simply an unexpected result from executed a command, from those which indicate some kind of hardware failure. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 26 ++++++++++++++------------ test/py/u_boot_spawn.py | 11 +++++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index 8a9c4a576dc..fa87952694d 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -14,6 +14,7 @@ import pytest import re import sys import u_boot_spawn +from u_boot_spawn import BootFail, Timeout, Unexpected # Regexes for text we expect U-Boot to send to the console. pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))') @@ -190,13 +191,13 @@ class ConsoleBase(object): m = self.p.expect([pattern_u_boot_spl_signon] + self.bad_patterns) if m != 0: - raise Exception('Bad pattern found on SPL console: ' + + raise BootFail('Bad pattern found on SPL console: ' + self.bad_pattern_ids[m - 1]) env_spl_banner_times -= 1 m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns) if m != 0: - raise Exception('Bad pattern found on console: ' + + raise BootFail('Bad pattern found on console: ' + self.bad_pattern_ids[m - 1]) self.u_boot_version_string = self.p.after while True: @@ -207,13 +208,9 @@ class ConsoleBase(object): if m == 2: self.p.send(' ') continue - raise Exception('Bad pattern found on console: ' + + raise BootFail('Bad pattern found on console: ' + self.bad_pattern_ids[m - 3]) - except Exception as ex: - self.log.error(str(ex)) - self.cleanup_spawn() - raise finally: self.log.timestamp() @@ -279,7 +276,7 @@ class ConsoleBase(object): m = self.p.expect([chunk] + self.bad_patterns) if m != 0: self.at_prompt = False - raise Exception('Bad pattern found on console: ' + + raise BootFail('Bad pattern found on console: ' + self.bad_pattern_ids[m - 1]) if not wait_for_prompt: return @@ -289,14 +286,18 @@ class ConsoleBase(object): m = self.p.expect([self.prompt_compiled] + self.bad_patterns) if m != 0: self.at_prompt = False - raise Exception('Bad pattern found on console: ' + + raise BootFail('Missing prompt on console: ' + self.bad_pattern_ids[m - 1]) self.at_prompt = True self.at_prompt_logevt = self.logstream.logfile.cur_evt # Only strip \r\n; space/TAB might be significant if testing # indentation. return self.p.before.strip('\r\n') - except Exception as ex: + except Timeout as exc: + self.log.error(str(exc)) + self.cleanup_spawn() + raise + except BootFail as ex: self.log.error(str(ex)) self.cleanup_spawn() raise @@ -355,8 +356,9 @@ class ConsoleBase(object): text = re.escape(text) m = self.p.expect([text] + self.bad_patterns) if m != 0: - raise Exception('Bad pattern found on console: ' + - self.bad_pattern_ids[m - 1]) + raise Unexpected( + "Unexpected pattern found on console (exp '{text}': " + + self.bad_pattern_ids[m - 1]) def drain_console(self): """Read from and log the U-Boot console for a short time. diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index 69a2cd55816..bcba7b5cd43 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -16,6 +16,17 @@ import traceback class Timeout(Exception): """An exception sub-class that indicates that a timeout occurred.""" +class BootFail(Exception): + """An exception sub-class that indicates that a boot failure occurred. + + This is used when a bad pattern is seen when waiting for the boot prompt. + It is regarded as fatal, to avoid trying to boot the again and again to no + avail. + """ + +class Unexpected(Exception): + """An exception sub-class that indicates that unexpected test was seen.""" + class Spawn: """Represents the stdio of a freshly created sub-process. Commands may be sent to the process, and responses waited for. From patchwork Fri Sep 20 06:01:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YPjQrIgt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X920b0C8sz1xrD for ; Fri, 20 Sep 2024 16:04:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0582389354; Fri, 20 Sep 2024 08:03:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YPjQrIgt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 268EF8931B; Fri, 20 Sep 2024 08:03:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 192598932B for ; Fri, 20 Sep 2024 08:03:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x642.google.com with SMTP id a640c23a62f3a-a8ce5db8668so230134966b.1 for ; Thu, 19 Sep 2024 23:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812188; x=1727416988; darn=lists.denx.de; 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=R4LkKy/biW7n9xuKyOH0uAVMDeqUoxV5ZdcfRtAzC1I=; b=YPjQrIgtmSpmk5Xhz3uU6kpH1VXrJXgX/SbsqPMx3YUx7eW5iuvs+K/0UJyxHgLeXP 2AFPrhm1KnadL0N2ifGXmqBvynyfiwkqJ3H9ZZVOFnSR3cXdoCXGBM1yR9U4d1ZCjdtH emjKokTtfaT5gipGLWNX5BNK8BTZNhRnrb80c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812188; x=1727416988; 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=R4LkKy/biW7n9xuKyOH0uAVMDeqUoxV5ZdcfRtAzC1I=; b=HGJY0dkiD/o4rxr5Az40XQi0hvHA39I/dCczMvvI96dm2zus2MbwTamIpEgwfxZtO3 0w11oOdGMvFGhCG9lwxQ4WGTmDe79FPgz7Nj6wHEIvcTjzfefaVV3+T5a8GNjcEmOjp1 ElAsYyB8MklaeXh+P1CzTL4TH5ekmc5iIqpb0pF9/DbKu6v6IisdZ0/d+uF5uU/kB3/S mE6oihjBHvFbgm44rn1OwPh2Gk7Lod0vx0hURjZEuhaMdO3tp5F2qUzFl0rK4Eve3iNr CyFxnbyXBIvTDSG5qLu8JB5IzdV+4u05gcEP9miYlezmlnCw2UHCn0onspiU2X+iZTLg khnA== X-Gm-Message-State: AOJu0YwpZaEU3WQvWaBR1LDBOmWPs2gOh4J0aJqyaY4flbd+H04+Kb6b DoE8LkkocYmdP9liAAxWnQDr3Q2lkoATLBtDQcRT28rErCk6td+22OQkAma3JyyH4BOww+F22rR cPPW7C0c= X-Google-Smtp-Source: AGHT+IHGvMJL5lARv7HYmuHOgBaNvKSHf09+RSEooZvUclxxcZHtx4OWLi9tXrY6mo2/k/vNsiwh2Q== X-Received: by 2002:a17:907:f151:b0:a86:7021:1368 with SMTP id a640c23a62f3a-a90d5613552mr121061466b.21.1726812188107; Thu, 19 Sep 2024 23:03:08 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:07 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 10/19] test: Detect dead connections Date: Fri, 20 Sep 2024 08:01:45 +0200 Message-ID: <20240920060158.106612-11-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When the connection to a board dies, assume it is dead forever until some user action is taken. Skip all remaining tests. This avoids CI runs taking an hour, with hundreds of 30-second timeouts all to no avail. Signed-off-by: Simon Glass --- (no changes since v1) test/py/conftest.py | 19 +++++++++++++++++-- test/py/u_boot_spawn.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/test/py/conftest.py b/test/py/conftest.py index 03dfd8ab562..9eea65b5929 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -25,6 +25,7 @@ import re from _pytest.runner import runtestprotocol import subprocess import sys +from u_boot_spawn import BootFail, Timeout, Unexpected, handle_exception # Globals: The HTML log file, and the connection to the U-Boot console. log = None @@ -287,6 +288,7 @@ def pytest_configure(config): ubconfig.gdbserver = gdbserver ubconfig.no_prompt_wait = config.getoption('no_prompt_wait') ubconfig.dtb = build_dir + '/arch/sandbox/dts/test.dtb' + ubconfig.connection_ok = True env_vars = ( 'board_type', @@ -453,8 +455,21 @@ def u_boot_console(request): Returns: The fixture value. """ - - console.ensure_spawned() + if not ubconfig.connection_ok: + pytest.skip('Cannot get target connection') + return None + try: + console.ensure_spawned() + except OSError as err: + handle_exception(ubconfig, console, log, err, 'Lab failure', True) + except Timeout as err: + handle_exception(ubconfig, console, log, err, 'Lab timeout', True) + except BootFail as err: + handle_exception(ubconfig, console, log, err, 'Boot fail', True, + console.get_spawn_output()) + except Unexpected: + handle_exception(ubconfig, console, log, err, 'Unexpected test output', + False) return console anchors = {} diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index bcba7b5cd43..24d369035e5 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -8,6 +8,7 @@ Logic to spawn a sub-process and interact with its stdio. import os import re import pty +import pytest import signal import select import time @@ -27,6 +28,43 @@ class BootFail(Exception): class Unexpected(Exception): """An exception sub-class that indicates that unexpected test was seen.""" + +def handle_exception(ubconfig, console, log, err, name, fatal, output=''): + """Handle an exception from the console + + Exceptions can occur when there is unexpected output or due to the board + crashing or hanging. Some exceptions are likely fatal, where retrying will + just chew up time to no available. In those cases it is best to cause + further tests be skipped. + + Args: + ubconfig (ArbitraryAttributeContainer): ubconfig object + log (Logfile): Place to log errors + console (ConsoleBase): Console to clean up, if fatal + err (Exception): Exception which was thrown + name (str): Name of problem, to log + fatal (bool): True to abort all tests + output (str): Extra output to report on boot failure. This can show the + target's console output as it tried to boot + """ + msg = f'{name}: ' + if fatal: + msg += 'Marking connection bad - no other tests will run' + else: + msg += 'Assuming that lab is healthy' + print(msg) + log.error(msg) + log.error(f'Error: {err}') + + if output: + msg += f'; output {output}' + + if fatal: + ubconfig.connection_ok = False + console.cleanup_spawn() + pytest.exit(msg) + + class Spawn: """Represents the stdio of a freshly created sub-process. Commands may be sent to the process, and responses waited for. From patchwork Fri Sep 20 06:01:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=j1ubulTv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X920p5XgGz1y1t for ; Fri, 20 Sep 2024 16:04:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E23089359; Fri, 20 Sep 2024 08:03:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="j1ubulTv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F2DA689325; Fri, 20 Sep 2024 08:03:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 08A7C89344 for ; Fri, 20 Sep 2024 08:03:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a7a81bd549eso188518166b.3 for ; Thu, 19 Sep 2024 23:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812189; x=1727416989; darn=lists.denx.de; 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=By6LLmlNfpGYfC8hRJlbuluca2yelOebJvJPu9FgFiM=; b=j1ubulTvPqkExq5ZLnKmjvpSgjV1SvhUCl4trippaqJ11/U2F1sUgOPXs6d7wOWR1I E+YWYFRib7c2fNfkvvv5WXqsoDzgVPjaq8Uok1Z7jlMuuMtPAy9dKGUeP0bi98H36c9I lro+nHZe3pGDzp9EXMMxiSFIfD4+6L1+RXrnc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812189; x=1727416989; 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=By6LLmlNfpGYfC8hRJlbuluca2yelOebJvJPu9FgFiM=; b=l+DT2hFxDB7bAmO/78ZWDSb6qnZWfDv+6AB0oPkRmVv7XBQ3OxG3sGm3fngnV8ohoD uNo2xXQEuOCz1zkCw5aZqsLQS/R7+9Kzuvg2L6Cpk6ukE8LtHmZwTxNLUEWusdR+pFCf EPivnIiCz4RNM2T/4EwBfADfmsr5sppKI6j7uJtmFCMxQrDLNtAwGcVNmZhlg4KX2NLI l/j3Yi5ksLdOeQS5yrTaClJjdeBWvUY5wH0zca9xe7MuqDSzAyK+ErBuL6jRqXqsiEzc qtCzfoB/tbH2l0tcYXSmgu7iQPC8Y81arPWB/iEgC4y0eOsquvXffuVAjlrJcx1RyZn4 4gqQ== X-Gm-Message-State: AOJu0YxT5BUSVg6ggHOaJWGvuP/IFtLdG/gxzlyaAqWL2Qr1lrR1RyC+ 38DMU8DKZsJk9O4oYjw/Q/s66JyQ2cc92849UyLJK7Ey5oDT8bYFeyCox4RPuK1sW3KsIa8p+CQ x1k22 X-Google-Smtp-Source: AGHT+IH9rFCtqUbUiWfuhpGK9kZFzNZP8fTjt5qPjie6TRMLE2hnzKiW7bVVvREX47epqIY6Ej4fVg== X-Received: by 2002:a17:906:d261:b0:a86:80b7:4743 with SMTP id a640c23a62f3a-a90d4ffddf4mr125564466b.24.1726812189171; Thu, 19 Sep 2024 23:03:09 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:08 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 11/19] test: Tidy up remaining exceptions Date: Fri, 20 Sep 2024 08:01:46 +0200 Message-ID: <20240920060158.106612-12-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Use the new handle_exception() function from ConsoleBase also. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index fa87952694d..9474fa87ec9 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -14,7 +14,7 @@ import pytest import re import sys import u_boot_spawn -from u_boot_spawn import BootFail, Timeout, Unexpected +from u_boot_spawn import BootFail, Timeout, Unexpected, handle_exception # Regexes for text we expect U-Boot to send to the console. pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))') @@ -294,12 +294,12 @@ class ConsoleBase(object): # indentation. return self.p.before.strip('\r\n') except Timeout as exc: - self.log.error(str(exc)) - self.cleanup_spawn() + handle_exception(self.config, self, self.log, exc, 'Lab failure', + True) raise - except BootFail as ex: - self.log.error(str(ex)) - self.cleanup_spawn() + except BootFail as exc: + handle_exception(self.config, self, self.log, exc, 'Boot fail', + True, self.get_spawn_output()) raise finally: self.log.timestamp() From patchwork Fri Sep 20 06:01:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=TGRnrTpL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X921D75Xhz1y1t for ; Fri, 20 Sep 2024 16:05:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C8C189322; Fri, 20 Sep 2024 08:03:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TGRnrTpL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5D3B89352; Fri, 20 Sep 2024 08:03:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C64338931B for ; Fri, 20 Sep 2024 08:03:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x643.google.com with SMTP id a640c23a62f3a-a8d2b4a5bf1so216827366b.2 for ; Thu, 19 Sep 2024 23:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812191; x=1727416991; darn=lists.denx.de; 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=vXPlOCgA7okDoOhPwqE7tTmVSprBKANestEkAk1EHnc=; b=TGRnrTpL125YMSB7k5BIB+68G6X7As7KAxdD9cX2v/SF4jtcBSUYeYPBIU8zf3Q0GG dW8QYwRFW0COrTdhSoqLdqe/sJaNrgJw1iB2Yuh0AU3upEYcmxAdYRnprj70KaQS7Z2T 4j7BfteKOS8JDm1HmXAfo080EkrPlO7GLnE7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812191; x=1727416991; 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=vXPlOCgA7okDoOhPwqE7tTmVSprBKANestEkAk1EHnc=; b=Xz9N0CoCJH/t8YVQ1gDXXFUt5cocuGVHpQJev2BXUT0Dyy8OmxdzP+0BTuyQXxxlU2 1qok+qO8KfFQP125c4CiX37VzQZd6M1Z2omohBnDvSSiBhyjme5BgV4NMKhEHJa810ZU /zbtBn0GEnTm/1yGQSCqETNR8CdssEQ+DLJZpGQpL9G0uvvjyd95vd3Z9s967FpU/I4b vsrIlhg7dnXcUw2by5Q8phAaTWUy1lmB7SMYGWhdocPhFWiUZb5H0RlWZrEaD6laEwNE 0tLg/GqidsLP3/yW+4aCCmsPvH6cMrJyxqiuvNnbaPz6LKG1JXozgUUFfg6roiCCP03X mrEA== X-Gm-Message-State: AOJu0YybxXOlpusGl59R5plh8GdLBw8fBrNd+uSSzP7YaYZc5+q31RZm fhPsLt8WAGrrd9C4SnnH+JS1yq3Leqq7NQeNb7ny0KPdIbgNWiavgsZOF3fv7Pqv45NPvLX3Ju7 n+k5YlqU= X-Google-Smtp-Source: AGHT+IHKjSoppQ0bdJFlN/3g322WmMH9ffPsqn6aPD9JZHIzKXjdR21vxjTdskd7tsXq3GyN0KRNoA== X-Received: by 2002:a17:906:c103:b0:a7a:be06:d8eb with SMTP id a640c23a62f3a-a90d5152147mr146142966b.53.1726812190843; Thu, 19 Sep 2024 23:03:10 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:09 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 12/19] test: Introduce lab mode Date: Fri, 20 Sep 2024 08:01:47 +0200 Message-ID: <20240920060158.106612-13-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is quite a bit of code in pytest to try to start up U-Boot on a board, with timeouts, expects, etc. This is tedious to maintain and is peripheral to the test system's purpose. It seems better to put this logic in the lab itself, where is can provide such support. With Labgrid we can use the UbootStrategy class to get the board into a useful state, however it needs to do it. Then it can report to pytest by writing a suitable string along with the U-Boot version it detected. Add support for detecting 'lab mode' and simply assume that all is well in that case. Collect the version string when Labgrid says it is ready. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 68 ++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index 9474fa87ec9..bcba68f0aac 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -23,13 +23,21 @@ pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ') pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'') pattern_error_notification = re.compile('## Error: ') pattern_error_please_reset = re.compile('### ERROR ### Please RESET the board ###') -pattern_ready_prompt = re.compile('U-Boot is ready') +pattern_ready_prompt = re.compile('{lab ready in (.*)s: (.*)}') +pattern_lab_mode = re.compile('{lab mode.*}') PAT_ID = 0 PAT_RE = 1 # Timeout before expecting the console to be ready (in milliseconds) -TIMEOUT_MS = 30000 +TIMEOUT_MS = 30000 # Standard timeout + +# Timeout for board preparation in lab mode. This needs to be enough to build +# U-Boot, write it to the board and then boot the board. Since this process is +# under the control of another program (e.g. Labgrid), it will failure sooner +# if something goes way. So use a very long timeout here to cover all possible +# situations. +TIMEOUT_PREPARE_MS = 3 * 60 * 1000 bad_pattern_defs = ( ('spl_signon', pattern_u_boot_spl_signon), @@ -143,6 +151,7 @@ class ConsoleBase(object): self.at_prompt = False self.at_prompt_logevt = None + self.lab_mode = False def get_spawn(self): # This is not called, ssubclass must define this. @@ -176,40 +185,69 @@ class ConsoleBase(object): self.p.close() self.logstream.close() + def set_lab_mode(self): + """Select lab mode + + This tells us that we will get a 'lab ready' message when the board is + ready for use. We don't need to look for signon messages. + """ + self.log.info(f'test.py: Lab mode is active') + self.p.timeout = TIMEOUT_PREPARE_MS + self.lab_mode = True + def wait_for_boot_prompt(self, loop_num = 1): """Wait for the boot up until command prompt. This is for internal use only. """ try: + self.log.info('Waiting for U-Boot to be ready') bcfg = self.config.buildconfig config_spl_serial = bcfg.get('config_spl_serial', 'n') == 'y' env_spl_skipped = self.config.env.get('env__spl_skipped', False) env_spl_banner_times = self.config.env.get('env__spl_banner_times', 1) - while loop_num > 0: + while not self.lab_mode and loop_num > 0: loop_num -= 1 while config_spl_serial and not env_spl_skipped and env_spl_banner_times > 0: - m = self.p.expect([pattern_u_boot_spl_signon] + - self.bad_patterns) - if m != 0: + m = self.p.expect([pattern_u_boot_spl_signon, + pattern_lab_mode] + self.bad_patterns) + if m == 1: + self.set_lab_mode() + break + elif m != 0: raise BootFail('Bad pattern found on SPL console: ' + - self.bad_pattern_ids[m - 1]) + self.bad_pattern_ids[m - 1]) env_spl_banner_times -= 1 - m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns) - if m != 0: - raise BootFail('Bad pattern found on console: ' + - self.bad_pattern_ids[m - 1]) - self.u_boot_version_string = self.p.after + if not self.lab_mode: + m = self.p.expect([pattern_u_boot_main_signon, + pattern_lab_mode] + self.bad_patterns) + if m == 1: + self.set_lab_mode() + elif m != 0: + raise BootFail('Bad pattern found on console: ' + + self.bad_pattern_ids[m - 1]) + if not self.lab_mode: + self.u_boot_version_string = self.p.after while True: m = self.p.expect([self.prompt_compiled, pattern_ready_prompt, pattern_stop_autoboot_prompt] + self.bad_patterns) - if m == 0 or m == 1: + if m == 0: + self.log.info(f'Found ready prompt {m}') + break + elif m == 1: + m = pattern_ready_prompt.search(self.p.after) + self.u_boot_version_string = m.group(2) + self.log.info(f'Lab: Board is ready') + self.p.timeout = TIMEOUT_MS break if m == 2: + self.log.info(f'Found autoboot prompt {m}') self.p.send(' ') continue - raise BootFail('Bad pattern found on console: ' + - self.bad_pattern_ids[m - 3]) + if not self.lab_mode: + raise BootFail('Missing prompt / ready message on console: ' + + self.bad_pattern_ids[m - 3]) + self.log.info(f'U-Boot is ready') finally: self.log.timestamp() From patchwork Fri Sep 20 06:01:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=F/z7i8ls; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X921s39bxz1y1t for ; Fri, 20 Sep 2024 16:05:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 402D389364; Fri, 20 Sep 2024 08:03:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="F/z7i8ls"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7FCA989347; Fri, 20 Sep 2024 08:03:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 900E6890EC for ; Fri, 20 Sep 2024 08:03:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x643.google.com with SMTP id a640c23a62f3a-a8a6d1766a7so217852166b.3 for ; Thu, 19 Sep 2024 23:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812192; x=1727416992; darn=lists.denx.de; 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=RA+IK6furIdHpwKyxL6ZnfkZ/RC/QHx1NGwdCVA3AY4=; b=F/z7i8lstEYXCSUC1ZHDeS6jS3eVYf9Kf/oSgZMt9GoIU8c9NFWoy9MZkPyPcZwIi2 V+qCR34Amfk2goXfk7s7lmU6XbqV3bfdTgBgy6J8oszXyhVhbH5WASJoyNX2W/GdsPzS O+DNjetsoKZoDUkZNJM4r9oqo2bRghcnsqY8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812192; x=1727416992; 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=RA+IK6furIdHpwKyxL6ZnfkZ/RC/QHx1NGwdCVA3AY4=; b=CArQVGgGZYP4diP3LBjdK+SBnbsYKif5k07QVN9lplTTULwI4+KcHyGHmVB3aLfNlW pOjrJnfLeatc+QjDeI+jEo0+CmcwCGOeUl+otVSzB0X+KqLt4OtD6RfmfBJ5PltSspcg t8Hx3Peuu42pChcWO4ym40BvfzJztJ/0JoCaJPaMHoozmepcjJ/t22+YRYBXtgq2vDE8 kLTBbkCJOYyaU8jecjXa/QNGd0BkxRtCJ6bDKN184P0dTP2TutjrKG1o5Hg0fZtdNX2v 37oXXBzP4By4LvAXX4HNf6jMYBl/vYK51MDAU8agUTr4Xdmef/R84ibNVmO33jzCILtD oiSQ== X-Gm-Message-State: AOJu0YzEMc6bVLB/+pLzdxwtvBpsgHSvSgJrouEvaTRT8ypi67l5Dg+i Ti1UoYj/IgZnpDzCBlkdM1UWZ1BIJwMVJu+dtHj5REr/n9idm8K8yZeZCeS0Z2cdYvLPOrzqR/s 37SNyybU= X-Google-Smtp-Source: AGHT+IEHISF7QatKETm+8cjJa31ORvTz3Y75NLxisyaU4EaRv4BYma4s8MRIzerzzfm4VIdcDuEaUA== X-Received: by 2002:a17:906:d7e4:b0:a8d:4d76:a760 with SMTP id a640c23a62f3a-a90d5005e9cmr109386766b.35.1726812191777; Thu, 19 Sep 2024 23:03:11 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:11 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 13/19] test: Improve handling of sending commands Date: Fri, 20 Sep 2024 08:01:48 +0200 Message-ID: <20240920060158.106612-14-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean We expect commands to be echoed and this should happen quite quickly, since U-Boot is sitting at the prompt waiting for a command. Reduce the timeout for this situation. Try to produce a more useful error message when something goes wrong. Also handle the case where the connection has gone away since the last command was issued. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 35 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index bcba68f0aac..e2e78179555 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -31,6 +31,7 @@ PAT_RE = 1 # Timeout before expecting the console to be ready (in milliseconds) TIMEOUT_MS = 30000 # Standard timeout +TIMEOUT_CMD_MS = 10000 # Command-echo timeout # Timeout for board preparation in lab mode. This needs to be enough to build # U-Boot, write it to the board and then boot the board. Since this process is @@ -300,22 +301,28 @@ class ConsoleBase(object): try: self.at_prompt = False + if not self.p: + raise BootFail( + f"Lab failure: Connection lost when sending command '{cmd}'") + if send_nl: cmd += '\n' - while cmd: - # Limit max outstanding data, so UART FIFOs don't overflow - chunk = cmd[:self.max_fifo_fill] - cmd = cmd[self.max_fifo_fill:] - self.p.send(chunk) - if not wait_for_echo: - continue - chunk = re.escape(chunk) - chunk = chunk.replace('\\\n', '[\r\n]') - m = self.p.expect([chunk] + self.bad_patterns) - if m != 0: - self.at_prompt = False - raise BootFail('Bad pattern found on console: ' + - self.bad_pattern_ids[m - 1]) + rem = cmd # Remaining to be sent + with self.temporary_timeout(TIMEOUT_CMD_MS): + while rem: + # Limit max outstanding data, so UART FIFOs don't overflow + chunk = rem[:self.max_fifo_fill] + rem = rem[self.max_fifo_fill:] + self.p.send(chunk) + if not wait_for_echo: + continue + chunk = re.escape(chunk) + chunk = chunk.replace('\\\n', '[\r\n]') + m = self.p.expect([chunk] + self.bad_patterns) + if m != 0: + self.at_prompt = False + raise BootFail(f"Failed to get echo on console (cmd '{cmd}':rem '{rem}'): " + + self.bad_pattern_ids[m - 1]) if not wait_for_prompt: return if wait_for_reboot: From patchwork Fri Sep 20 06:01:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987650 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=g3fB1rCY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X921S2vbTz1y1t for ; Fri, 20 Sep 2024 16:05:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 896E88932B; Fri, 20 Sep 2024 08:03:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="g3fB1rCY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CAD18931B; Fri, 20 Sep 2024 08:03:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6E5138935C for ; Fri, 20 Sep 2024 08:03:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x544.google.com with SMTP id 4fb4d7f45d1cf-5c42bcf35fbso2198815a12.1 for ; Thu, 19 Sep 2024 23:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812194; x=1727416994; darn=lists.denx.de; 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=gCbLUUK7oFu4ayaP9AEMNud9vWUxtGMyqzJTRPDFw+g=; b=g3fB1rCY+biOP66gtYHvnZLHnD8WL6U6kBE/clafx//PQBlew8EDo5ItJy3OQCeRrc OyZSpdzDXwY8nS/ZgcsB9lf3MndFkMalqxMl6Shy3UwYxs+mLK7anojZqgyMGoKXZyA9 fCEta9e0la3FtHH9gjeP2f5m40nbh+Vbm22Ps= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812194; x=1727416994; 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=gCbLUUK7oFu4ayaP9AEMNud9vWUxtGMyqzJTRPDFw+g=; b=Bwp/PE6HQxub2o7KnZMZprACwuiJEvhl+MBqIKT+5o1qDi7tNHmYImsn9wfc0Hl2F6 hvcqjuQNBhkXNJVdlrAnxWNoLf9H8sHFbjFFKCuDhJZ60dpV4HOpa7rakjsFMUOhoaQl vMQpKmzgV19Y72FUduekTr3776LPq4U8FD+Y4L9urtGxXoEDJ8HSzT9EYkSuWZy5hRiV itnaLKxiw5gEEfUWiPFDswMf9hR4TsilY8rswLCWYzxRB4bMT2A13tfUm/hUR4m7cTSK ZtgvB2ddJacjiS7zyd4zjsAAPqz5CFzqmM13VZQ1pot5EoEfRquV5JGmM5A6iitj1FVs xpyA== X-Gm-Message-State: AOJu0YwObPgY8SQ/m7TwaMWHXvpL0eSPbkVMOaLP7ypTqNXkVWI2v9Qz xHy0ZjxD9TuaQt72Xh1Of7PZQYflcgSV0lsble4LkfUMpCnXsD6TBNuL4Sdwfhjd8wbmEz6vier 4/QDMHhk= X-Google-Smtp-Source: AGHT+IHoKHqPXkaB9mct2ivWDYlufOWHNLvEbzMMqfF+sPZoXXnqA2byxgu4t798dR3kW4mGUCQRUg== X-Received: by 2002:a17:906:bc2a:b0:a86:8ff8:1dd8 with SMTP id a640c23a62f3a-a90d50d033bmr127643766b.46.1726812193553; Thu, 19 Sep 2024 23:03:13 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:13 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 14/19] test: Fix mulptiplex_log typo Date: Fri, 20 Sep 2024 08:01:49 +0200 Message-ID: <20240920060158.106612-15-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Fix a typo in a comment. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index e2e78179555..f610fa9a6f8 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -123,7 +123,7 @@ class ConsoleBase(object): Can only usefully be called by sub-classes. Args: - log: A mulptiplex_log.Logfile object, to which the U-Boot output + log: A multiplexed_log.Logfile object, to which the U-Boot output will be logged. config: A configuration data structure, as built by conftest.py. max_fifo_fill: The maximum number of characters to send to U-Boot From patchwork Fri Sep 20 06:01:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ZKnzUBmX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X921g2hKJz1y1t for ; Fri, 20 Sep 2024 16:05:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF3BA89352; Fri, 20 Sep 2024 08:03:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZKnzUBmX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4754389344; Fri, 20 Sep 2024 08:03:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5C4CA89364 for ; Fri, 20 Sep 2024 08:03:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5c42f406e29so2307591a12.2 for ; Thu, 19 Sep 2024 23:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812194; x=1727416994; darn=lists.denx.de; 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=quscNm6Hn/z4QlYQZsIFpeCsWpcCzLQcJZ+ltoHI9r0=; b=ZKnzUBmX0aWuz1+fxeFE0rImUWq3O+DdTQtcH1QmaX82W2YMgT/FrCTnZ0WktrHb4w /Dp+Q6cAz00VuD0OEQlOtbmsq7mnIsUIW1Sr98g4hdghEsVoubrSEJsK/HELGsMW3WhD 5chn4f4oAlYpok2x9qqyCrIZ9ce9HYgFwWMsM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812194; x=1727416994; 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=quscNm6Hn/z4QlYQZsIFpeCsWpcCzLQcJZ+ltoHI9r0=; b=sM/WvUixvUDxwuEmraYhY4wsHyFsVdA+b8n+ddoMA8J4LJWZ0Emdbmbu+PtXQTFEja Ak/b6dcjlacZic2nhPRIi/xYMgmNHBEKr2R2m5su8BB2akq825GhHHBR5r5JWI+V3xsO igmWgvlHAIdP0Z2RSHAfHoQcCXGMzzpAJeLDz/E0aJDQUE6zBbqRD/2zO+x9Jyk21EsI H7/+OBDWt7LFb9Y89toToJx19p5rEThnj90kUTSLKeMGwmPmX5QT274FFjwbaOanaqf5 iUB1o3VaWu62WWRFhqoxVGbvbW9aoY7b6zQj8nEEH43v5v9fwglxOIHHCVRvXULCCuB+ UVhw== X-Gm-Message-State: AOJu0YwR8SFLOpWOFtXSnrUKjjhTtLmFC7doWgNxO2KqfGzrekQhm2nP OYztTd5LmGT7m3hisLK74RTa9FACnbNqTXvsrxtG5JOIuXNW5HUS6ZtZGvD39Y4JCeUOj6Ej8iB 7icWw X-Google-Smtp-Source: AGHT+IGuiBovTRPQQ7W5Y+0kTnsjwBBhfo/pdGRNfm4fCRlKrQvQ6ZEx8ZPgpL1xkgcefubw4ypIPQ== X-Received: by 2002:a17:907:d592:b0:a8b:6ee7:ba10 with SMTP id a640c23a62f3a-a90d5034026mr118931366b.33.1726812194545; Thu, 19 Sep 2024 23:03:14 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:14 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 15/19] test: Avoid double echo when starting up Date: Fri, 20 Sep 2024 08:01:50 +0200 Message-ID: <20240920060158.106612-16-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is a very annoying bug at present where the terminal echos part of the first command sent to the board. This happens because the terminal is still set to echo for a period until Labgrid starts up and can change this. Fix this by disabling echo (and other terminal features) as soon as the spawn happens. Signed-off-by: Simon Glass --- Changes in v6: - Rebase without an earlier patch Changes in v2: - Only disable echo if a terminal is detected test/py/u_boot_spawn.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index 24d369035e5..f2398098a00 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -11,6 +11,8 @@ import pty import pytest import signal import select +import sys +import termios import time import traceback @@ -115,11 +117,23 @@ class Spawn: finally: os._exit(255) + old = None try: + if os.isatty(sys.stdout.fileno()): + new = termios.tcgetattr(self.fd) + old = new + new[3] = new[3] & ~(termios.ICANON | termios.ISIG) + new[3] = new[3] & ~termios.ECHO + new[6][termios.VMIN] = 0 + new[6][termios.VTIME] = 0 + termios.tcsetattr(self.fd, termios.TCSANOW, new) + self.poll = select.poll() self.poll.register(self.fd, select.POLLIN | select.POLLPRI | select.POLLERR | select.POLLHUP | select.POLLNVAL) except: + if old: + termios.tcsetattr(self.fd, termios.TCSANOW, old) self.close() raise From patchwork Fri Sep 20 06:01:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987653 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ka0zC0nr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X92235ZRYz1y1t for ; Fri, 20 Sep 2024 16:06:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9AB7289333; Fri, 20 Sep 2024 08:03:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ka0zC0nr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D6CC8934D; Fri, 20 Sep 2024 08:03:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3999A89339 for ; Fri, 20 Sep 2024 08:03:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2f761461150so21495931fa.0 for ; Thu, 19 Sep 2024 23:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812196; x=1727416996; darn=lists.denx.de; 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=Na9NQaRU+c9ltxSdfUWS5gr1rU9boPQoG351BVgWt/o=; b=ka0zC0nr9+xScfOPIAeSQNBTp06bDKZER+zEaWhKMbzOEytEJJtfnu+nx55+PQ4qwQ j9KmrQuEQCcbNbLZpfZKR4R4e1Aw2PzZUDS6q0cJVGKMYSP/uiA4/txPI2G6JJHwpsZf o1YQc5JJMzq4s2zfJDwF+ZuqhrjI+qxH/NGSg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812196; x=1727416996; 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=Na9NQaRU+c9ltxSdfUWS5gr1rU9boPQoG351BVgWt/o=; b=T+uJ8DfucW+zGog1LryQf9McCXPfJl3FCesYASXnZbpeKMGAXk3n5/d7c4HZsMRh/v YH5FBw5JKMpShpwNsh0uYqOaLzT+22HBqo8pRnOyaAYbsS205DTvfoeRyuhYTyACCbUr DtOu6sWWhDb0J94CjW2FASCrmM023LskVhqqu7eX+spFuZvV1ILt1v2UP4QWT/Sh2Rw7 0xm+0KOsuJEl85d2AWhlc/0icUuJhkB2CqPcTJs1vEkybPFHUHIG9y8BOzN3cG4gUeL5 fSZuc9sK33NACnM3cqF7SCm2zuevKWldIn3k8bnYG805jNHBOKla9i5hKpYJjy61IXCB Xw5g== X-Gm-Message-State: AOJu0YzH8udM/XyWNwxLYs+7lAGz5/9QyoDfWwe4eJI5UCMRC1E+u4g6 9daILq1wYhU6phgoz/nTxU2ldAeLpIySphh3QIpTGQQ3icxwFjDhWgyW5URqorZhE/YC2QqyMz/ XLu/8 X-Google-Smtp-Source: AGHT+IFAf5rk+m28b996R3Fl7z4IOLjfmg98OkIlIdghYt0rhQFTHTE1YwIoJgPwGovydeJUpKxfhQ== X-Received: by 2002:a2e:a4b6:0:b0:2f7:4c9d:7a8c with SMTP id 38308e7fff4ca-2f7cb358d8amr10860471fa.29.1726812195800; Thu, 19 Sep 2024 23:03:15 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:15 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 16/19] test: Try to shut down the lab console gracefully Date: Fri, 20 Sep 2024 08:01:51 +0200 Message-ID: <20240920060158.106612-17-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Send the Labgrid quit characters to ask it to exit gracefully. This typically allows it to power off the board being used. Only do this when labgrid is being used (detected with an env var). If that doesn't work, try the less graceful approach. Signed-off-by: Simon Glass --- Changes in v6: - Avoid doing the special shutdown unless USE_LABGRID is enabled test/py/u_boot_spawn.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index f2398098a00..72d3d5e77b1 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -16,6 +16,9 @@ import termios import time import traceback +# Character to send (twice) to exit the terminal +EXIT_CHAR = 0x1d # FS (Ctrl + ]) + class Timeout(Exception): """An exception sub-class that indicates that a timeout occurred.""" @@ -303,15 +306,28 @@ class Spawn: None. Returns: - Nothing. + str: Type of closure completed """ - + # For Labgrid, ask it is exit gracefully, so it can transition the board + # to the final state (like 'off') before exiting. + if os.environ.get('USE_LABGRID'): + self.send(chr(EXIT_CHAR) * 2) + + # Wait about 10 seconds for Labgrid to close and power off the board + for _ in range(100): + if not self.isalive(): + return 'normal' + time.sleep(0.1) + + # That didn't work, so try closing the PTY os.close(self.fd) for _ in range(100): if not self.isalive(): - break + return 'break' time.sleep(0.1) + return 'timeout' + def get_expect_output(self): """Return the output read by expect() From patchwork Fri Sep 20 06:01:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=mFH8udrB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X922G4zlTz1y1t for ; Fri, 20 Sep 2024 16:06:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0A668934E; Fri, 20 Sep 2024 08:03:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mFH8udrB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AC3128934E; Fri, 20 Sep 2024 08:03:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C550F890EC for ; Fri, 20 Sep 2024 08:03:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x643.google.com with SMTP id a640c23a62f3a-a8d4093722bso225665466b.0 for ; Thu, 19 Sep 2024 23:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812197; x=1727416997; darn=lists.denx.de; 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=GpGPzOOCYQ/vCo6VwUV8dBYiESDG7tZZGy/7UH0RUWU=; b=mFH8udrBY2AGWAzMLTXSr3RqronHiqh1II6aQgUL61cVpsWsW/rPhJHPeJ0js7gxix IfR6QGFRaGC5oP4QxTkFLtNwywFXJugpt3hvSrrgUogvrzgSe2OMfcrR3kefJNPO5CVC JpXm0eEZG1qpIC7TJN3dfUeYV6BuCAFzoHMb8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812197; x=1727416997; 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=GpGPzOOCYQ/vCo6VwUV8dBYiESDG7tZZGy/7UH0RUWU=; b=OtiUoyeovkdR4TJsA78g20n3gXd8KSZYy86voj4SJrUOObal2QOXWrHmWQkohzd94T hOCR0ovnkP62du64QKH8DQHY/RtWZb8H3CJVdolck0Lq9ke/J3R4/ymRAutYDxL/Q1Vc sK8pldH2OcoMctDkaEprmoXNHyO4NpGXwPq4a2Aj6t1NZbg4tvOGcjMwlNiOtOpJ8JhE nExhwz4lGO5E7uBCDlZA75HeojjT/plgl+IL/YivSs0MhbESf7WgI80MF+o/hm91Z8O0 yJq0Q+I7Ms9xKqBUYo0oBvVjBp1FiAYa35AX/eokDgKkl/hTXMdsDTnjTnhtfS9cA8/X V0qA== X-Gm-Message-State: AOJu0YyBb3kYZmKFb6cKC/6n1VKVXgrGcZ5xMw24DVYQK4gKJUYOjc9c mn8kcTNj10LySOj0cBE8CiKHdUi1QePI668fJgLZHncsEb5haqxaBYBZ9YF1zwjYRlJaABHc167 Z8dxJLFs= X-Google-Smtp-Source: AGHT+IEljbTXPUFjcnhfSZ+8qlxAis3HsdUYrXVxAUP+m4fC8UwsQS6iHMc4Ff0Q9yaWZm/7gjFSGA== X-Received: by 2002:a17:907:c894:b0:a8a:822e:44c6 with SMTP id a640c23a62f3a-a90d55e1025mr132588966b.4.1726812197023; Thu, 19 Sep 2024 23:03:17 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:16 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 17/19] test: Add a section for closing the connection Date: Fri, 20 Sep 2024 08:01:52 +0200 Message-ID: <20240920060158.106612-18-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This can take a while and involve multiple steps (e.g. turning the board back off). Add a section for it and show the output. Signed-off-by: Simon Glass --- (no changes since v1) test/py/u_boot_console_base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index f610fa9a6f8..b279d95dea0 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -183,7 +183,10 @@ class ConsoleBase(object): """ if self.p: - self.p.close() + self.log.start_section('Stopping U-Boot') + close_type = self.p.close() + self.log.info(f'Close type: {close_type}') + self.log.end_section('Stopping U-Boot') self.logstream.close() def set_lab_mode(self): From patchwork Fri Sep 20 06:01:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=CP4++zh0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X922T0nmsz1y1t for ; Fri, 20 Sep 2024 16:06:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 57A5E8936D; Fri, 20 Sep 2024 08:03:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CP4++zh0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0242E89369; Fri, 20 Sep 2024 08:03:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E90F689347 for ; Fri, 20 Sep 2024 08:03:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-lf1-x142.google.com with SMTP id 2adb3069b0e04-5365392cfafso1690369e87.0 for ; Thu, 19 Sep 2024 23:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812198; x=1727416998; darn=lists.denx.de; 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=NO/lobEVmaIsrGcEREu4l9gt2Ln1qG3zFc1IWMBYUvg=; b=CP4++zh0y2+wg6+vC4mqr/DaAjK8viBrm4iFGmynSwNoMfl4sYP0iUzB62B7h/ld9f 0CO4gS+gQmYATmZ6gfLzPQ5OaupsF4m20t247hX2vSlZVJR04r6K/JBd0wNybnzwA0Lt aBYsqinvkeqpytIbUlgbGSQ08LKssWKK6JXcg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812198; x=1727416998; 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=NO/lobEVmaIsrGcEREu4l9gt2Ln1qG3zFc1IWMBYUvg=; b=URmaC55S5wb7F/ENfUGg7ZEdNeuQ0YGoOfA6C1enzlPQMxSnMGa5Fk1/g1saEGdJmP Hyd84NKSn05X/7/AiV5xPjdy0qaUx93bO0kwk3t6ba3nZi0M+AjSF4Xc+v0gS8pkC+7U qOJ/ezAcqNSoGqJlNaO7JhV9m6j9RpjEmskKPCdujmHrDPYyunqz54B4Z4OEq6+QJXGE HOE3RHb5ws97wVvCjkXUKciU+VPiMBdnEJmtCvhWQts04cS3AoaSGKYFgTXbFfqfoB2H VghR4C3rd+lPLLRWV3Q+wS4cnPeWw2alBjkmNJZD/qXvwVzDz1Ej5iNfQBBZ9yASPfdP 0RtQ== X-Gm-Message-State: AOJu0Yy3Z7gh/mwFoaWc8qps1pdy/l0t1slXqB+6DVh2INuHX9yziaTR DllWKbVAsEmUSCDnTvJcN0pW0Qrpf6TIU3Yu+Z0cxh7d/cg2kXIVolnrL8sX5T7P/I2rsJ5u9w4 SgZ7GtLM= X-Google-Smtp-Source: AGHT+IGSh3ALLKFl08E8O+8xDEcD+qEQaZmprww9uWcjq1+oI6hCKqKYHag01/eHZYdV9h5ONCIjAw== X-Received: by 2002:a05:6512:1293:b0:535:82eb:21d1 with SMTP id 2adb3069b0e04-536ac34094fmr836993e87.57.1726812197865; Thu, 19 Sep 2024 23:03:17 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:17 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v6 18/19] test: Support testing with two board-builds Date: Fri, 20 Sep 2024 08:01:53 +0200 Message-ID: <20240920060158.106612-19-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The Beagleplay board uses two entirely separate builds to produce an image, rather than using an SPL build for this purpose. Handle this in test.py by adding more parameters. Signed-off-by: Simon Glass --- (no changes since v5) Changes in v5: - Add a patch to support testing with two board-builds test/py/conftest.py | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/test/py/conftest.py b/test/py/conftest.py index 9eea65b5929..542c0d53e46 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -66,12 +66,16 @@ def pytest_addoption(parser): parser.addoption('--build-dir', default=None, help='U-Boot build directory (O=)') + parser.addoption('--build-dir-extra', default=None, + help='U-Boot build directory for extra build (O=)') parser.addoption('--result-dir', default=None, help='U-Boot test result/tmp directory') parser.addoption('--persistent-data-dir', default=None, help='U-Boot test persistent generated data directory') parser.addoption('--board-type', '--bd', '-B', default='sandbox', help='U-Boot board type') + parser.addoption('--board-type-extra', '--bde', default='sandbox', + help='U-Boot extra board type') parser.addoption('--board-identity', '--id', default='na', help='U-Boot board identity/instance') parser.addoption('--build', default=False, action='store_true', @@ -129,14 +133,17 @@ def get_details(config): Returns: tuple: str: Board type (U-Boot build name) + str: Extra board type (where two U-Boot builds are needed) str: Identity for the lab board str: Build directory + str: Extra build directory (where two U-Boot builds are needed) str: Source directory """ role = config.getoption('role') # Get a few provided parameters build_dir = config.getoption('build_dir') + build_dir_extra = config.getoption('build_dir_extra') if role: # When using a role, build_dir and build_dir_extra are normally not set, # since they are picked up from Labgrid via the u-boot-test-getrole @@ -146,6 +153,8 @@ def get_details(config): env = os.environ.copy() if build_dir: env['U_BOOT_BUILD_DIR'] = build_dir + if build_dir_extra: + env['U_BOOT_BUILD_DIR_EXTRA'] = build_dir_extra proc = subprocess.run(cmd, capture_output=True, encoding='utf-8', env=env) if proc.returncode: @@ -159,24 +168,36 @@ def get_details(config): vals[k] = value # For debugging # print('conftest: lab info:', vals) - board_type, default_build_dir, source_dir = (vals['board'], - vals['build_dir'], vals['source_dir']) + + # Read the build directories here, in case none were provided in the + # command-line arguments + (board_type, board_type_extra, default_build_dir, + default_build_dir_extra, source_dir) = (vals['board'], + vals['board_extra'], vals['build_dir'], vals['build_dir_extra'], + vals['source_dir']) else: board_type = config.getoption('board_type') + board_type_extra = config.getoption('board_type_extra') board_identity = config.getoption('board_identity') source_dir = os.path.dirname(os.path.dirname(TEST_PY_DIR)) default_build_dir = source_dir + '/build-' + board_type + default_build_dir_extra = source_dir + '/build-' + board_type_extra + + # Use the provided command-line arguments if present, else fall back to if not build_dir: build_dir = default_build_dir + if not build_dir_extra: + build_dir_extra = default_build_dir_extra - return board_type, board_identity, build_dir, source_dir + return (board_type, board_type_extra, board_identity, build_dir, + build_dir_extra, source_dir) def pytest_xdist_setupnodes(config, specs): """Clear out any 'done' file from a previous build""" global build_done_file - build_dir = get_details(config)[2] + build_dir = get_details(config)[3] build_done_file = Path(build_dir) / 'build.done' if build_done_file.exists(): @@ -216,7 +237,8 @@ def pytest_configure(config): global console global ubconfig - board_type, board_identity, build_dir, source_dir = get_details(config) + (board_type, board_type_extra, board_identity, build_dir, build_dir_extra, + source_dir) = get_details(config) board_type_filename = board_type.replace('-', '_') board_identity_filename = board_identity.replace('-', '_') @@ -281,9 +303,11 @@ def pytest_configure(config): ubconfig.test_py_dir = TEST_PY_DIR ubconfig.source_dir = source_dir ubconfig.build_dir = build_dir + ubconfig.build_dir_extra = build_dir_extra ubconfig.result_dir = result_dir ubconfig.persistent_data_dir = persistent_data_dir ubconfig.board_type = board_type + ubconfig.board_type_extra = board_type_extra ubconfig.board_identity = board_identity ubconfig.gdbserver = gdbserver ubconfig.no_prompt_wait = config.getoption('no_prompt_wait') @@ -292,10 +316,12 @@ def pytest_configure(config): env_vars = ( 'board_type', + 'board_type_extra', 'board_identity', 'source_dir', 'test_py_dir', 'build_dir', + 'build_dir_extra', 'result_dir', 'persistent_data_dir', ) From patchwork Fri Sep 20 06:01:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1987657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=BN/D/cly; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X922v5ZLkz1y1t for ; Fri, 20 Sep 2024 16:06:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1ABEA8936C; Fri, 20 Sep 2024 08:03:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BN/D/cly"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F6E889325; Fri, 20 Sep 2024 08:03:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6939C89368 for ; Fri, 20 Sep 2024 08:03:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a8a7596b7dfso285924366b.0 for ; Thu, 19 Sep 2024 23:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726812200; x=1727417000; darn=lists.denx.de; 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=eqQqYmwLo8VJOpRZK6prjdAjRN7zknrT8ZToVOJUP1E=; b=BN/D/cly58L5LXbLm/n7xWFPnfJwLVahzeiOkO3iwMrUIQpW/wk1xwmMk3XpJakaRN F3eEW7h/qIe20Oxzus8vK9KMO1TelA6hZ9HqzrjvGK674b9ke8YhEr8gQgp2sojjHfpJ 0CW+LR7OvVoYeJg8UJnNwN//gta8LY/xYI8SU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726812200; x=1727417000; 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=eqQqYmwLo8VJOpRZK6prjdAjRN7zknrT8ZToVOJUP1E=; b=MOf3H2SG1qNI8ZvvaCaMceN01pmmJDf4CWcQiXUasrSzOzKXBeXweTnUAhWsmpnYK3 553bHxcum4FxLMLVfboZXLJ2aydCNyk6+b5TdH3OXCXKZ0GztMHasthk91gq38qJSqzA GaxzoxgnnVX6VpPKfzCy4cMyolQjznxjdJNyLwqq7tzpxcTj7+hQth25u9dRuTSgKx43 589p9zzt1MQsLI9x/yHrAzChgK7LScm4ya1su+J1OCztasSm5OqeNmTITQUYb+3/wkE+ QPLTAcbMF0eQFgxQuJrFEfNS73jL+mtaWSgSZqmkbB+JczfryMEJNMr3xxCVs3vgGwBP 1v8A== X-Gm-Message-State: AOJu0Yy3dKk105jETB/Ll/RMg5ENwT7F+WcCuYxLoE7IqDb1choVFL+X cByc5l+V06j+ysjZAJNedsGpvv5XBQ5+s6OgjgPVsdLZaXK7UBjGQmpzbEeUKCLBAEAKjc+BRsN OLhJm X-Google-Smtp-Source: AGHT+IGep1Qdr++Euyig9H41xgNSH8nBzwgMI5/yzZR48YrZopE/H81OHEPNKNDI07WnGCCD491MhQ== X-Received: by 2002:a17:907:3f9c:b0:a90:a9bd:1c36 with SMTP id a640c23a62f3a-a90d3557279mr202747666b.18.1726812199600; Thu, 19 Sep 2024 23:03:19 -0700 (PDT) Received: from chromium.org ([185.44.53.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df750sm796420666b.160.2024.09.19.23.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 23:03:19 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass , Andrejs Cainikovs Subject: [PATCH v6 19/19] CI: Allow running tests on sjg lab Date: Fri, 20 Sep 2024 08:01:54 +0200 Message-ID: <20240920060158.106612-20-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240920060158.106612-1-sjg@chromium.org> References: <20240920060158.106612-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a way to run tests on a real hardware lab. This is in the very early experimental stages. There are only 23 boards and 3 of those are broken! (bob, ff3399, samus). A fourth fails due to problems with the TPM tests. To try this, assuming you have gitlab access, set SJG_LAB=1, e.g.: git push -o ci.variable="SJG_LAB=1" dm HEAD:try This relies on the two previous series targeted at -next as well as the bugfix series for -master Signed-off-by: Simon Glass Reviewed-by: Andrejs Cainikovs --- Changes in v6: - Drop patch 'test: Pass stderr to stdout' Changes in v3: - Split out most patches into two new series and update cover letter Changes in v2: - Avoid running a docker image for skipped lab tests .gitlab-ci.yml | 153 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d621031b85..4d66e53b5b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ stages: - testsuites - test.py - world build + - sjg-lab .buildman_and_testpy_template: &buildman_and_testpy_dfn stage: test.py @@ -491,3 +492,155 @@ coreboot test.py: TEST_PY_TEST_SPEC: "not sleep" TEST_PY_ID: "--id qemu" <<: *buildman_and_testpy_dfn + +.lab_template: &lab_dfn + stage: sjg-lab + rules: + - if: $SJG_LAB == "1" + when: always + - when: manual + tags: [ 'lab' ] + script: + - if [[ -z "${SJG_LAB}" ]]; then + exit 0; + fi + # Environment: + # SRC - source tree + # OUT - output directory for builds + - export SRC="$(pwd)" + - export OUT="${SRC}/build/${BOARD}" + - export PATH=$PATH:~/bin + - export PATH=$PATH:/vid/software/devel/ubtest/u-boot-test-hooks/bin + + # Load it on the device + - ret=0 + - echo "role ${ROLE}" + - export strategy="-s uboot -e off" + # export verbose="-v" + - ${SRC}/test/py/test.py --role ${ROLE} --build-dir "${OUT}" + --capture=tee-sys -k "not bootstd"|| ret=$? + - U_BOOT_BOARD_IDENTITY="${ROLE}" u-boot-test-release || true + - if [[ $ret -ne 0 ]]; then + exit $ret; + fi + artifacts: + when: always + paths: + - "build/${BOARD}/test-log.html" + - "build/${BOARD}/multiplexed_log.css" + expire_in: 1 week + +rpi3: + variables: + ROLE: rpi3 + <<: *lab_dfn + +opi_pc: + variables: + ROLE: opi_pc + <<: *lab_dfn + +pcduino3_nano: + variables: + ROLE: pcduino3_nano + <<: *lab_dfn + +samus: + variables: + ROLE: samus + <<: *lab_dfn + +link: + variables: + ROLE: link + <<: *lab_dfn + +jerry: + variables: + ROLE: jerry + <<: *lab_dfn + +minnowmax: + variables: + ROLE: minnowmax + <<: *lab_dfn + +opi_pc2: + variables: + ROLE: opi_pc2 + <<: *lab_dfn + +bpi: + variables: + ROLE: bpi + <<: *lab_dfn + +rpi2: + variables: + ROLE: rpi2 + <<: *lab_dfn + +bob: + variables: + ROLE: bob + <<: *lab_dfn + +ff3399: + variables: + ROLE: ff3399 + <<: *lab_dfn + +coral: + variables: + ROLE: coral + <<: *lab_dfn + +rpi3z: + variables: + ROLE: rpi3z + <<: *lab_dfn + +bbb: + variables: + ROLE: bbb + <<: *lab_dfn + +kevin: + variables: + ROLE: kevin + <<: *lab_dfn + +pine64: + variables: + ROLE: pine64 + <<: *lab_dfn + +c4: + variables: + ROLE: c4 + <<: *lab_dfn + +rpi4: + variables: + ROLE: rpi4 + <<: *lab_dfn + +rpi0: + variables: + ROLE: rpi0 + <<: *lab_dfn + +snow: + variables: + ROLE: snow + <<: *lab_dfn + +pcduino3: + variables: + ROLE: pcduino3 + <<: *lab_dfn + +nyan-big: + variables: + ROLE: nyan-big + <<: *lab_dfn