From patchwork Mon Nov 4 22:45:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006568 X-Patchwork-Delegate: trini@ti.com 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=TrkvHyQW; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xj65M0d5mz1xxb for ; Tue, 5 Nov 2024 09:46:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 948C688F14; Mon, 4 Nov 2024 23:46:05 +0100 (CET) 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="TrkvHyQW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9CBF388F0C; Mon, 4 Nov 2024 23:46:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (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 7781588D29 for ; Mon, 4 Nov 2024 23:46:02 +0100 (CET) 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-io1-xd30.google.com with SMTP id ca18e2360f4ac-83a9ca86049so173334239f.0 for ; Mon, 04 Nov 2024 14:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760360; x=1731365160; 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=GkejL3D1kj/14ZBU97aYXLqujLRgHMh9ge7doZQ/Xpc=; b=TrkvHyQW0/43yMNfT0S15oAtRKt8yhd2eKbVtN+PJePIe3uBb8KVVA3TAX7/tsS45i BSdz4LB02ywxEE5w6jAwju2E5vlRunbnlJoW1FvgHct7c8YrxXxvdsU9xpmmHofFJpwK bDlHLAWNupVcRgCP/4VzJGNjZ+DE/tIBDAD+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760360; x=1731365160; 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=GkejL3D1kj/14ZBU97aYXLqujLRgHMh9ge7doZQ/Xpc=; b=KRGavVnp71isNR31QCVoYH+H6o/8iLkekO7W6KvaIbzc/2FjT/BHG4tIU2aMjfMAc8 zPiPEwfCeBpPmKuqB9FFlVe22/5BWE6D+QaGgcmKVcDu1oUXoOwqahRBk0NZvSwqIeFJ 2a0DkFiGCQePIKMwxb0Xt/xNBm2MQSqk9IW63yINAooeFQCmvS3IJUI8UzgnMi0DyQV1 ciabSzPfQTabqAEThyyv0qr5YUbU9wl7i6gWgn4gTuKOPr3Hm1z47WD3Vd+SQd+SaqdH +6JLHkJWNscTJlwVJ7EsMRJYsKBKbBBvw5Vf3F03lO/jvY0IQzR3OZf/AxJyDn773Nhc TFPw== X-Gm-Message-State: AOJu0Yyb5F7a6AIRGQwDMTzD0g3+gOEBYepqd7nvRHl/dN5VPQxaG2rx EBfm3aNgb408LcSgQRHp1CU6ihNaL82vDT1F1JnB82iH/y6vmhrA4uL7NZ5QNiPlUTbqxr9B4AM = X-Google-Smtp-Source: AGHT+IGDHnPWM0dkB7g6gQzGPS7Gm9tkpGEwOwklp6w0D9N+1Qft30U3zCWCvxcNzIVUw7muVUeXjA== X-Received: by 2002:a05:6e02:2407:b0:3a6:bf1a:17d5 with SMTP id e9e14a558f8ab-3a6bf1a1e61mr95766315ab.0.1730760360618; Mon, 04 Nov 2024 14:46:00 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:45:59 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Love Kumar Subject: [PATCH v8 01/11] test: Allow signaling that U-Boot is ready Date: Mon, 4 Nov 2024 15:45:28 -0700 Message-ID: <20241104224550.677442-2-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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. Note that this does not change pytest, which still (also) looks for the U-Boot banner. This change merely makes it possible for pytest to believe Labgrid when it says that the board is ready for use. In several cases, the board starts up and Labgrid receives some initial output, then pytest starts and misses some of that output, because it came in while Labgrid had the console open. Then pytest fails because it doesn't see the expected banners. With this change, Labgrid handles getting U-Boot to a prompt, in a fully reliable manner. Then pytest starts up and can simply start running its tests. But, again, this does not prevent pytest from handling a banner if one is provided (e.g. if not using the Labgrid integration). Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- (no changes since v7) Changes in v7: - Rebase on testb series - Expand commit message 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 d8d0bdf9fd4..965832a4989 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -23,6 +23,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 @@ -200,15 +201,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 BootFail('Bad pattern found on console: ' + - self.bad_pattern_ids[m - 2]) + self.bad_pattern_ids[m - 3]) finally: self.log.timestamp() From patchwork Mon Nov 4 22:45:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006569 X-Patchwork-Delegate: trini@ti.com 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=jtJVozdu; 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 4Xj65V5nh6z1xxb for ; Tue, 5 Nov 2024 09:46:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB32088F77; Mon, 4 Nov 2024 23:46:08 +0100 (CET) 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="jtJVozdu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 532B288FB3; Mon, 4 Nov 2024 23:46:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (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 2C5EF88D29 for ; Mon, 4 Nov 2024 23:46:05 +0100 (CET) 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-io1-xd2c.google.com with SMTP id ca18e2360f4ac-83ab21c26f1so194425639f.2 for ; Mon, 04 Nov 2024 14:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760363; x=1731365163; 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=ZmqnV/5HSMWKLhKn/yargIhguvHVv/OIpOcWoJLGpCA=; b=jtJVozduwVRzRmnt7oNUi5yY6lKfc2iJAbI2JaPZBUASm7+c7McBmsofP5SB8sJ/+J PR1JV+YU7ERXMt5jCMAvUZK/0gNi3mmVcp1DcbZYyui62dY0fIgPkDpgCIyA5hLfDPbW gLZyOPeeocxU2GacIQ7wsKsLCepf+C1ClcwlU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760363; x=1731365163; 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=ZmqnV/5HSMWKLhKn/yargIhguvHVv/OIpOcWoJLGpCA=; b=PJgb4BY9yw903fDVdFThlp05bM+yKROK+KZ6VsPn+iIxq2dc+IOzdiV9En9bva25Qk RkXu7KIq6geQnEFCGi/UwE4CAEXn3hAgKgsWWE5WJkTD94spYuc0L7oJqOI7/m8Yc2r7 CcNw62Ya3XKsjkGpSQjoidtGvsMEhpP8TEI4fRdecAD+y8JNcfj2unrmlGRbDnYTNRCq gT7OzWxd//qRborgtjInqxQvR+MzXBsXe5LqkDti3hhvKMS2qYh3xmY3OhaC2bgxps6U +1892rONx9oEuyAeMpm0PJcLtHmBYhpXn0t3sz5ljwTujfLdkapTaCxnjvAyGCsQhVci 0T/A== X-Gm-Message-State: AOJu0YwClbxmh3Ky/8vBH46AF3RMMlkFGE1V73D8+UCOdHpcCkwFyxzj d60l4brFSYm0uvtXYXl0fVTz5Zp1hP2dPGgqAvxD/fjb+4tY7w/dWhGlm6yOtrJIJcCaNPzT4fA = X-Google-Smtp-Source: AGHT+IGL3zKayOJwhX6KjQ2hcFDiXyfwbZNO8/63gQncp6bjngFOqYxjmvvgtOYFhn4BcUYf72n6Iw== X-Received: by 2002:a05:6e02:1d91:b0:3a6:b783:3c06 with SMTP id e9e14a558f8ab-3a6b7833e0amr107655385ab.19.1730760363387; Mon, 04 Nov 2024 14:46:03 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:01 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v8 02/11] test: Release board after tests complete Date: Mon, 4 Nov 2024 15:45:29 -0700 Message-ID: <20241104224550.677442-3-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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. Reviewed-by: Tom Rini 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 Mon Nov 4 22:45:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006570 X-Patchwork-Delegate: trini@ti.com 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=Mu0nb9WM; 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 4Xj65j01YKz1xxb for ; Tue, 5 Nov 2024 09:46:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4CAED88F68; Mon, 4 Nov 2024 23:46:12 +0100 (CET) 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="Mu0nb9WM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9510388D29; Mon, 4 Nov 2024 23:46:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 6024188F0C for ; Mon, 4 Nov 2024 23:46:08 +0100 (CET) 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-il1-x12b.google.com with SMTP id e9e14a558f8ab-3a6bd37f424so9710655ab.2 for ; Mon, 04 Nov 2024 14:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760366; x=1731365166; 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=ml2eg8e33nIKQ5YzdCUeqQbOXCTyCgwZLNeiQvPOsqs=; b=Mu0nb9WMhdTZ/su1lyXkV6GFQdCpljw0Ip5xCkc4Wii1GhJ72qc9YIl0eYmYdNmb0b hfLbK9/lcWKB2+zNdSnMiur06OCAPs0V1lsnWJQw8SKIrVzXtRlGWySlZmbtt2fxWaqF bHSxniqCGvkG8aI1YygCYhvAtXU5rj2LZr998= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760366; x=1731365166; 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=ml2eg8e33nIKQ5YzdCUeqQbOXCTyCgwZLNeiQvPOsqs=; b=IS9AbZY0hKZUzhDcvuQTppfHFoDkDWrV4k0bkd2IdTM1ZGZC4/pGcC80ec4mmEh7M5 t3d1X6iuVLCkCngJuHxuAE+nxkqiZESUPJMOcQlYW+yBLZ7MNQoBc7JqQfjOb5Ix8WS5 88b87wI/itTvS4PL6lG1n5ejfx0NyPyZxs1z/RkvWtTGHvTmm10aOhjTEqb22EdgtY6e A8XxDH4tCd1MMzKOFLR0FEEVS4XZDXreTmyPtdhsdLD4YMhAzeZwv6WJDaN62jPVzrnq y3Ir7mBWLufTGBxc4gNQ18Wb4jMGTJJXqY+byp8K6QhZXh2/3n1rhsPqOxboMrVcFNzW Jb5A== X-Gm-Message-State: AOJu0Yy71qQ1EtQKETEbsvt7DshEq7KdenRyRVFbtC5xdcW6txRflmpG jDjMH/7FPl0Kih5CaURMObyFtdtBjshhtGTeT7wDYwm0ntSMJ4i7hf7wGBc1EF8pEUELk+y5tlA = X-Google-Smtp-Source: AGHT+IE41ZrY146h1xwriFFEwn3AM2wMvdpVsXpvGl3+nbHs1e1MbasSvTSCNB34fPuTHNPcD+5FJQ== X-Received: by 2002:a05:6e02:1d09:b0:3a6:c651:3dad with SMTP id e9e14a558f8ab-3a6c651422fmr59944825ab.11.1730760366112; Mon, 04 Nov 2024 14:46:06 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:04 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Love Kumar Subject: [PATCH v8 03/11] test: Allow connecting to a running board Date: Mon, 4 Nov 2024 15:45:30 -0700 Message-ID: <20241104224550.677442-4-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 v7) Changes in v7: - Rename option to --use-running-system 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 46a410cf268..7a52b966154 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -80,6 +80,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('--use-running-system', 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 @@ -254,6 +256,7 @@ def pytest_configure(config): ubconfig.board_type = board_type ubconfig.board_identity = board_identity ubconfig.gdbserver = gdbserver + ubconfig.use_running_system = config.getoption('use_running_system') ubconfig.dtb = build_dir + '/arch/sandbox/dts/test.dtb' ubconfig.connection_ok = True diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index 965832a4989..311e649d55b 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -441,11 +441,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.use_running_system: + # 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..8b253b4451d 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.use_running_system: + 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 Mon Nov 4 22:45:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006571 X-Patchwork-Delegate: trini@ti.com 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=Xvuf1w/f; 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 4Xj65s69Z8z1xxb for ; Tue, 5 Nov 2024 09:46:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BC8C388DE6; Mon, 4 Nov 2024 23:46:13 +0100 (CET) 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="Xvuf1w/f"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5247888FAA; Mon, 4 Nov 2024 23:46:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (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 1F50D88D29 for ; Mon, 4 Nov 2024 23:46:11 +0100 (CET) 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-oi1-x22a.google.com with SMTP id 5614622812f47-3e6075cba82so2319048b6e.0 for ; Mon, 04 Nov 2024 14:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760369; x=1731365169; 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=MlheGeuo0Q4NReR8CGnDBoYD1xWhSji/d8yw6EQBpZE=; b=Xvuf1w/f/pphz64na3r35Prf6ENVxhMs2/rXMKU86a8uBVsWZgEoOrtc0SeezfbFWv Ypg7orSGis+5PR8pQtdcvXN4R1AQRxySQU7IqpFwOP6rDQFEY4VuU941W9Ebm28L+Q6L 4eTx4vTDepX00xVMTh/LNBwehQKmnP3nxgJmI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760369; x=1731365169; 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=MlheGeuo0Q4NReR8CGnDBoYD1xWhSji/d8yw6EQBpZE=; b=xLL3o7vBfPze/2wfqPXYJG67pTxWxntHgvlItP7gwTtg/O1trvsqP15x1FtVLpXdKz W6J9juQ6qKnUkCKRcCPOXoAHao9eh2H+JVAh0rtoDtGeTISpyO+vfx8OvkvTddud86Q8 2fektfhp0jpyVksHOWVdoI4ipU2+5Op43sGVkiT3BYle9Wx08h5WciKg1134/fWJOpUw LJ36C62u2PIGs0OgWhWORic6dM08sy8iXsaY0hIoQ/PQzVb64oVPLGKYZOWl4Y+JNWaO sQeoiarJePS6CqCspqB9LQOZm/zoE07U30evjjqjcVHytTSHGxx8x3QzynRsaeJLO5eo wWbg== X-Gm-Message-State: AOJu0YxnUyjCVWwsH3lqK7qUfsi93FPs7YoSU+jmpzOXk1aSFC9YIXA0 g+rZvWO/jM1YIgUnCk7u1FyUP3nH2yajUC+IsUeASPiAgwO9IGFSc0UoQEeJX65OEu7TSsINNb4 = X-Google-Smtp-Source: AGHT+IF0KO4w8tri2xwDrZ6VO3KnJ0/F/OakWJUxkLedhuCFzc2DzpqG3jOxtBRNjkh/FGMVk/va6g== X-Received: by 2002:a05:6808:1787:b0:3e7:6020:4cfa with SMTP id 5614622812f47-3e760204f1fmr9453358b6e.0.1730760368820; Mon, 04 Nov 2024 14:46:08 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:07 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v8 04/11] test: Introduce the concept of a role Date: Mon, 4 Nov 2024 15:45:31 -0700 Message-ID: <20241104224550.677442-5-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 v7) Changes in v7: - Update --role help and get_details() comment to mention Labgrid-sjg 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 7a52b966154..5c8d2fdba31 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 from u_boot_spawn import BootFail, Timeout, Unexpected, handle_exception @@ -80,6 +81,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-sjg)') parser.addoption('--use-running-system', default=False, action='store_true', help="Assume that U-Boot is ready and don't wait for a prompt") @@ -131,12 +133,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-sjg 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 Mon Nov 4 22:45:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006572 X-Patchwork-Delegate: trini@ti.com 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=ZzqBkooR; 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 4Xj6621wLrz1xxb for ; Tue, 5 Nov 2024 09:46:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 18E7889035; Mon, 4 Nov 2024 23:46:17 +0100 (CET) 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="ZzqBkooR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5058788D29; Mon, 4 Nov 2024 23:46:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 CEBB988FAB for ; Mon, 4 Nov 2024 23:46:13 +0100 (CET) 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-oi1-x22e.google.com with SMTP id 5614622812f47-3e5f9712991so2335930b6e.2 for ; Mon, 04 Nov 2024 14:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760371; x=1731365171; 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=gsQKYlsyzZGJXcBRGgi/aCrzfwb9avdxnsCa5P0xBS4=; b=ZzqBkooR8uMtwZthJaHJLsJzf7O4lc3MZzyH7JZ5Y9A6mnZdWnYQ/pKG9pPTdrHbit GyciNqZRdVHOF0jiQJTJA+BoSyYtbScZ+HGlBWFobK6eW+G20VMpoCW8y0mCMg32K23f xRFprogKvRU4wKIaN6qXmXd+kBCm2NEQjRN3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760371; x=1731365171; 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=gsQKYlsyzZGJXcBRGgi/aCrzfwb9avdxnsCa5P0xBS4=; b=BaiXDW427kT+u0Fj5nUVX+L6zMn+y6Gw4k23OMY3hGwtWZ1CHAGqtM9IscUYURGeZn wviefwEnEjPKdHGRQoJfaLktp+Xo/VZ8JL9ak25RH7q+DaUXOgYLAU/DojVIdXysG/fe aNQERUtwB8VT/x2kd+4tNCIGTjaY9CYLCuykhpdE0OH5g30+SSfmLwnng+jffExdv1gl KmehBnIxM1Zp3EiEgRJHvCSO+NwXO5ewUk5cs0pNUJlrd66zDOdtoQvvTaAdBtv1IXAR Nfz3uNJn1cj99UP7ZwzfurMF+g2IML28ZnZq41BmxWcal8ZxFWzNGiy746PjVGwafH4i CUYQ== X-Gm-Message-State: AOJu0Yz5CFGNhFnDEyeNU5yBXsU251SIZ5LXIjGd0tFjrz6m/IHOopFN QJ6XuUY7mugvGBFHAENNpIKBubb0Shzq61I1wh3ZvtdgBxN23j4J+RyNcpDy2/EU12oBX57sbVQ = X-Google-Smtp-Source: AGHT+IGNm1CgCcvesAEZoA9v35pkzLO62esWEbfUOInavDAx5sc2oo0dIpHQCtQ2Hy8+2v8pmGKCCA== X-Received: by 2002:a05:6808:23c9:b0:3e5:dba3:2480 with SMTP id 5614622812f47-3e758c5a8a2mr12033831b6e.15.1730760371643; Mon, 04 Nov 2024 14:46:11 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:10 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Love Kumar Subject: [PATCH v8 05/11] test: Introduce lab mode Date: Mon, 4 Nov 2024 15:45:32 -0700 Message-ID: <20241104224550.677442-6-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 311e649d55b..573d76dd832 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 Mon Nov 4 22:45:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006573 X-Patchwork-Delegate: trini@ti.com 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=euwRe/9X; 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 4Xj66C0k3Cz1xxb for ; Tue, 5 Nov 2024 09:46:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7717D88FD0; Mon, 4 Nov 2024 23:46:21 +0100 (CET) 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="euwRe/9X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17B3888F0C; Mon, 4 Nov 2024 23:46:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 B3A3788D29 for ; Mon, 4 Nov 2024 23:46:16 +0100 (CET) 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-il1-x134.google.com with SMTP id e9e14a558f8ab-3a5e0bfc7fdso14185685ab.1 for ; Mon, 04 Nov 2024 14:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760375; x=1731365175; 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=Wox2wjxJlA131CTKrfeozXlJz/EnfoLkERkQGqKQRbk=; b=euwRe/9XqftCmAf12hNtEjE7rJqkNKLKGGPkq0L2Xt2FvBscptgve9r+SKc37z2GZz MXuDM9bmzxGCDwN2QGMtmjUmPjF3e89Uaaby+YVVvmqEVJCZI5kN6VDxB+Mwlf0Kgqid 1xf1vJkJSH2VcWBQqVFQJagXUB8fOkn1llDe8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760375; x=1731365175; 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=Wox2wjxJlA131CTKrfeozXlJz/EnfoLkERkQGqKQRbk=; b=R0ig2vf0ejiapPVzZT7mQw95IzE5BcZ1p4jUE3uwPMMq5DDhkGDjffikbki5cW+9Hn +DGkNiqt2zmJzOGMl1peA+9Tew+MnYJzt6PmAvSnSqvTjcyBBEeGbyACQIy5ICzGQ333 Akh8DAE4qyst3+z82vVXlmxZIq4ggPLUcmPVBVyNnm0ajX7DvaiY6FLEFFBqtRuqjqZ6 G1QDZ5dd6Rbl4/rbSbvo3SSkkyVst9OBk/SSZSyalnvjyS+QoXbUPHUdMudzlj02FGXg ZWy4divjeYcH/beBlf5hwzGlAlHzmXZ+BLa+qz5RV1/F506oHcjIDJjOHEWO4/Z7vrx+ 5Ylw== X-Gm-Message-State: AOJu0YzZfw+uK/n5hYt+KLeMcI5f+QhfEYLI4Y8UsfI7kBou3H1gBYbL pvC+Woz6GTOLAkK8PVTPcGWKTtcfwgMld1yvoFK3pq5qmsmR/gbtNR30Iz2wKH7+TW8oJW+xU20 = X-Google-Smtp-Source: AGHT+IFMtrvI7J4b18V/vQk5wLd35qPOpMPcHHi4jPlUWsmp/wK73udJnR8syLhSe4vWro49JVfVmg== X-Received: by 2002:a05:6e02:17c8:b0:3a6:da79:12bc with SMTP id e9e14a558f8ab-3a6da791329mr12048405ab.7.1730760374884; Mon, 04 Nov 2024 14:46:14 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:13 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Love Kumar Subject: [PATCH v8 06/11] test: Improve handling of sending commands Date: Mon, 4 Nov 2024 15:45:33 -0700 Message-ID: <20241104224550.677442-7-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 573d76dd832..42c81b2d13f 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 Mon Nov 4 22:45:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006574 X-Patchwork-Delegate: trini@ti.com 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=Qq0Mnfyc; 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 4Xj66N2s6Hz1xxb for ; Tue, 5 Nov 2024 09:47:08 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DB0EB89066; Mon, 4 Nov 2024 23:46:23 +0100 (CET) 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="Qq0Mnfyc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE67888FDE; Mon, 4 Nov 2024 23:46:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 A9DFF88E96 for ; Mon, 4 Nov 2024 23:46:19 +0100 (CET) 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-il1-x12e.google.com with SMTP id e9e14a558f8ab-3a4d1633df9so16300155ab.2 for ; Mon, 04 Nov 2024 14:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760378; x=1731365178; 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=a0oq8EdKTqrpVR1I9pkRTPoTzBVheO4D5yRasz9RMP8=; b=Qq0MnfycPxr836WAxCK/pfFFSoP00azK3guYamwPbS+S+QSP2chQZzZFg6WlA3A+4H ECCY3SGFSulJUAt4CsU1pYkgeZQ3UmqfkZKa/l2mBV7I086OUA2Ut9z03WVajydPj5qT uxWZfSmxHmBxFMhMuHbd+rB3d4SkxLVGbTZC4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760378; x=1731365178; 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=a0oq8EdKTqrpVR1I9pkRTPoTzBVheO4D5yRasz9RMP8=; b=WyjhXyaHmNPesIxOIU0SMqRVcXVRYr/D3IQDDXAqw3vgUlKaP5i4dnuR2QTq6ZR5xA phiHESD7+HBiAeuWbDeKI4BCZuX1f7GMRODId6tVjJb7bk7FviGYS7zpQmkobcz7WPZy lsTBUxcrNpkkIYEXOk10avHUqYR/n4p75nsB5cmg0BoR/k934Z489/WCUu/DN6T2omWx BYsbgCXSXU9fGWA8IIWJ3l2VxWiSoDX8NrSJwas0Qc53Biy7vM/+xXgqVS9Qg22cdTxj o/l7Uo7dI5fFPO6uPNDjELxmHBJG/3TMHuQwaelnFW5c1k6pMzjlwwCZrl5gPmhk6Iea KZnA== X-Gm-Message-State: AOJu0Ywz0SZ1DpXJr/s9VKaCUpaBx53mQ4mJlPiLC4FzoGhLWI0LUmDl jz37yVUDmJaibkKBD0ZnnAP68izcR2PDIU4bIgR00gh85iviKjfS5/s3lgrG/QZ6cARus3E13ss = X-Google-Smtp-Source: AGHT+IGJXhk8ItWTcd229g9ciIPE9V656IQCfE1fXytU5+6u8bTzEIZzNwaVzBUBJsQr6eSQBMEZQg== X-Received: by 2002:a05:6e02:1688:b0:3a6:be66:ce53 with SMTP id e9e14a558f8ab-3a6be66d4b1mr99132355ab.18.1730760377877; Mon, 04 Nov 2024 14:46:17 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:16 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v8 07/11] test: Avoid double echo when starting up Date: Mon, 4 Nov 2024 15:45:34 -0700 Message-ID: <20241104224550.677442-8-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 --- (no changes since v6) 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 Mon Nov 4 22:45:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2006575 X-Patchwork-Delegate: trini@ti.com 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=hhVhCnKH; 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 4Xj66g5lvnz1xxb for ; Tue, 5 Nov 2024 09:47:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0B37F88FAB; Mon, 4 Nov 2024 23:46:27 +0100 (CET) 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="hhVhCnKH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C85B088E96; Mon, 4 Nov 2024 23:46:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0: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 AD25A88F73 for ; Mon, 4 Nov 2024 23:46:22 +0100 (CET) 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-oi1-x22d.google.com with SMTP id 5614622812f47-3e5f86e59f1so2155194b6e.1 for ; Mon, 04 Nov 2024 14:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760381; x=1731365181; 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=X7RZCKW9+za354mRM6xHyWde2bDJrMwOBKeplOhuiog=; b=hhVhCnKHT2STd27AfjXC27oQE6KGrnEHqlyaPVGEObzWgt61M3Hs8UetPh3HncUPtU BUro3WMbOou8yOicyh8fIYZUL//gOfotsMErCX5cxvrQVhGlSzL8b5d9rkLTyNXNyMHr MZKftF5kV8YIZDLCQuyubdDfhUmBES98jscB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760381; x=1731365181; 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=X7RZCKW9+za354mRM6xHyWde2bDJrMwOBKeplOhuiog=; b=LFl+fHdUjDIuHZcgq79BCIzgzL0C8pRKUgax/tAWwn285K4qBlRHnroEqHsVnp75d8 tV3sxONWpzwqhgvOJRZFhIQueiWtaXJjJQT8i9YlxmuDqeV3e0VyWxpQoyHOe2gRxsSV mScK5rWjTHYx9igoPQl9tckQOoP5ZoCh83w9I7NpQsQ1jo74Mt5Gaeuw/Q37aQYtHJ7O v2X4CjCTJGTrmxiHoKO+7rECcHqiTlsS3DCoe8GMaEETm/kx8oF7kQvkSVX9uKoieMR9 5R24Ym1Uo2CM2FazG0zt7Ui4eqaGT6GIyg+ApIyYjFf/qtz66lMVITd6VGNXHWvTMfFd /A8A== X-Gm-Message-State: AOJu0YwltJqNu1cBQK9wh/2PNPf5i4ZB9Lgk05jyIbxgqH/vcjYvJwnN XSNrcX7cx/viOzcmftKscupZ1INrpIG1va8/29v7MN3wo35GQ9qihqr1woe1KHhB2WSpEOpN7uA = X-Google-Smtp-Source: AGHT+IEKZ6k3rppin6xkiUY4Zf4h9ClVGFviWHxAwtixu96lZW/3pu8sx1hHogaqi0AtPgYjBalk6w== X-Received: by 2002:a05:6808:2f0b:b0:3e6:614e:2b07 with SMTP id 5614622812f47-3e6614e2c20mr16992013b6e.30.1730760380950; Mon, 04 Nov 2024 14:46:20 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:19 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v8 08/11] test: Try to shut down the lab console gracefully Date: Mon, 4 Nov 2024 15:45:35 -0700 Message-ID: <20241104224550.677442-9-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 v8: - Use USE_LABGRID_SJG for graceful shutdown 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..dc936e7eddf 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-sjg, 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_SJG'): + 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 Mon Nov 4 22:45: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: 2006576 X-Patchwork-Delegate: trini@ti.com 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=aYdYUc3x; 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 4Xj66s15njz1xxb for ; Tue, 5 Nov 2024 09:47:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D9CF8901B; Mon, 4 Nov 2024 23:46:29 +0100 (CET) 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="aYdYUc3x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4EE7D88F73; Mon, 4 Nov 2024 23:46:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) (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 2535D88E96 for ; Mon, 4 Nov 2024 23:46:26 +0100 (CET) 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-oa1-x2a.google.com with SMTP id 586e51a60fabf-2689e7a941fso2296217fac.3 for ; Mon, 04 Nov 2024 14:46:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760384; x=1731365184; 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=rOSJX2KylyqXjJ2ADZ0wOm3pDYPs3ARvz7MU2uM/e7A=; b=aYdYUc3x0yYwrXd57wxVAqyFUIjAHdmNCTJ7GA+4MSLUs+9Nd5KWyQAHZI4eZq5ihM Esv5Scu7ATbGpc0W/vhVkue8kKJPLczgARyLnHT46BpjaHu8ueKCa84FLtfv9VWJb+8y sQPUQz8nhDitwXgPmeeE4cDppMl6lahC7Yec8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760384; x=1731365184; 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=rOSJX2KylyqXjJ2ADZ0wOm3pDYPs3ARvz7MU2uM/e7A=; b=lM1LCiHS2UGFw4LLVgw4ij00wR/lC31fA7vccB3fe20mTD+6sNmSdWEU/ysvONlay9 3ylygo3UXXKSJmIHkqgYc4SUGEpZQy8gclsyKXLvoWeqAd/m1uXFtk1WYRqyr11YXCM0 rHTI1UeTd6vEHf/G2KpDjCpEUkGuz/DWDrtNp17Gt+uic7tDaSOpzF/KmvuNatRF5PvP bGB/qdykKNlyVDgIsjJ5+PWI43lakgnVpyTvrYFfjad3YUE2cAtfAg+2mrn4b+aRoWCm v6J7TpU/yELjX0/1gWpnw84riJS3AzbafW2DDx1KdShfxWKQdVVxBJNvOj7sSqaWyDSX CLyA== X-Gm-Message-State: AOJu0YywSJuxYwwVQm7UNzHIzcNKcPtuQlVYU6fXOvjAcIN0YEq2fdoN AvclBD7Ax6tvIAuOdMZBNg0Ehd+KxGbG4axBnPsOjjP57ZGnFQs60uteousHZOZGQoUqjNtKPwI = X-Google-Smtp-Source: AGHT+IHB1VfL5ZF3vJGN/TzkNcGd26Gweg6q3CcJ0xS55/idxFgCt11BaY2R7VwJ4iKX00mLP4e1rw== X-Received: by 2002:a05:6871:c707:b0:288:b7f0:f8fc with SMTP id 586e51a60fabf-294846cd45bmr12893978fac.41.1730760384296; Mon, 04 Nov 2024 14:46:24 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:22 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Love Kumar Subject: [PATCH v8 09/11] test: Add a section for closing the connection Date: Mon, 4 Nov 2024 15:45:36 -0700 Message-ID: <20241104224550.677442-10-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 Reviewed-by: Tom Rini --- (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 42c81b2d13f..fa9cd57b04b 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 Mon Nov 4 22:45: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: 2006577 X-Patchwork-Delegate: trini@ti.com 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=Vquhi6Pl; 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 4Xj6715mTWz1xxb for ; Tue, 5 Nov 2024 09:47:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C033288F0C; Mon, 4 Nov 2024 23:46:31 +0100 (CET) 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="Vquhi6Pl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19F048906C; Mon, 4 Nov 2024 23:46:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (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 D6F1888F73 for ; Mon, 4 Nov 2024 23:46:28 +0100 (CET) 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-io1-xd33.google.com with SMTP id ca18e2360f4ac-83b83f83b63so60443139f.1 for ; Mon, 04 Nov 2024 14:46:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760387; x=1731365187; 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=XM5yd9rPp0m7yIFzgl3JM6ogPppk/hA8qoC+yqv7cu4=; b=Vquhi6PluzCqnIcTzZXnVL2z2gcFT0IbxvFWJc3VcoY1u2rFBpH0eLAScs8EKHYK3y ARTNPKrytv5WCmyhXH/7wr0ccONwQ07A+gSXWV0XftLWlUWushWwGTVWhDAY4NtaPho7 DctCyAo72Xw7hFwT72Llv9y0XCexOhWNfqdmM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760387; x=1731365187; 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=XM5yd9rPp0m7yIFzgl3JM6ogPppk/hA8qoC+yqv7cu4=; b=FiPm/njF94qANFOmka4QZr3Kua4MPGuEArVpNhcDwBgNo6IzXicnfUrFeW1cJOrefL zqHLmgM4ZNGwzwyxnvloRSPnMMBGq20C/DndckjxqgGHFFCvJF6x0gSB7umVRfcgV6kq tk/iIizILJZtofrjkVSP9do6sbSEPnhzW6FLfbpksiCfR6DXd+4J0tUvBdoLjfCD0WMn pGQttcgs6DYk4VkD0S9s4jQmOcpKlO1si3KicpxUFXAbhpVMaIpfxBFovpidBf/Q+W0B xf3/seagzTMoJzQ99Ctwz8DxUAG8VXC8lKXBwKAzmDTg+NuhyN2kTlCee8C+QH8wDTvq xvig== X-Gm-Message-State: AOJu0YwM4XCco2MdtF9GqcHyEDz6cODDKTp/y3OT+iWIG55eryyH/pMA SUNcqk1LEGjE1qj205tHwV15v9mebEokFZX+l99GU3ajQV0cShByNAw9I9hGZLPtSGyA2lgR7L8 = X-Google-Smtp-Source: AGHT+IHxXbz1tS9q3ujVjEM9SB8/oPUdTlHE5XgA6JKYpyPqVdT9QAchXnwyAH8qDDTdgyJmUCFp5w== X-Received: by 2002:a05:6e02:1609:b0:3a6:aac4:1c43 with SMTP id e9e14a558f8ab-3a6aac41e31mr169428885ab.7.1730760387033; Mon, 04 Nov 2024 14:46:27 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:25 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v8 10/11] test: Support testing with two board-builds Date: Mon, 4 Nov 2024 15:45:37 -0700 Message-ID: <20241104224550.677442-11-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 5c8d2fdba31..d9f074f3817 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-sjg 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.use_running_system = config.getoption('use_running_system') @@ -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 Mon Nov 4 22:45: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: 2006578 X-Patchwork-Delegate: trini@ti.com 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=RUph53DK; 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 4Xj6796yLSz1xxb for ; Tue, 5 Nov 2024 09:47:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2130288F73; Mon, 4 Nov 2024 23:46:36 +0100 (CET) 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="RUph53DK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 01FD7890C5; Mon, 4 Nov 2024 23:46:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 C2D9A89078 for ; Mon, 4 Nov 2024 23:46:32 +0100 (CET) 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-il1-x133.google.com with SMTP id e9e14a558f8ab-3a6af694220so14127465ab.1 for ; Mon, 04 Nov 2024 14:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730760390; x=1731365190; 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=aNA3iEoJdCg7aw5cfWAVSZbkx1y1S2oBVI5WLcPbj3A=; b=RUph53DKAtXdKuIofeiYAkzAKnwWbYPd9cOWR5JTGFKplvaOYHRpMH0EBHwZy0h521 pLSHDBC2yxqK+3GRMX8dAbwhvY7TRwBd+xz+xhX3Fn8heyMM4KOvuIAb+kbOsq2EVdIJ uMDpp5UfviBxVIg2ykOREKBvodZ6NvdRLBeBo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730760390; x=1731365190; 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=aNA3iEoJdCg7aw5cfWAVSZbkx1y1S2oBVI5WLcPbj3A=; b=YYLZrnPTOVEosLqJbITIOtIrWpuGTrQQh6NwCNzvVvHWOMPzaaLqdDBVY5siJruNM8 bzNX9c13c14hajMrD5z+xl70wlryJRktmFAJv59qRd6hsBMnsc9LuRDJMVM30K7e32wV BvlM+mKL66Sj45l8G1ybGpigmLkU3NW924kClWB+5H9ckBbsPUYTyIjhbXonEt5UFS1j 0TAuliy71oLwrF5PIXnaQT7L+MtpG3L1kpebjbW0TIBi/Z8RvmoK8Bl+YAtjfzNYmGOE LSrzvoIHvcv6amDSn2yKCzpp1Eu81oZW9elVzYmFaBsbUAQJLlIzmX3LUKRP6GaxpbnF mV0g== X-Gm-Message-State: AOJu0Yw1CCVSOCDZnqftDrv6+ZYEfskoYJrXrc9ZNRe5BTvgYnnsSDxK +RZTy+9+68LfRZQV8/apTmmlVvSKi/RNHbL2BvsBJmfDIp/kekkmTB3flhjofDVjI3nRjP/rLMo = X-Google-Smtp-Source: AGHT+IGrp3yccHwuUk8BQhwpyKbP90h/ABz5UzAMtxo9S9TfmVEMF9KDKgEG00S8oiWPrS4wH2AgfQ== X-Received: by 2002:a05:6e02:2190:b0:3a6:a9bd:84bc with SMTP id e9e14a558f8ab-3a6b038fa0amr125601785ab.18.1730760390567; Mon, 04 Nov 2024 14:46:30 -0800 (PST) Received: from chromium.org ([50.235.115.130]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6a97b009csm25535945ab.4.2024.11.04.14.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 14:46:29 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Andrejs Cainikovs , Ilias Apalodimas , Jerome Forissier , Jiaxun Yang , Patrick Rudolph , Raymond Mao , Sumit Garg Subject: [PATCH v8 11/11] CI: Allow running tests on sjg lab Date: Mon, 4 Nov 2024 15:45:38 -0700 Message-ID: <20241104224550.677442-12-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104224550.677442-1-sjg@chromium.org> References: <20241104224550.677442-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 --- (no changes since v7) Changes in v7: - Rebase on broken-out testb series 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 0aeda53bc2d..97361337e21 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 @@ -521,3 +522,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