Skip to content

Commit 728bf25

Browse files
committed
lib/bios: move Boot System Or From Connected Disk to common lib
Signed-off-by: Filip Lewiński <[email protected]>
1 parent c7f0aeb commit 728bf25

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

lib/bios/common.robot

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,55 @@ Get Index Of Matching Option In Menu
112112
Should Be True ${index} >= 0 Option ${option} not found in the list
113113
END
114114
RETURN ${index}
115+
116+
Boot System Or From Connected Disk # robocop: disable=too-long-keyword
117+
[Documentation] Tries to boot ${system_name}. If it is not possible then it tries
118+
... to boot from connected disk set up in config
119+
[Arguments] ${system_name}
120+
IF '${DUT_CONNECTION_METHOD}' == 'SSH' RETURN
121+
122+
IF '''${SEABIOS_BOOT_DEVICE}''' != ''
123+
Read From Terminal Until for boot menu
124+
Write Bare Into Terminal ${BOOT_MENU_KEY}
125+
Read From Terminal Until Select boot device
126+
Write Bare Into Terminal ${SEABIOS_BOOT_DEVICE}
127+
RETURN
128+
END
129+
${menu_construction}= Enter Boot Menu And Return Construction
130+
# With ESP scanning feature boot entries are named differently:
131+
IF ${ESP_SCANNING_SUPPORT} == ${TRUE}
132+
IF "${system_name}" == "ubuntu"
133+
${system_name}= Set Variable Ubuntu
134+
END
135+
IF "${system_name}" == "trenchboot" and "${MANUFACTURER}" == "QEMU"
136+
${system_name}= Set Variable QEMU HARDDISK
137+
END
138+
END
139+
${is_system_present}= Evaluate "${system_name}" in """${menu_construction}"""
140+
IF not ${is_system_present}
141+
${ssd_list}= Get Current CONFIG List Param Storage_SSD boot_name
142+
${ssd_list_length}= Get Length ${ssd_list}
143+
IF ${ssd_list_length} == 0
144+
${hdd_list}= Get Current CONFIG List Param HDD_Storage boot_name
145+
${hdd_list_length}= Get Length ${hdd_list}
146+
IF ${hdd_list_length} == 0
147+
${mmc_list}= Get Current CONFIG List Param MMC_Storage boot_name
148+
${mmc_list_length}= Get Length ${mmc_list}
149+
IF ${mmc_list_length} == 0
150+
FAIL "System was not found and there are no disk connected"
151+
END
152+
${disk_name}= Set Variable ${mmc_list[0]}
153+
ELSE
154+
${disk_name}= Set Variable ${hdd_list[0]}
155+
END
156+
ELSE
157+
${disk_name}= Set Variable ${ssd_list[0]}
158+
END
159+
${system_index}= Get Index From List ${menu_construction} ${disk_name}
160+
IF ${system_index} == -1
161+
Fail Disk: ${disk_name} not found in Boot Menu
162+
END
163+
ELSE
164+
${system_index}= Get Index Of Matching Option In Menu ${menu_construction} ${system_name}
165+
END
166+
Press Key N Times And Enter ${system_index} ${ARROW_DOWN}

lib/bios/edk2.robot

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -481,58 +481,6 @@ Save Changes And Reset
481481
Save Changes
482482
Tianocore Reset System
483483

484-
Boot System Or From Connected Disk # robocop: disable=too-long-keyword
485-
[Documentation] Tries to boot ${system_name}. If it is not possible then it tries
486-
... to boot from connected disk set up in config
487-
[Arguments] ${system_name}
488-
IF '${DUT_CONNECTION_METHOD}' == 'SSH' RETURN
489-
490-
IF '''${SEABIOS_BOOT_DEVICE}''' != ''
491-
Read From Terminal Until Press F10 key now for boot menu
492-
Write Bare Into Terminal ${F10}
493-
Read From Terminal Until Select boot device
494-
Write Bare Into Terminal ${SEABIOS_BOOT_DEVICE}
495-
RETURN
496-
END
497-
${menu_construction}= Enter Boot Menu And Return Construction
498-
# With ESP scanning feature boot entries are named differently:
499-
IF ${ESP_SCANNING_SUPPORT} == ${TRUE}
500-
IF "${system_name}" == "ubuntu"
501-
${system_name}= Set Variable Ubuntu
502-
END
503-
IF "${system_name}" == "trenchboot" and "${MANUFACTURER}" == "QEMU"
504-
${system_name}= Set Variable QEMU HARDDISK
505-
END
506-
END
507-
${is_system_present}= Evaluate "${system_name}" in """${menu_construction}"""
508-
IF not ${is_system_present}
509-
${ssd_list}= Get Current CONFIG List Param Storage_SSD boot_name
510-
${ssd_list_length}= Get Length ${ssd_list}
511-
IF ${ssd_list_length} == 0
512-
${hdd_list}= Get Current CONFIG List Param HDD_Storage boot_name
513-
${hdd_list_length}= Get Length ${hdd_list}
514-
IF ${hdd_list_length} == 0
515-
${mmc_list}= Get Current CONFIG List Param MMC_Storage boot_name
516-
${mmc_list_length}= Get Length ${mmc_list}
517-
IF ${mmc_list_length} == 0
518-
FAIL "System was not found and there are no disk connected"
519-
END
520-
${disk_name}= Set Variable ${mmc_list[0]}
521-
ELSE
522-
${disk_name}= Set Variable ${hdd_list[0]}
523-
END
524-
ELSE
525-
${disk_name}= Set Variable ${ssd_list[0]}
526-
END
527-
${system_index}= Get Index From List ${menu_construction} ${disk_name}
528-
IF ${system_index} == -1
529-
Fail Disk: ${disk_name} not found in Boot Menu
530-
END
531-
ELSE
532-
${system_index}= Get Index Of Matching Option In Menu ${menu_construction} ${system_name}
533-
END
534-
Press Key N Times And Enter ${system_index} ${ARROW_DOWN}
535-
536484
Make Sure That Network Boot Is Enabled
537485
[Documentation] This keywords checks that "Enable network boot" in
538486
... "Networking Options" is enabled when present, so the network

0 commit comments

Comments
 (0)