From: Simon Glass <simon.glass@canonical.com> The PXE menu timeout is configured in extlinux.conf, but tests need a way to override it to avoid long delays. Add a pxe_timeout environment variable that, when set, overrides the configured timeout value. The test uses pxe_timeout=1 to reduce the menu wait from 5 seconds to 1 second. Ideally the test would be instant, but this is good enough for now. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- boot/pxe_utils.c | 5 ++++- test/boot/pxe.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index ba1f7c41512..fbe4a111453 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -929,11 +929,14 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg) int i = 1; char *default_num = NULL; char *override_num = NULL; + int timeout; + + timeout = env_get_ulong("pxe_timeout", 10, DIV_ROUND_UP(cfg->timeout, 10)); /* * Create a menu and add items for all the labels. */ - m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10), + m = menu_create(cfg->title, timeout, cfg->prompt, NULL, label_print, NULL, NULL, NULL); if (!m) return NULL; diff --git a/test/boot/pxe.c b/test/boot/pxe.c index 8c526e1ba59..36e1f5519f4 100644 --- a/test/boot/pxe.c +++ b/test/boot/pxe.c @@ -276,6 +276,7 @@ static int pxe_test_sysboot_norun(struct unit_test_state *uts) ut_assertok(env_set_hex("fdt_addr_r", PXE_FDT_ADDR)); ut_assertok(env_set_hex("fdtoverlay_addr_r", PXE_OVERLAY_ADDR)); ut_assertok(env_set("bootfile", cfg_path)); + ut_assertok(env_set("pxe_timeout", "1")); /* * Run sysboot - it will try all labels and return 0 after failing -- 2.43.0