[Concept,03/16] test: pxe: Add a test for the 'say' keyword

Message ID 20260109015323.3411528-4-sjg@u-boot.org
State New
Headers
Series test: pxe: Add some decent tests for the PXE/extlinux parser |

Commit Message

Simon Glass Jan. 9, 2026, 1:53 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add test coverage for the 'say' keyword which prints a message during
label-parsing.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 test/boot/pxe.c                  | 7 +++++++
 test/py/tests/test_pxe_parser.py | 3 +++
 2 files changed, 10 insertions(+)
  

Patch

diff --git a/test/boot/pxe.c b/test/boot/pxe.c
index 49d8d160389..ef42026e748 100644
--- a/test/boot/pxe.c
+++ b/test/boot/pxe.c
@@ -101,6 +101,10 @@  static int pxe_test_parse_norun(struct unit_test_state *uts)
 	cfg = parse_pxefile(&ctx, addr);
 	ut_assertnonnull(cfg);
 
+	/* Verify 'say' keyword printed its message during parsing */
+	ut_assert_nextline("Retrieving file: %s", cfg_path);
+	ut_assert_nextline("Booting default Linux kernel");
+
 	/* Verify menu properties */
 	ut_asserteq_str("Test Boot Menu", cfg->title);
 	ut_asserteq_str("linux", cfg->default_label);
@@ -186,6 +190,9 @@  static int pxe_test_parse_norun(struct unit_test_state *uts)
 	ut_asserteq(0, label->localboot_val);
 	ut_asserteq(0, label->kaslrseed);
 
+	/* Verify no more console output */
+	ut_assert_console_end();
+
 	/* Clean up */
 	destroy_pxe_menu(cfg);
 	pxe_destroy_ctx(&ctx);
diff --git a/test/py/tests/test_pxe_parser.py b/test/py/tests/test_pxe_parser.py
index c9af135b17d..1d51116a97a 100644
--- a/test/py/tests/test_pxe_parser.py
+++ b/test/py/tests/test_pxe_parser.py
@@ -105,6 +105,8 @@  def create_extlinux_conf(srcdir, labels, menu_opts=None):
                 fd.write(f"    fit {label['fit']}\n")
             if label.get('kaslrseed'):
                 fd.write("    kaslrseed\n")
+            if 'say' in label:
+                fd.write(f"    say {label['say']}\n")
 
     return '/extlinux/extlinux.conf'
 
@@ -126,6 +128,7 @@  def pxe_image(u_boot_config):
             'fdt': '/dtb/board.dtb',
             'fdtoverlays': '/dtb/overlay1.dtbo /dtb/overlay2.dtbo',
             'kaslrseed': True,
+            'say': 'Booting default Linux kernel',
             'default': True,
         },
         {