From 11eadb7ecbcf595aff1f27ecab3f8b16a3dc0486 Mon Sep 17 00:00:00 2001 From: Jan Prusinowski Date: Mon, 12 Aug 2024 11:30:01 +0200 Subject: [PATCH] menus.robot: Reworked Tianocore Reset System not to use \x1bR\x1br\x1bR setup-and-boot-menus.robot: Added stress test for Tianocore Reset System Signed-off-by: Jan Prusinowski --- lib/bios/menus.robot | 50 +++++++++++++++++++++++++-- self-tests/setup-and-boot-menus.robot | 12 +++++++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/lib/bios/menus.robot b/lib/bios/menus.robot index a460d6277..6cb82b9e5 100644 --- a/lib/bios/menus.robot +++ b/lib/bios/menus.robot @@ -24,6 +24,7 @@ Enter Boot Menu Tianocore Get Boot Menu Construction [Documentation] Keyword allows to get and return boot menu construction. + Sleep 1s ${menu}= Read From Terminal Until exit # Lines to strip: # TOP: @@ -535,13 +536,36 @@ Remove Disk Password END Press Key N Times 1 ${SETUP_MENU_KEY} +Send Reboot Command + Telnet.Write Bare \x1bR\x1br\x1bR + Tianocore Reset System - # EDK2 interprets Alt + Ctrl + Del on USB keyboards as reset combination. - # On serial console it is ESC R ESC r ESC R. IF '${DUT_CONNECTION_METHOD}' == 'SSH' FAIL SSH not supported for interfacing with TianoCore ELSE IF '${DUT_CONNECTION_METHOD}' == 'Telnet' - Telnet.Write Bare \x1bR\x1br\x1bR + FOR ${i} IN RANGE 0 5 + ${out}= Read From Terminal + + # Clean up the string + ${out}= Replace String ${out} \n ${EMPTY} + ${out}= Replace String ${out} \t ${EMPTY} + ${out}= Strip String ${out} + + Set Test Variable ${CHECK} ${FALSE} + IF 'Continue' in '${out}' + IF 'Reset' in '${out}' + Set Test Variable ${CHECK} ${TRUE} + END + END + + IF ${CHECK} == ${TRUE} + Go To Reset Option + BREAK + ELSE + Sleep 1s + Telnet.Write Bare ${ESC} + END + END ELSE IF '${DUT_CONNECTION_METHOD}' == 'open-bmc' FAIL OpenBMC not yet supported for interfacing with TianoCore ELSE IF '${DUT_CONNECTION_METHOD}' == 'pikvm' @@ -551,6 +575,26 @@ Tianocore Reset System FAIL Unknown connection method for config: ${CONFIG} END +Go To Reset Option + Set Test Variable ${MAX_TRIES} 20 + FOR ${index} IN RANGE 0 ${MAX_TRIES} + ${out}= Read From Terminal + + # Clean up the string + ${out}= Replace String ${out} \n ${EMPTY} + ${out}= Replace String ${out} \t ${EMPTY} + ${out}= Strip String ${out} + + Sleep 1s + IF 'the language for the' in '${out}' + Telnet.Write Bare ${ENTER} + BREAK + ELSE + IF ${index} == ${MAX_TRIES} Fail + Telnet.Write Bare ${ARROW_UP} + END + END + Save Changes [Documentation] Saves current UEFI settings Press Key N Times 1 ${F10} diff --git a/self-tests/setup-and-boot-menus.robot b/self-tests/setup-and-boot-menus.robot index 69bc3c724..9ff2db40c 100644 --- a/self-tests/setup-and-boot-menus.robot +++ b/self-tests/setup-and-boot-menus.robot @@ -239,3 +239,15 @@ Get Menu Construction Stress Test Run Keyword And Continue On Failure Should Not Contain ${line} disabled. END END + +Tianocore Reset System Stress Test + FOR ${i} IN RANGE 1 50 + Log To Console Run: ${i} + Power On + ${sb_menu}= Enter Secure Boot Menu And Return Construction + Enable Secure Boot ${sb_menu} + Save Changes And Reset + # Tianocore Reset System + # Boot System Or From Connected Disk ubuntu + # Login To Linux + END