From patchwork Sat Nov 15 18:52:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 712 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=1763232830; bh=/Gi3T0/yFZPlGALw4mE5B6Wv7JdNpQFsK3Rr3n22sow=; 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=IfLuNZRXUcgxjIp6u7ZBIJOtCGDQpimvjjQ4j3K6yHhS0tQg4DZyiJyW2zNsnyYTr RlLiL+/i+z98KN09v/Dh4EYy8f5xhjQWJJ9zkRLFRzgKXv9wbNQIGv3LT9neSq6qJ1 N5MmzE74sqjZiYOj3X9yQsfMxFDIvpzXtnWsJtuwmE+i5mmwOKY04L5Ic2NMNLMXcZ 1v+ZSgHZB4+Hfx5vrhsnfWpA7IVQk5veEMCOM8lDmuH32hRsHAxG1oir0MqRxx8o4O 6ZkWN7fol6LxfCdr01dGD/5UyKcVXK2kj/ySaeAQfWnkHCEO2ZSyfhrkDYKSiy5Htm 9HTrrhM8gSgow== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C37436861A for ; Sat, 15 Nov 2025 11:53:50 -0700 (MST) 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 GA5AVxf91Dcj for ; Sat, 15 Nov 2025 11:53:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232830; bh=/Gi3T0/yFZPlGALw4mE5B6Wv7JdNpQFsK3Rr3n22sow=; 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=IfLuNZRXUcgxjIp6u7ZBIJOtCGDQpimvjjQ4j3K6yHhS0tQg4DZyiJyW2zNsnyYTr RlLiL+/i+z98KN09v/Dh4EYy8f5xhjQWJJ9zkRLFRzgKXv9wbNQIGv3LT9neSq6qJ1 N5MmzE74sqjZiYOj3X9yQsfMxFDIvpzXtnWsJtuwmE+i5mmwOKY04L5Ic2NMNLMXcZ 1v+ZSgHZB4+Hfx5vrhsnfWpA7IVQk5veEMCOM8lDmuH32hRsHAxG1oir0MqRxx8o4O 6ZkWN7fol6LxfCdr01dGD/5UyKcVXK2kj/ySaeAQfWnkHCEO2ZSyfhrkDYKSiy5Htm 9HTrrhM8gSgow== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B03AF68521 for ; Sat, 15 Nov 2025 11:53:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232828; bh=YoX2TfeH2vb9ki+6waSMy6hkLvR2w6Uw7FhEv/Miz1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qE73D9J5/rOPt8BKV1yCknKA92XC9F8k2pgWgs4z5QRMABwP94d5GH/7G1mevpn5c 1+/F7b+gQTEvnHUohJV5k83D3hZdY4XcvcnRZvyZy03p91A7OQZPB4GkMQoAteRmUs pwN3vBrhclRB01Jit0BGkT3ixYpheABT4GmuurCL4Yu6nOHOwtaJmmPDlsDSgADdv5 aF3e5T0Fk1xMqocQGXIyJ1OlAXxBOkMEPZ1TC/JBQ5QMunlkHLd1oySfJYTJE0IU2y 7j+cPdwzSVDfOuKjyPYJmQaKff7egCMGusCAa1PmhfTGKFYUr/idYA7wUMq/O4Pa4Z /ioaIGx9i7n6g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4033B6861A; Sat, 15 Nov 2025 11:53:48 -0700 (MST) 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 oikKfbDPzSHu; Sat, 15 Nov 2025 11:53:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232824; bh=N2quzS+uhD9txagFUuC6Uco0YpInR4/p6ae8wstxwMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hBB54Qn3nouCIvYLURHbMaAxM+gC7TUvWN/IfqjBV94WM2YquhPnrn6xn6cwDQood K9/TSowYGRrbFzxLMqgz0s9VWKIAanR9Dchx5YcukJWQ+vfdaCGOvrXmsPd3KiksT+ n7Z96kaSwSV7bhGoxN2vIh+vOkGxEHciu/wPlOIdGVciX1ngEZHOIBZZ5d7Vf+M6Kk JEOK0ZYekcy3yVu1+S8j3DCLpqYV+jJd71XZenIUuQWsT6wDXP0mWDdhS9NU9IBrUb hGJ/Rw1mixCPei32DXoFmLRVMkKSimvIa6jOnSr64TTcZkv7pmC/h0xV367x9p/vAJ bziFUDN3FmcSg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CDE61685B1; Sat, 15 Nov 2025 11:53:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 15 Nov 2025 11:52:03 -0700 Message-ID: <20251115185212.539268-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251115185212.539268-1-sjg@u-boot.org> References: <20251115185212.539268-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZE3G6MNR5VMEFAEI2VFYWCVHNEJMQG7F X-Message-ID-Hash: ZE3G6MNR5VMEFAEI2VFYWCVHNEJMQG7F 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 14/16] boot: Use constants for a few common strings 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 The header and the extlinux image on mmc1 appear in several tests. Add a shared constant for this. Signed-off-by: Simon Glass --- test/boot/bootflow.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index e2de3af4f29..7baff4b0b0d 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -39,6 +39,10 @@ extern U_BOOT_DRIVER(bootmeth_2script); /* Use this as the vendor for EFI to tell the app to exit boot services */ static u16 __efi_runtime_data test_vendor[] = u"U-Boot testing"; +/* comment test strings */ +#define HEADER "Seq Method State Uclass Part Name Filename" +#define EXT0 " 0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf" + static int inject_response(struct unit_test_state *uts) { /* @@ -62,11 +66,11 @@ static int bootflow_cmd(struct unit_test_state *uts) ut_assert_console_end(); ut_assertok(run_command("bootflow scan -lH", 0)); ut_assert_nextline("Scanning for bootflows in bootdev 'mmc1.bootdev'"); - ut_assert_nextline("Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); - ut_assert_nextline(" 0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_nextline(EXT0); ut_assert_nextline("No more bootdevs"); ut_assert_nextlinen("---"); ut_assert_nextline("(1 bootflow, 1 valid)"); @@ -74,9 +78,9 @@ static int bootflow_cmd(struct unit_test_state *uts) ut_assertok(run_command("bootflow list", 0)); ut_assert_nextline("Showing bootflows for bootdev 'mmc1.bootdev'"); - ut_assert_nextline("Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); - ut_assert_nextline(" 0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_nextline(EXT0); ut_assert_nextlinen("---"); ut_assert_nextline("(1 bootflow, 1 valid)"); ut_assert_console_end(); @@ -155,11 +159,11 @@ static int bootflow_cmd_glob(struct unit_test_state *uts) ut_assertok(run_command("bootflow scan -lGH", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); - ut_assert_nextline("Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); - ut_assert_nextline(" 0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_nextline(EXT0); ut_assert_nextline("Scanning bootdev 'mmc0.bootdev':"); ut_assert_nextline("No more bootdevs"); ut_assert_nextlinen("---"); @@ -168,9 +172,9 @@ static int bootflow_cmd_glob(struct unit_test_state *uts) ut_assertok(run_command("bootflow list", 0)); ut_assert_nextline("Showing all bootflows"); - ut_assert_nextline("Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); - ut_assert_nextline(" 0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_nextline(EXT0); ut_assert_nextlinen("---"); ut_assert_nextline("(1 bootflow, 1 valid)"); ut_assert_console_end(); @@ -187,7 +191,7 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assertok(run_command("bootmeth order ", 0)); ut_assertok(run_command("bootflow scan -aleGH", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); - ut_assert_nextline("Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); @@ -220,7 +224,7 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assertok(run_command("bootflow list", 0)); ut_assert_nextline("Showing all bootflows"); - ut_assert_nextline("Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); @@ -573,8 +577,7 @@ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) ut_assertok(bootmeth_set_order("efi firmware0")); ut_assertok(run_command("bootflow scan -lGH", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); - ut_assert_nextline( - "Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); ut_assert_nextlinen("---"); ut_assert_nextline("(0 bootflows, 0 valid)"); @@ -582,8 +585,7 @@ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) ut_assertok(run_command("bootflow scan -lH", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); - ut_assert_nextline( - "Seq Method State Uclass Part Name Filename"); + ut_assert_nextline(HEADER); ut_assert_nextlinen("---"); ut_assert_nextline("Scanning global bootmeth 'firmware0':"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); @@ -941,8 +943,7 @@ static int bootflow_cmd_hunt_label(struct unit_test_state *uts) ut_assert_nextline("Hunting with: mmc"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); - ut_assert_nextline( - " 0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_nextline(EXT0); ut_assert_nextline("Scanning bootdev 'mmc0.bootdev':"); ut_assert_skip_to_line("(1 bootflow, 1 valid)"); ut_assert_console_end();