-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add efibootmgr modification as a test-suite
Incoming ghaf PR#585 Change internal installation approach is going to change the installation method significantly. After the merge of PR#585 ghaf-installer will create always a new Linux Boot Manager entry to UEFI boot order list and thus set the machine to boot from nvme regardless if USB SSD is connected. Here introduced efiboot-mod test will automatically remove all Linux entries from the UEFI boot order list. Wiping nvme clear could do the same but it is not possible to automatically clear nvme if boot is locked to nvme. Also it is good to not let the UEFI boot order list be flooded endlessly with Linux Boot Manager entries. There is still a risk that the ghaf which the ghaf-installer has installed is broken and unbootable and new Linux Boot Manager entry is active. This would cause ci-test-automation not being able to boot automatically from nvme nor from USB SSD, and the system should be fixed manually (Linux Boot Manager removed). To avoid this happening plain ghaf image test should be ran first and only if the ghaf image is bootable then proceed to ghaf-installer tests. Signed-off-by: Samuli Leivo <[email protected]>
- Loading branch information
1 parent
1cb11f9
commit 7a780b7
Showing
4 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII) | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
*** Settings *** | ||
Documentation Modify boot order | ||
Resource ../../resources/ssh_keywords.resource | ||
Resource ../../config/variables.robot | ||
Suite Setup Common Setup | ||
Suite Teardown Common Teardown | ||
|
||
|
||
*** Keywords *** | ||
|
||
Common Setup | ||
Set Variables ${DEVICE} | ||
|
||
Common Teardown | ||
Close All Connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
for f in $(efibootmgr | grep Linux | awk 'NR > 0 {print $1}' | cut -c 5-8) | ||
do | ||
sudo efibootmgr -q -b ${f} -B | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII) | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
*** Settings *** | ||
Documentation Removing Linux Boot Manager entries from UEFI boot order. | ||
Force Tags efiboot-mod | ||
Resource ../../resources/serial_keywords.resource | ||
Resource ../../resources/ssh_keywords.resource | ||
Resource ../../resources/device_control.resource | ||
Resource ../../config/variables.robot | ||
|
||
|
||
*** Variables *** | ||
${CONNECTION_TYPE} ssh | ||
${IS_AVAILABLE} False | ||
${DEVICE_TYPE} ${EMPTY} | ||
${ENTRIES} | ||
|
||
*** Test Cases *** | ||
|
||
Remove Linux Boot Manager entries | ||
[Documentation] Remove all Linux Boot Manager entries from UEFI boot order list | ||
[Tags] lenovo-x1 efiboot-mod | ||
Check If Device Is Up | ||
IF ${IS_AVAILABLE} == False | ||
FAIL Cannot modify the UEFI boot order | ||
ELSE | ||
Log To Console Connecting to ghaf-host | ||
END | ||
|
||
Connect | ||
Put File efibootmgr/efiboot_mod_script /home/ghaf | ||
Execute Command chmod 777 efiboot_mod_script sudo=True sudo_password=${PASSWORD} | ||
Log To Console Deleting all 'Linux' entries from UEFI boot order with efibootmgr | ||
Execute Command ./efiboot_mod_script sudo=True sudo_password=${PASSWORD} | ||
${ENTRIES} Execute Command efibootmgr | grep Linux | ||
Log To Console efibootmgr check after removing Linux Boot Manager entries: \n${ENTRIES} | ||
IF "${ENTRIES}" != "" | ||
FAIL Failed in removing all Linux Boot Manager entries | ||
ELSE | ||
Log To Console All Linux Boot Manager entries cleared | ||
END | ||
[Teardown] Teardown | ||
|
||
|
||
*** Keywords *** | ||
|
||
Teardown | ||
IF "${CONNECTION_TYPE}" == "ssh" | ||
Run Keyword If Test Failed ssh_keywords.Save log | ||
ELSE IF "${CONNECTION_TYPE}" == "serial" | ||
Run Keyword If Test Failed serial_keywords.Save log | ||
END | ||
Close All Connections | ||
Delete All Ports | ||
|
||
Check If Device Is Up | ||
[Arguments] ${range}=5 | ||
Set Global Variable ${IS_AVAILABLE} False | ||
${start_time}= Get Time epoch | ||
FOR ${i} IN RANGE ${range} | ||
${ping}= Ping Host ${DEVICE_IP_ADDRESS} | ||
IF ${ping} | ||
Log To Console Ping ${DEVICE_IP_ADDRESS} successfull | ||
BREAK | ||
END | ||
Sleep 1 | ||
END | ||
|
||
IF ${ping} | ||
${port_22_is_available} Check if ssh is ready on device | ||
IF ${port_22_is_available} | ||
Set Global Variable ${IS_AVAILABLE} True | ||
ELSE | ||
Set Global Variable ${IS_AVAILABLE} False | ||
END | ||
END | ||
|
||
${diff}= Evaluate int(time.time()) - int(${start_time}) | ||
|
||
IF ${IS_AVAILABLE} Log To Console Device ssh port available. | ||
|
||
IF ${IS_AVAILABLE} == False | ||
Log To Console Device is not available! | ||
IF "${SERIAL_PORT}" == "NONE" | ||
Log To Console There is no address for serial connection | ||
ELSE | ||
Check Serial Connection | ||
END | ||
END |