From patchwork Tue Mar 24 22:18:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2049 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390783; bh=UE1IofP+a+n9hGDAWC6PcDhpFuoJP5r6vNG7uM2KSqA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=eNAE5QUfTIlS/bV0ezMrSntJnJtDETir9BvEU8xAGsl757hYru7za81RhmF8nZmeP dT87ZTMm3UKfBgvhIwqI6mwkCtwlMLJIdXszW+uXoDYRsxC794uY3n7bp2ugbLlUKz khBsuPIQoyUj2qRMDzt0T205luSQmPzWTlb/GB53PyXNn9quGUrDoZT2ZncAV9ELSY iip95qvAGgYVh2UdTFiM6PjYMLCql0rUsE90ZS0PVHg+n51U0M9CPkdezWJgcv4xaS QDNad7JBBZ7mEajn8Jb17EnJByCZiEB8UmD88BiXdAOs17vsL/Ogb9whn35skcbLfX InYqcbWIZ7krA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F34416A241 for ; Tue, 24 Mar 2026 16:19:43 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id NuQ4ns8AY8Pw for ; Tue, 24 Mar 2026 16:19:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390783; bh=UE1IofP+a+n9hGDAWC6PcDhpFuoJP5r6vNG7uM2KSqA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=eNAE5QUfTIlS/bV0ezMrSntJnJtDETir9BvEU8xAGsl757hYru7za81RhmF8nZmeP dT87ZTMm3UKfBgvhIwqI6mwkCtwlMLJIdXszW+uXoDYRsxC794uY3n7bp2ugbLlUKz khBsuPIQoyUj2qRMDzt0T205luSQmPzWTlb/GB53PyXNn9quGUrDoZT2ZncAV9ELSY iip95qvAGgYVh2UdTFiM6PjYMLCql0rUsE90ZS0PVHg+n51U0M9CPkdezWJgcv4xaS QDNad7JBBZ7mEajn8Jb17EnJByCZiEB8UmD88BiXdAOs17vsL/Ogb9whn35skcbLfX InYqcbWIZ7krA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 403B06A245 for ; Tue, 24 Mar 2026 16:19:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390781; bh=WegrlAni+psrClfL0uObm+f8b4PACjGbqmHKDvLXFxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uo/edT3IpleMQTVkmLoWjgBW3XW43xTTkxzhXX2OTe7HDaC66CjkHeJ3IC78FmfQE o2qxdpvULElNd45FdWntJbHytNyXxgsNxCGYi4I46NmT979GU29QP4UkgeUrk+HCkb IBIirbUrNvivk4WJ6r+pkRLVF+ego0Gz+XK1rTKyJehsKDnKqyasa3a9HTTbNvX9Ti gx+C8Ap5Wv54hOxg6j2uMY1gHx8BhzJftcW5d4yWv3p0ZIqkIv69vb7N6r7fydkzVo +PVIT1pDmdPWE9waM7PeKNumjSrgy4hm2kgwY6bxDQsYdEoyKZPTFQuuNf4RzrEsg3 lGAvhDhCj/ZUw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 732906A245; Tue, 24 Mar 2026 16:19:41 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id DuA05lRc6Rv8; Tue, 24 Mar 2026 16:19:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390778; bh=n77OR55M+uKoTeJjB5ULx54+u53oB7DUuLPVv+0dmzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e/nBeQMZetiQi3SxgE0wt7z5yjAIy9Ahh/fk0Vmhe7pMUsbRkpmCmkBDgvSCRmxHn aN6cEAyaHi1JkZ5DF5StqdbtgtHrJoiNUnjXt34ThAwVLoVKhRDc9hiG1m9534nzTE TbxBFlNeh7pCwYHvTNBeVhlHOLyTIO4rwjf1/nslrL3hVO73mT5t3DBUCcWvSYTnQr vbtADBl4QrP0LH4900+A1R5EpaVqm6vzU+ais/xoZs4fL0bOqvTdVCxaDeDBsl2jvw Pyt8yH711vev1kW3R8Ym+lkAzRBREs2PGyBLuGKKq5zd+YUnc1bViL8Ux3cpQxPRgf J97lVJNi9Bfiw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5A6436A1FD; Tue, 24 Mar 2026 16:19:38 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 24 Mar 2026 16:18:58 -0600 Message-ID: <20260324221911.3678307-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324221911.3678307-1-sjg@u-boot.org> References: <20260324221911.3678307-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EYLTS4OW3LQM2ERFL7AYWMHLDQFPGXRT X-Message-ID-Hash: EYLTS4OW3LQM2ERFL7AYWMHLDQFPGXRT X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/12] test: bootstd: Add test for multi-entry bootflow scanning List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a test that scans USB devices and verifies that the Ubuntu image on flash3 (which has two extlinux labels) produces two separate bootflows with the correct OS names. Signed-off-by: Simon Glass --- test/boot/bootflow.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 2e0cf5d309e..673bdbe33de 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -1899,3 +1899,57 @@ static int bootflow_cmd_bls(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_cmd_bls, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE); + +/* Test multi-entry scanning with the Ubuntu image on USB (two labels) */ +static int bootflow_multi(struct unit_test_state *uts) +{ + static const char *order[] = {"usb", NULL}; + struct bootstd_priv *std; + struct udevice *bootstd; + const char **old_order; + struct bootflow *bflow; + + test_set_eth_enable(false); + test_set_skip_delays(true); + + ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); + std = dev_get_priv(bootstd); + old_order = std->bootdev_order; + std->bootdev_order = order; + + bootstd_reset_usb(); + + ut_assertok(run_command("bootflow scan", 0)); + + /* Restore the order as soon as scanning is done */ + std->bootdev_order = old_order; + + ut_assert_skip_to_line("Bus usb@1: 6 USB Device(s) found"); + + ut_assertok(run_command("bootflow list", 0)); + ut_assert_nextlinen("Showing all"); + ut_assert_nextlinen("Seq"); + ut_assert_nextlinen("---"); + ut_assert_nextlinen( + " 0 efi ready usb 1 hub1.p2.usb_mass_storage."); + ut_assert_nextlinen( + " 1 extlinux ready usb 1 hub1.p4.usb_mass_storage."); + ut_assert_nextlinen( + " 2 extlinux ready usb 1 hub1.p4.usb_mass_storage."); + ut_assert_nextlinen("---"); + ut_assert_nextline("(3 bootflows, 3 valid)"); + ut_assert_console_end(); + + /* Check that the two extlinux entries have different OS names */ + bflow = alist_getw(&std->bootflows, 1, struct bootflow); + ut_asserteq_str("Ubuntu 25.04 6.8.0-53-generic", bflow->os_name); + ut_asserteq(0, bflow->entry); + + bflow = alist_getw(&std->bootflows, 2, struct bootflow); + ut_asserteq_str("Ubuntu 25.04 6.8.0-53-generic (rescue target)", + bflow->os_name); + ut_asserteq(1, bflow->entry); + + return 0; +} +BOOTSTD_TEST(bootflow_multi, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);