Skip to content

Commit 1d58b11

Browse files
committed
menus.robot: Add first_line parameter to menu parsing kwds
Helps to remove unwanted contents from the parsed menu in case of connection errors Signed-off-by: Filip Gołaś <[email protected]>
1 parent 0a66937 commit 1d58b11

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lib/bios/menus.robot

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ Get Menu Construction
308308
... \ the top of the menu
309309
... - ``${lines_bot}``: ``integer`` - number of lines to be dropped from
310310
... \ the bottom of the menu
311+
... - ``${first_line}``: ``string`` - drops all lines up to this one. Helps
312+
... \ to prevent unwanted elements being parsed as the menu contents when
313+
... \ connection errors are present
311314
...
312315
... === Return Value ===
313316
... - ``string`` - The setup menu construction, line by line
@@ -369,6 +372,7 @@ Parse Menu Snapshot Into Construction
369372
# A little workaround for random characters creating non-existent entries
370373
IF ${TELNET_FUZZY_MAX_INSERTIONS} + ${TELNET_FUZZY_MAX_ERRORS} > 0
371374
${line_valid}= Evaluate ($length > 1) or ($length > 0 and $line not in ["@", "`"])
375+
${line_valid}= Evaluate $line_valid and "----------" not in $line
372376
END
373377

374378
IF ${line_valid} Append To List ${construction} ${line}
@@ -437,20 +441,23 @@ Get Submenu Construction
437441
... \ the bottom of the menu
438442
... - ``${opt_only}``: ``boolean`` - if ``${TRUE}``, filters the menu
439443
... \ for configurable UEFI options
444+
... - ``${first_line}``: ``string`` - drops all lines up to this one. Helps
445+
... \ to prevent unwanted elements being parsed as the menu contents when
446+
... \ connection errors are present
440447
...
441448
... === Return Value ===
442449
... - ``string`` - The setup menu construction, line by line
443450
...
444451
... === Effects ===
445452
... - The setup submenu is read from the serial buffer
446-
[Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}"
453+
[Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" ${first_line}=${NONE}
447454

448455
# In most cases, we need to strip two lines:
449456
# TOP:
450457
# Title line, such as: Dasharo System Features
451458
# BOTTOM:
452459
# Help line, such as: F9=Reset to Defaults Esc=Exit
453-
${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot}
460+
${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} first_line=${first_line}
454461
# Handling of additional exceptions appearing in submenus:
455462
# 1. Drop unselectable strings from Device Manager
456463
Remove Values From List ${submenu} Devices List
@@ -511,17 +518,20 @@ Enter Submenu From Snapshot And Return Construction
511518
... - ``${option}``: ``string`` - the name of the submenu to enter
512519
... - ``${opt_only}``: ``boolean`` - if ``${TRUE}``, filters the returned
513520
... \ menu contents for configurable UEFI options
521+
... - ``${first_line}``: ``string`` - drops all lines up to this one. Helps
522+
... \ to prevent unwanted elements being parsed as the menu contents when
523+
... \ connection errors are present
514524
...
515525
... === Return Value ===
516526
... - ``string`` - The setup menu contents, line by line
517527
...
518528
... === Effects ===
519529
... - A setup submenu is entered
520530
... - The setup submenu is read from the serial buffer
521-
[Arguments] ${menu} ${option} ${opt_only}=${FALSE}
531+
[Arguments] ${menu} ${option} ${opt_only}=${FALSE} ${first_line}=${NONE}
522532

523533
Enter Submenu From Snapshot ${menu} ${option}
524-
${submenu}= Get Submenu Construction opt_only=${opt_only}
534+
${submenu}= Get Submenu Construction opt_only=${opt_only} first_line=${first_line}
525535
RETURN ${submenu}
526536

527537
Enter Dasharo System Features
@@ -546,6 +556,7 @@ Enter Dasharo System Features
546556
${dasharo_menu}= Enter Submenu From Snapshot And Return Construction
547557
... ${setup_menu}
548558
... Dasharo System Features
559+
... first_line=> Dasharo Security Options
549560
RETURN ${dasharo_menu}
550561

551562
Enter Dasharo APU Configuration

0 commit comments

Comments
 (0)