From 2a1aba866df8d78f5e66bdbf500015a7b9507c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 22 Nov 2024 16:15:39 +0100 Subject: [PATCH 01/33] add support for BIOS_LIB uefi or seabios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- keywords.robot | 12 ++++++++++++ scripts/ci/qemu-self-test-seabios.sh | 21 +++++++++++++++++++++ scripts/ci/qemu-self-test.sh | 14 +++++++------- 3 files changed, 40 insertions(+), 7 deletions(-) create mode 100755 scripts/ci/qemu-self-test-seabios.sh diff --git a/keywords.robot b/keywords.robot index d0d81aef6c..f11882037b 100644 --- a/keywords.robot +++ b/keywords.robot @@ -551,6 +551,18 @@ Prepare Test Suite FAIL Unknown connection method: ${DUT_CONNECTION_METHOD} for config: ${CONFIG} END IF '${CONFIG}' == 'rpi-3b' Verify Number Of Connected SD Wire Devices + Import BIOS Libraries + +Import BIOS Libraries + [Documentation] Import BIOS libraries based on config and command + ... line variables + IF '${BIOS_LIB}' == 'uefi' + Import Resource ${CURDIR}/lib/bios/menus.robot + ELSE IF '${BIOS_LIB}' == 'seabios' + Import Resource ${CURDIR}/lib/bios/seabios.robot + ELSE + FAIL Unknown BIOS library: ${BIOS_LIB} + END Import Osfv Libraries [Documentation] Import osfv_cli libraries based on config and command diff --git a/scripts/ci/qemu-self-test-seabios.sh b/scripts/ci/qemu-self-test-seabios.sh new file mode 100755 index 0000000000..44082e81b1 --- /dev/null +++ b/scripts/ci/qemu-self-test-seabios.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Define an array of commands +commands=( + "robot -X -L TRACE -v BIOS_LIB:seabios -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-seabios -v snipeit:no self-tests/setup-and-boot-seabios.robot" +) + +# Initialize a variable to track overall success +overall_success=0 + +# Execute each command and capture the exit codes +for cmd in "${commands[@]}"; do + eval $cmd + exit_code=$? + if [ $exit_code -ne 0 ]; then + overall_success=1 + fi +done + +# Exit with the appropriate status +exit $overall_success diff --git a/scripts/ci/qemu-self-test.sh b/scripts/ci/qemu-self-test.sh index 54427e3ed8..75ad8e1e53 100755 --- a/scripts/ci/qemu-self-test.sh +++ b/scripts/ci/qemu-self-test.sh @@ -2,13 +2,13 @@ # Define an array of commands commands=( - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no self-tests/setup-and-boot-menus.robot" - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/dasharo-system-features-menus -v snipeit:no self-tests/dasharo-system-features-menus.robot" - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/boolean-options -v snipeit:no self-tests/boolean-options.robot" - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/numerical-options -v snipeit:no self-tests/numerical-options.robot" - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/list-options -v snipeit:no self-tests/list-options.robot" - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/secure-boot -v snipeit:no self-tests/secure-boot.robot" - "robot -L TRACE -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/self-tests -v snipeit:no self-tests/terminal.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no self-tests/setup-and-boot-menus.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/dasharo-system-features-menus -v snipeit:no self-tests/dasharo-system-features-menus.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/boolean-options -v snipeit:no self-tests/boolean-options.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/numerical-options -v snipeit:no self-tests/numerical-options.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/list-options -v snipeit:no self-tests/list-options.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/secure-boot -v snipeit:no self-tests/secure-boot.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/self-tests -v snipeit:no self-tests/terminal.robot" ) # Initialize a variable to track overall success From 38dbe77ec479740a955749194f058c0d90cfa4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 8 Nov 2024 14:57:14 +0100 Subject: [PATCH 02/33] add lib/bios/seabios.robot, remove resource menus.robot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król Signed-off-by: Piotr Król --- keywords.robot | 1 - lib/bios/seabios.robot | 139 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 lib/bios/seabios.robot diff --git a/keywords.robot b/keywords.robot index f11882037b..8640242bf4 100644 --- a/keywords.robot +++ b/keywords.robot @@ -2,7 +2,6 @@ Library Collections Library OperatingSystem Resource pikvm-rest-api/pikvm_comm.robot -Resource lib/bios/menus.robot Resource lib/secure-boot-lib.robot Resource lib/usb-hid-msc-lib.robot Resource lib/dts-lib.robot diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot new file mode 100644 index 0000000000..7515b22be0 --- /dev/null +++ b/lib/bios/seabios.robot @@ -0,0 +1,139 @@ +*** Settings *** +Documentation Collection of keywords related to SeaBIOS + +Library Collections +Library String + +*** Keywords *** +Enter Boot Menu SeaBIOS + [Documentation] Enter Boot Menu with SeaBIOS boot menu key mapped in + ... keys list. + Read From Terminal Until ${SEABIOS_STRING} + IF '${DUT_CONNECTION_METHOD}' == 'pikvm' + Single Key PiKVM ${BOOT_MENU_KEY} + ELSE + Write Bare Into Terminal ${BOOT_MENU_KEY} + END + IF ${LAPTOP_EC_SERIAL_WORKAROUND} == ${TRUE} + # FIXME: Laptop EC serial workaround + Press Key N Times 1 ${ARROW_DOWN} + Press Key N Times 1 ${ARROW_UP} + END + +Get Boot Menu Construction + [Documentation] Keyword allows to get and return boot menu construction. + ${menu}= Read From Terminal Until TPM Configuration + # Lines to strip: + # Select boot device: + # + # 1. DVD/CD [AHCI/2: QEMU DVD-ROM ATAPI-4 DVD/CD] + # 2. iPXE + # 3. Payload [setup] + # 4. Payload [memtest] + # + # t. TPM Configuration + ${construction}= Parse Menu Snapshot Into Construction ${menu} 1 0 + RETURN ${construction} + +Enter Boot Menu SeaBIOS And Return Construction + [Documentation] Enters boot menu, returning menu construction + Enter Boot Menu SeaBIOS + ${menu}= Get Boot Menu Construction + RETURN ${menu} + +Enter sortbootorder + [Documentation] Enter sortbootorder with Boot Menu Consruction. + Enter Boot Menu SeaBIOS + ${menu}= Get Boot Menu Construction + Enter Boot Menu From Snapshot ${menu} \[setup\] + +Enter TPM Configuration + [Documentation] Enter TPM Configuration with Boot Menu Consruction. + Enter Boot Menu SeaBIOS + ${menu}= Get Boot Menu Construction + Enter Boot Menu From Snapshot ${menu} TPM Configuration + +Enter iPXE + [Documentation] Enter iPXE with Boot Menu Consruction. + Enter Boot Menu SeaBIOS + ${menu}= Get Boot Menu Construction + Enter Boot Menu From Snapshot ${menu} iPXE + +Parse Menu Snapshot Into Construction + [Documentation] Breaks grabbed menu data into lines. + [Arguments] ${menu} ${lines_top} ${lines_bot} + ${slice_start}= Set Variable ${lines_top} + IF ${lines_bot} == 0 + ${slice_end}= Set Variable None + ELSE + ${slice_end}= Evaluate ${lines_bot} * -1 + END + ${menu}= Remove String ${menu} \r + @{menu_lines}= Split To Lines ${menu} + @{construction}= Create List + FOR ${line} IN @{menu_lines} + # Replace multiple spaces with a single one + ${line}= Replace String Using Regexp ${line} ${SPACE}+ ${SPACE} + # Remove leading and trailing spaces + ${line}= Strip String ${line} + # Drop leading and trailing pipes (e.g. in One Time Boot Menu) + ${line}= Strip String ${line} characters=| + # Remove leading and trailing spaces + ${line}= Strip String ${line} + # Drop all remaining borders + ${line}= Remove String Using Regexp ${line} ^[\\|\\s/\\\\-]+$ + # If the resulting line is not empty, add it as a menu entry + ${length}= Get Length ${line} + IF ${length} > 0 Append To List ${construction} ${line} + END + Log ${construction} + ${construction}= Get Slice From List ${construction} ${slice_start} ${slice_end} + # TODO: Improve parsing of the menu into construction. It can probably be + # simplified, but at least we have this only in one kewyrod not in multiple + # ones. + # Make sure to remove control help text appearing in the screen if somehow + # they are still there. + Remove Values From List + ... ${construction} + ... Esc\=Exit + ... ^v\=Move High + ... \=Select Entry + ... F9\=Reset to Defaults F10\=Save + ... LCtrl+LAlt+F12\=Save screenshot + ... Toggle Checkbox + ... one adjusts to change + RETURN ${construction} + +Enter Setup Menu SeaBIOS And Return Construction + [Documentation] Enters Setup Menu and returns Setup Menu construction + Enter Setup Menu SeaBIOS + ${menu}= Get Setup Menu Construction + RETURN ${menu} + +Enter Boot Menu From Snapshot + [Documentation] Enter given Boot Menu SeaBIOS option + [Arguments] ${menu} ${option} + ${key}= Extract SeaBIOS Menu Key ${menu} ${option} + Write Bare Into Terminal ${key} + +Extract SeaBIOS Menu Key + [Documentation] Extract key which should be hit to enter given Menu in SeaBIOS + [Arguments] ${menu} ${option} + FOR ${item} IN @{menu} + ${matches}= Run Keyword And Return Status + ... Should Match ${item} *${option}* + IF ${matches} + ${option}= Set Variable ${item} + BREAK + END + END + ${key} Set Variable ${option.split('.')[0]} + RETURN ${key} + +Get IPXE Boot Menu Construction + [Documentation] Keyword allows to get and return iPXE menu construction. + [Arguments] ${lines_top}=1 ${lines_bot}=0 ${checkpoint}=${EDK2_IPXE_CHECKPOINT} + ${menu}= Read From Terminal Until ${checkpoint} + ${construction}= Parse Menu Snapshot Into Construction ${menu} ${lines_top} ${lines_bot} + RETURN ${construction} + From 44b50189c05954e2253544e31694e0397ab6ad33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 8 Nov 2024 14:58:09 +0100 Subject: [PATCH 03/33] platform-configs/include/default.robot: disable OPTIONS_LIB, which depends on menus.robot and conflict seabios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- keywords.robot | 1 + platform-configs/include/default.robot | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/keywords.robot b/keywords.robot index 8640242bf4..cec1ad086f 100644 --- a/keywords.robot +++ b/keywords.robot @@ -557,6 +557,7 @@ Import BIOS Libraries ... line variables IF '${BIOS_LIB}' == 'uefi' Import Resource ${CURDIR}/lib/bios/menus.robot + Import Resource ${CURDIR}/lib/options/${OPTIONS_LIB}.robot ELSE IF '${BIOS_LIB}' == 'seabios' Import Resource ${CURDIR}/lib/bios/seabios.robot ELSE diff --git a/platform-configs/include/default.robot b/platform-configs/include/default.robot index 2e39a32314..083280cc91 100644 --- a/platform-configs/include/default.robot +++ b/platform-configs/include/default.robot @@ -1,7 +1,6 @@ *** Settings *** Resource ../../os-config/windows-credentials.robot Resource ../../os-config/ubuntu-credentials.robot -Resource ../../lib/options/${OPTIONS_LIB}.robot *** Variables *** From 55e14fa87eb49b23a63ee4f49c4a3457308412af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 8 Nov 2024 14:58:39 +0100 Subject: [PATCH 04/33] platform-configs/qemu-selftests.robot: change configuration to one used by seabios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- platform-configs/qemu-selftests-seabios.robot | 54 +++++++++++++++++++ ...ftests.robot => qemu-selftests-uefi.robot} | 0 scripts/ci/qemu-self-test.sh | 14 ++--- 3 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 platform-configs/qemu-selftests-seabios.robot rename platform-configs/{qemu-selftests.robot => qemu-selftests-uefi.robot} (100%) diff --git a/platform-configs/qemu-selftests-seabios.robot b/platform-configs/qemu-selftests-seabios.robot new file mode 100644 index 0000000000..674f0babee --- /dev/null +++ b/platform-configs/qemu-selftests-seabios.robot @@ -0,0 +1,54 @@ +*** Comments *** +This config targets QEMU firmware with as many menus enabled as possible. + + +*** Settings *** +Library ../lib/QemuMonitor.py /tmp/qmp-socket +Resource include/default.robot + + +*** Variables *** +${INITIAL_DUT_CONNECTION_METHOD}= Telnet +${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} +${RTE_S2_N_PORT}= 1234 +${FLASH_SIZE}= ${8*1024*1024} +${SEABIOS_STRING}= for boot menu +${BOOT_MENU_KEY}= ${F10} +${SETUP_MENU_KEY}= ${F2} +${MANUFACTURER}= QEMU +${POWER_CTRL}= RteCtrl +${FLASHING_METHOD}= none + +${DMIDECODE_SERIAL_NUMBER}= N/A +${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+UEFI) v0.2.0 +${DMIDECODE_PRODUCT_NAME}= QEMU x86 q35/ich9 +${DMIDECODE_RELEASE_DATE}= 06/21/2024 +${DMIDECODE_MANUFACTURER}= Emulation +${DMIDECODE_VENDOR}= 3mdeb +${DMIDECODE_FAMILY}= N/A +${DMIDECODE_TYPE}= Desktop + +# Supported test environments +${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE} +${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE} +${TESTS_IN_METATB_SUPPORT}= ${TRUE} + +# Regression test flags +${DASHARO_SECURITY_MENU_SUPPORT}= ${TRUE} +${DASHARO_USB_MENU_SUPPORT}= ${TRUE} +${DASHARO_NETWORKING_MENU_SUPPORT}= ${TRUE} +${DASHARO_INTEL_ME_MENU_SUPPORT}= ${TRUE} +${DASHARO_CHIPSET_MENU_SUPPORT}= ${TRUE} +${DASHARO_POWER_MGMT_MENU_SUPPORT}= ${TRUE} +${DASHARO_PCI_PCIE_MENU_SUPPORT}= ${TRUE} +${DASHARO_MEMORY_MENU_SUPPORT}= ${TRUE} + + +*** Keywords *** +Power On + [Documentation] Keyword clears telnet buffer and sets Device Under Test + ... into Power On state using RTE OC buffers. Implementation + ... must be compatible with the theory of operation of a + ... specific platform. + Read From Terminal + Qemu Monitor.System Reset diff --git a/platform-configs/qemu-selftests.robot b/platform-configs/qemu-selftests-uefi.robot similarity index 100% rename from platform-configs/qemu-selftests.robot rename to platform-configs/qemu-selftests-uefi.robot diff --git a/scripts/ci/qemu-self-test.sh b/scripts/ci/qemu-self-test.sh index 75ad8e1e53..08fbfcfae9 100755 --- a/scripts/ci/qemu-self-test.sh +++ b/scripts/ci/qemu-self-test.sh @@ -2,13 +2,13 @@ # Define an array of commands commands=( - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no self-tests/setup-and-boot-menus.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/dasharo-system-features-menus -v snipeit:no self-tests/dasharo-system-features-menus.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/boolean-options -v snipeit:no self-tests/boolean-options.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/numerical-options -v snipeit:no self-tests/numerical-options.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/list-options -v snipeit:no self-tests/list-options.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/secure-boot -v snipeit:no self-tests/secure-boot.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/self-tests -v snipeit:no self-tests/terminal.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no self-tests/setup-and-boot-menus.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/dasharo-system-features-menus -v snipeit:no self-tests/dasharo-system-features-menus.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/boolean-options -v snipeit:no self-tests/boolean-options.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/numerical-options -v snipeit:no self-tests/numerical-options.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/list-options -v snipeit:no self-tests/list-options.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/secure-boot -v snipeit:no self-tests/secure-boot.robot" + "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/self-tests -v snipeit:no self-tests/terminal.robot" ) # Initialize a variable to track overall success From 9fcaf080def114ae0bf536b8be440f0e8026b86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 8 Nov 2024 14:59:17 +0100 Subject: [PATCH 05/33] scripts/ci/qemu-run.sh: give ability to provide QEMU_FW_FILE through env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- scripts/ci/qemu-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/qemu-run.sh b/scripts/ci/qemu-run.sh index 3492446425..c60b12ce5f 100755 --- a/scripts/ci/qemu-run.sh +++ b/scripts/ci/qemu-run.sh @@ -30,7 +30,7 @@ TPM_LOG_FILE="${TPM_DIR}/log" # some cases. # TPM_VERSION="2.0" -QEMU_FW_FILE="./qemu_q35.rom" +QEMU_FW_FILE=${QEMU_FW_FILE:-./qemu_q35.rom} usage() { cat < Date: Fri, 8 Nov 2024 14:59:46 +0100 Subject: [PATCH 06/33] scripts/ci/qemu-run.sh: enabled kvm only if it supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- scripts/ci/qemu-run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ci/qemu-run.sh b/scripts/ci/qemu-run.sh index c60b12ce5f..f13f9ea73c 100755 --- a/scripts/ci/qemu-run.sh +++ b/scripts/ci/qemu-run.sh @@ -139,9 +139,12 @@ QEMU_PARAMS_BASE="-machine q35,smm=on \ -tpmdev emulator,id=tpm0,chardev=chrtpm \ -device tpm-tis,tpmdev=tpm0 \ -smp 2 \ - -enable-kvm \ -mem-prealloc" +if [ "$(egrep -c '(vmx|svm)' /proc/cpuinfo)" -gt 0 ]; then + QEMU_PARAMS_BASE="${QEMU_PARAMS_BASE} -enable-kvm" +fi + QEMU_PARAMS_OS="-device ich9-intel-hda \ -device hda-duplex,audiodev=hda \ -audiodev pa,id=hda,server=${PULSE_SERVER},out.frequency=44100 \ From 9fed38689d514836ed62b83bd97830a399907cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 8 Nov 2024 15:00:29 +0100 Subject: [PATCH 07/33] scripts/ci/qemu-self-test-seabios.sh: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- scripts/ci/qemu-self-test-seabios.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/qemu-self-test-seabios.sh b/scripts/ci/qemu-self-test-seabios.sh index 44082e81b1..a56fbc0349 100755 --- a/scripts/ci/qemu-self-test-seabios.sh +++ b/scripts/ci/qemu-self-test-seabios.sh @@ -2,7 +2,7 @@ # Define an array of commands commands=( - "robot -X -L TRACE -v BIOS_LIB:seabios -v config:qemu-selftests -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-seabios -v snipeit:no self-tests/setup-and-boot-seabios.robot" + "robot -X -L TRACE -v BIOS_LIB:seabios -v config:qemu-selftests-seabios -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-seabios -v snipeit:no self-tests/setup-and-boot-seabios.robot" ) # Initialize a variable to track overall success From bba6a4d24f753481c2b2a93e30c22d4c5957f476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 8 Nov 2024 15:00:50 +0100 Subject: [PATCH 08/33] self-tests/setup-and-boot-seabios.robot: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- self-tests/setup-and-boot-seabios.robot | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 self-tests/setup-and-boot-seabios.robot diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot new file mode 100644 index 0000000000..4c4b517cbf --- /dev/null +++ b/self-tests/setup-and-boot-seabios.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation This suite verifies the correct operation of keywords +... entering and parsing Boot Menu, Setup Menu, and top-level submenus +... of the Setup Menu. + +Library Collections +Library OperatingSystem +Library Process +Library String +Library Telnet timeout=10 seconds connection_timeout=40 seconds +Library SSHLibrary timeout=90 seconds +Library RequestsLibrary +# TODO: maybe have a single file to include if we need to include the same +# stuff in all test cases +Resource ../variables.robot +Resource ../keywords.robot +Resource ../keys.robot +Resource ../pikvm-rest-api/pikvm_comm.robot + +# TODO: +# - document which setup/teardown keywords to use and what are they doing +# - go threough them and make sure they are doing what the name suggest (not +# exactly the case right now) +Suite Setup Run Keyword +... Prepare Test Suite +Suite Teardown Run Keyword +... Log Out And Close Connection + + +*** Test Cases *** +Enter Boot Menu SeaBIOS + [Documentation] Test Enter Boot Menu kwd + Power On + Enter Boot Menu SeaBIOS + ${out}= Read From Terminal Until [memtest] + Should Contain ${out} Select boot device: + +Enter Boot Menu SeaBIOS And Return Construction + [Documentation] Test Enter Boot Menu kwd + Power On + ${menu}= Enter Boot Menu SeaBIOS And Return Construction + List Should Not Contain Value ${menu} Select boot device: + List Should Contain Value ${menu} 1. DVD/CD [AHCI/2: QEMU DVD-ROM ATAPI-4 DVD/CD] + List Should Contain Value ${menu} 2. iPXE + List Should Contain Value ${menu} 3. Payload [setup] + List Should Contain Value ${menu} 4. Payload [memtest] + List Should Contain Value ${menu} t. TPM Configuration + Menu Construction Should Not Contain Control Text ${menu} + +Enter sortbootorder + [Documentation] Test Enter sortbootorder kwd + Power On + Enter sortbootorder + ${out}= Read From Terminal Until Save configuration and exit + Should Contain ${out} ### PC Engines QEMU x86 q35/ich9 setup + +Enter TPM Configuration + [Documentation] Test Enter TPM Configuration kwd + Power On + Enter TPM Configuration + ${out}= Read From Terminal Until reboot the machine + Should Contain ${out} Clear TPM + +Enter iPXE + [Documentation] Test Enter iPXE kwd + Power On + Enter iPXE + ${out}= Read From Terminal Until autoboot + Should Contain ${out} ipxe shell From d6d1c324b22e5bea2b30bfdc52cdbf30c8b958f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Tue, 12 Nov 2024 13:43:39 +0100 Subject: [PATCH 09/33] scripts: add support for Dasharo (coreboot+SeaBIOS) for QEMU Q35 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- .github/workflows/qemu-self-test.yml | 4 +-- scripts/ci/qemu-run.sh | 46 ++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.github/workflows/qemu-self-test.yml b/.github/workflows/qemu-self-test.yml index d53ee6fca1..06140390bd 100644 --- a/.github/workflows/qemu-self-test.yml +++ b/.github/workflows/qemu-self-test.yml @@ -1,4 +1,4 @@ -name: Keywords self-tests with QEMU +name: Keywords self-tests for Dasharo (coreboot+UEFI) on QEMU Q35 on: [push, pull_request] @@ -28,7 +28,7 @@ jobs: - name: Start QEMU in background run: | - ./scripts/ci/qemu-run.sh nographic firmware & + ./scripts/ci/qemu-run.sh nographic uefi & - name: Set up Python uses: actions/setup-python@v2 diff --git a/scripts/ci/qemu-run.sh b/scripts/ci/qemu-run.sh index f13f9ea73c..58c8b90832 100755 --- a/scripts/ci/qemu-run.sh +++ b/scripts/ci/qemu-run.sh @@ -44,9 +44,13 @@ This is the QEMU wrapper script for the Dasharo Open Source Firmware Validation. graphic graphic output is available in QEMU process window Available ACTIONS: - firmware a machine with lower resources assigned will be spawned and no disk - will be connected; suitable for firmware validation, but not for OS - booting + + uefi a machine with lower resources assigned will be spawned and no + disk will be connected; suitable for Dasharo (coreboot+UEFI) + validation, but not for OS booting + seabios a machine with lower resources assigned will be spawned and no + disk will be connected; suitable for Dasharo (coreboot+SeaBIOS) + validation, but not for OS booting os a machine with more resources assigned will be spawned and HDD from $HDD_PATH will be connected; suitable for firmware and OS validation, if some OS is already installed on the disk image, it can be booted @@ -57,7 +61,8 @@ This is the QEMU wrapper script for the Dasharo Open Source Firmware Validation. DIR working directory, defaults to current working directory Example usage: - ./$(basename $0) vnc firmware + ./$(basename $0) vnc uefi + ./$(basename $0) nographic seabios ./$(basename $0) graphic os_install DIR=/my/work/dir ./$(basename $0) graphic os @@ -128,8 +133,7 @@ if [ $# -ne 2 ]; then fi QEMU_PARAMS_BASE="-machine q35,smm=on \ - -global driver=cfi.pflash01,property=secure,value=on \ - -drive if=pflash,format=raw,unit=0,file=${QEMU_FW_FILE} \ + -drive if=pflash,format=raw,unit=0,file=${QEMU_FW_FILE} -global ICH9-LPC.disable_s3=1 \ -qmp unix:/tmp/qmp-socket,server,nowait \ -serial telnet:localhost:1234,server,nowait \ @@ -179,8 +183,17 @@ esac ACTION="$2" case "${ACTION}" in - firmware) + uefi) + MEMORY="1G" + QEMU_UEFI_PARAMS="-global driver=cfi.pflash01,property=secure,value=on" + QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_UEFI_PARAMS}" + ;; + seabios) MEMORY="1G" + QEMU_SEABIOS_PARAMS="-device e1000,netdev=net0,romfile="" \ + -netdev user,id=net0 \ + -monitor tcp:127.0.0.1:55555,server,nowait" + QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_SEABIOS_PARAMS}" ;; os) MEMORY="4G" @@ -199,21 +212,28 @@ case "${ACTION}" in esac # Check for the existence of QEMU firmware file -if [ ! -f "${QEMU_FW_FILE}" ]; then +if [ ! -f "${QEMU_FW_FILE}" ] && [ "${ACTION}" == "uefi" ]; then echo "The required file ${QEMU_FW_FILE} is missing." echo "Downloading from the server..." wget -O ${QEMU_FW_FILE} https://github.com/Dasharo/coreboot/releases/latest/download/qemu_q35_all_menus.rom +elif [ ! -f "${QEMU_FW_FILE}" ] && [ "${ACTION}" == "seabios" ]; then + echo "The required file ${QEMU_FW_FILE} is missing." + echo "Downloading from the server..." + wget -O ${QEMU_FW_FILE} https://github.com/Dasharo/dasharo-pq/releases/download/24.08.00.01-rc1/qemu_q35_24.08.00.01.rom else echo "${QEMU_FW_FILE} file exists in the directory." echo "To make sure you are using the latest version from: https://github.com/Dasharo/coreboot/releases" echo "simply remove it and let the script download the latest release." fi -echo "Clear UEFI variables" -echo "On each run on this script, the firmware settings would be restored to default." -dd if=/dev/zero of=${QEMU_FW_FILE} bs=256 count=1 conv=notrunc 2> /dev/null - -echo "Running QEMU Q35 with Dasharo (coreboot+UEFI) firmware ... (Ctrl+C to terminate)" +if [ "${ACTION}" == "uefi" ]; then + echo "Clear UEFI variables" + echo "On each run on this script, the firmware settings would be restored to default." + dd if=/dev/zero of=${QEMU_FW_FILE} bs=256 count=1 conv=notrunc 2> /dev/null + echo "Running QEMU Q35 with Dasharo (coreboot+UEFI) firmware ... (Ctrl+C to terminate)" +else + echo "Running QEMU Q35 with Dasharo (coreboot+SeaBIOS) firmware ... (Ctrl+C to terminate)" +fi tpm_start qemu-system-x86_64 -m ${MEMORY} ${QEMU_PARAMS} || cleanup From 87e2b6ff3556e4addd692af29d3fea7c5ab5e04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Thu, 14 Nov 2024 00:54:21 +0100 Subject: [PATCH 10/33] lib/bios/seabios.robot: add more keywords and its tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/seabios.robot | 208 +++++++++++++++++++++--- self-tests/setup-and-boot-seabios.robot | 82 +++++++++- 2 files changed, 263 insertions(+), 27 deletions(-) diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 7515b22be0..cffa96ebf5 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -1,9 +1,14 @@ *** Settings *** -Documentation Collection of keywords related to SeaBIOS +Documentation Collection of keywords related to SeaBIOS. +# Here is comparison of terms with lib/bios/menus.robot +# Tianocore -> SeaBIOS +# Setup Menu -> sortbootorder +# Library Collections Library String + *** Keywords *** Enter Boot Menu SeaBIOS [Documentation] Enter Boot Menu with SeaBIOS boot menu key mapped in @@ -30,7 +35,7 @@ Get Boot Menu Construction # 2. iPXE # 3. Payload [setup] # 4. Payload [memtest] - # + # # t. TPM Configuration ${construction}= Parse Menu Snapshot Into Construction ${menu} 1 0 RETURN ${construction} @@ -41,23 +46,19 @@ Enter Boot Menu SeaBIOS And Return Construction ${menu}= Get Boot Menu Construction RETURN ${menu} -Enter sortbootorder - [Documentation] Enter sortbootorder with Boot Menu Consruction. - Enter Boot Menu SeaBIOS - ${menu}= Get Boot Menu Construction - Enter Boot Menu From Snapshot ${menu} \[setup\] - -Enter TPM Configuration - [Documentation] Enter TPM Configuration with Boot Menu Consruction. +Enter Sortbootorder + [Documentation] Enter sortbootorder with Boot Menu Construction. Enter Boot Menu SeaBIOS ${menu}= Get Boot Menu Construction - Enter Boot Menu From Snapshot ${menu} TPM Configuration + Enter Menu From Snapshot ${menu} \[setup\] -Enter iPXE - [Documentation] Enter iPXE with Boot Menu Consruction. - Enter Boot Menu SeaBIOS - ${menu}= Get Boot Menu Construction - Enter Boot Menu From Snapshot ${menu} iPXE +Get Sortbootorder Menu Construction + [Documentation] Keyword allows to get and return sortbootorder menu construction. + [Arguments] ${checkpoint}=Save configuration and exit + # Lines to strip: + ${out}= Read From Terminal Until ${checkpoint} + ${menu}= Parse Menu Snapshot Into Construction ${out} 7 0 + RETURN ${menu} Parse Menu Snapshot Into Construction [Documentation] Breaks grabbed menu data into lines. @@ -102,6 +103,8 @@ Parse Menu Snapshot Into Construction ... LCtrl+LAlt+F12\=Save screenshot ... Toggle Checkbox ... one adjusts to change + ... Select boot device: + ... , N for PXE boot RETURN ${construction} Enter Setup Menu SeaBIOS And Return Construction @@ -110,13 +113,138 @@ Enter Setup Menu SeaBIOS And Return Construction ${menu}= Get Setup Menu Construction RETURN ${menu} -Enter Boot Menu From Snapshot - [Documentation] Enter given Boot Menu SeaBIOS option +Get RTC Clock Submenu Construction + [Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" + # In most cases, we need to strip two lines: + # TOP: + # Title line, such as: Dasharo System Features + # BOTTOM: + # Help line, such as: F9=Reset to Defaults Esc=Exit + ${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} + # Handling of additional exceptions appearing in submenus: + # 1. Drop unselectable strings from Device Manager + Remove Values From List ${submenu} Devices List + + IF ${opt_only} == ${TRUE} + # Handling exceptions caused by some options splitting into multiple lines. + # For Dasharo System Features options, we can assume that each entry has + # either ">", or "[ ]", or "< >". For other edk2 menus, this is not always + # the case (yet?). + FOR ${entry} IN @{submenu} + ${status}= Check If Menu Line Is An Option ${entry} + IF ${status} != ${TRUE} + Remove Values From List ${submenu} ${entry} + END + END + END + RETURN ${submenu} + +Get Option State + [Documentation] Gets menu construction and option name as arguments. + ... Returns option state, which can be: True or False. + [Arguments] ${menu} ${option} + ${index}= Get Index Of Matching Option In Menu ${menu} ${option} + ${value}= Get Regexp Matches ${menu}[${index}] (Enabled|Disabled) + + RETURN ${value}[0] + +Set Option State And Return Construction + [Documentation] Sets option to desired state and return construction. + [Arguments] ${menu} ${option} ${desired_state} + ${current_state}= Get Option State ${menu} ${option} + + IF '${current_state}' == '${desired_state}' + RETURN ${menu} + ELSE + ${menu}= Enter Menu From Snapshot And Return Sortbootorder Construction ${menu} ${option} + END + RETURN ${menu} + +Get Index Of Matching Option In Menu + [Documentation] This keyword returns the index of element that matches + ... one in given menu + [Arguments] ${menu_construction} ${option} ${ignore_not_found_error}=${FALSE} + FOR ${element} IN @{menu_construction} + ${matches}= Run Keyword And Return Status + ... Should Match ${element} *${option}* + IF ${matches} + ${option}= Set Variable ${element} + BREAK + END + END + ${index}= Get Index From List ${menu_construction} ${option} + IF ${ignore_not_found_error} == ${FALSE} + Should Be True ${index} >= 0 Option ${option} not found in the list + END + RETURN ${index} + +Get Hidden Security Register Submenu Construction + [Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" + # In most cases, we need to strip two lines: + # TOP: + # Title line, such as: Dasharo System Features + # BOTTOM: + # Help line, such as: F9=Reset to Defaults Esc=Exit + ${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} + # Handling of additional exceptions appearing in submenus: + # 1. Drop unselectable strings from Device Manager + Remove Values From List ${submenu} Devices List + + IF ${opt_only} == ${TRUE} + # Handling exceptions caused by some options splitting into multiple lines. + # For Dasharo System Features options, we can assume that each entry has + # either ">", or "[ ]", or "< >". For other edk2 menus, this is not always + # the case (yet?). + FOR ${entry} IN @{submenu} + ${status}= Check If Menu Line Is An Option ${entry} + IF ${status} != ${TRUE} + Remove Values From List ${submenu} ${entry} + END + END + END + RETURN ${submenu} + +Get Hidden Flash Lockdown Submenu Construction + [Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" + # In most cases, we need to strip two lines: + # TOP: + # Title line, such as: Dasharo System Features + # BOTTOM: + # Help line, such as: F9=Reset to Defaults Esc=Exit + ${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} + # Handling of additional exceptions appearing in submenus: + # 1. Drop unselectable strings from Device Manager + Remove Values From List ${submenu} Devices List + + IF ${opt_only} == ${TRUE} + # Handling exceptions caused by some options splitting into multiple lines. + # For Dasharo System Features options, we can assume that each entry has + # either ">", or "[ ]", or "< >". For other edk2 menus, this is not always + # the case (yet?). + FOR ${entry} IN @{submenu} + ${status}= Check If Menu Line Is An Option ${entry} + IF ${status} != ${TRUE} + Remove Values From List ${submenu} ${entry} + END + END + END + RETURN ${submenu} + +Enter Menu From Snapshot + [Documentation] Enter given Menu option [Arguments] ${menu} ${option} - ${key}= Extract SeaBIOS Menu Key ${menu} ${option} + ${key}= Extract Menu Key ${menu} ${option} Write Bare Into Terminal ${key} -Extract SeaBIOS Menu Key +Enter Menu From Snapshot And Return Sortbootorder Construction + [Documentation] Enter given sortbootorder Menu option and return construction + [Arguments] ${menu} ${option} + ${key}= Extract Sortbootorder Menu Key ${menu} ${option} + Write Bare Into Terminal ${key} + ${menu}= Get Sortbootorder Menu Construction + RETURN ${menu} + +Extract Menu Key [Documentation] Extract key which should be hit to enter given Menu in SeaBIOS [Arguments] ${menu} ${option} FOR ${item} IN @{menu} @@ -127,9 +255,27 @@ Extract SeaBIOS Menu Key BREAK END END - ${key} Set Variable ${option.split('.')[0]} + ${key}= Set Variable ${option.split('.')[0]} + RETURN ${key} + +Extract Sortbootorder Menu Key + [Documentation] Extract key which should be hit to toggle given sortbootorder Menu option + [Arguments] ${menu} ${option} + FOR ${item} IN @{menu} + ${matches}= Run Keyword And Return Status + ... Should Match ${item} *${option}* + IF ${matches} + ${option}= Set Variable ${item} + BREAK + END + END + ${key}= Set Variable ${option.split()[0]} RETURN ${key} +Save Sortbootorder Changes + [Documentation] This keyword saves introduced changes + Write Bare Into Terminal s + Get IPXE Boot Menu Construction [Documentation] Keyword allows to get and return iPXE menu construction. [Arguments] ${lines_top}=1 ${lines_bot}=0 ${checkpoint}=${EDK2_IPXE_CHECKPOINT} @@ -137,3 +283,23 @@ Get IPXE Boot Menu Construction ${construction}= Parse Menu Snapshot Into Construction ${menu} ${lines_top} ${lines_bot} RETURN ${construction} +Enable Network/PXE Boot + [Documentation] Enable Network/PXE Boot and save. + Enter Sortbootorder + ${menu}= Get Sortbootorder Menu Construction + ${menu}= Set Option State And Return Construction ${menu} Network/PXE boot Enabled + List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled + Save Sortbootorder Changes + +Enter TPM Configuration + [Documentation] Enter TPM Configuration with Boot Menu Construction. + Enter Boot Menu SeaBIOS + ${menu}= Get Boot Menu Construction + Enter Menu From Snapshot ${menu} TPM Configuration + +Enter IPXE + [Documentation] Enter iPXE with Boot Menu Construction. + Enable Network/PXE Boot + Enter Boot Menu SeaBIOS + ${menu}= Get Boot Menu Construction + Enter Menu From Snapshot ${menu} iPXE diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot index 4c4b517cbf..3c48718f13 100644 --- a/self-tests/setup-and-boot-seabios.robot +++ b/self-tests/setup-and-boot-seabios.robot @@ -41,18 +41,80 @@ Enter Boot Menu SeaBIOS And Return Construction ${menu}= Enter Boot Menu SeaBIOS And Return Construction List Should Not Contain Value ${menu} Select boot device: List Should Contain Value ${menu} 1. DVD/CD [AHCI/2: QEMU DVD-ROM ATAPI-4 DVD/CD] - List Should Contain Value ${menu} 2. iPXE - List Should Contain Value ${menu} 3. Payload [setup] - List Should Contain Value ${menu} 4. Payload [memtest] + List Should Contain Value ${menu} 2. Payload [setup] + List Should Contain Value ${menu} 3. Payload [memtest] List Should Contain Value ${menu} t. TPM Configuration Menu Construction Should Not Contain Control Text ${menu} Enter sortbootorder [Documentation] Test Enter sortbootorder kwd Power On - Enter sortbootorder + Enter Sortbootorder ${out}= Read From Terminal Until Save configuration and exit - Should Contain ${out} ### PC Engines QEMU x86 q35/ich9 setup + Should Contain ${out} PC Engines QEMU x86 q35/ich9 setup + +Get sortbootorder Menu Construction + [Documentation] Get sortbootorder Menu Construction kwd + Power On + Enter Sortbootorder + ${menu}= Get Sortbootorder Menu Construction + List Should Not Contain Value ${menu} Boot order + List Should Contain Value ${menu} r Restore boot order defaults + List Should Contain Value ${menu} n Network/PXE boot - Currently Disabled + List Should Contain Value ${menu} u USB boot - Currently Enabled + List Should Contain Value ${menu} t Serial console - Currently Enabled + List Should Contain Value ${menu} k Redirect console output to COM2 - Currently Disabled + List Should Contain Value ${menu} o UART C - Currently Enabled - Toggle UART C / GPIO + List Should Contain Value ${menu} p UART D - Currently Enabled - Toggle UART D / GPIO + List Should Contain Value ${menu} m Force mPCIe2 slot CLK (GPP3 PCIe) - Currently Disabled + List Should Contain Value ${menu} h EHCI0 controller - Currently Disabled + List Should Contain Value ${menu} l Core Performance Boost - Currently Enabled + List Should Contain Value ${menu} i Watchdog - Currently Disabled + List Should Contain Value ${menu} j SD 3.0 mode - Currently Disabled + List Should Contain Value ${menu} g Reverse order of PCI addresses - Currently Disabled + List Should Contain Value ${menu} v IOMMU - Currently Disabled + List Should Contain Value ${menu} y PCIe power management features - Currently Disabled + List Should Contain Value ${menu} w Enable BIOS write protect - Currently Disabled + List Should Contain Value ${menu} z Clock menu + List Should Contain Value ${menu} x Exit setup without save + List Should Contain Value ${menu} s Save configuration and exit + Menu Construction Should Not Contain Control Text ${menu} + +Get Option State + [Documentation] Test Get Option State kwd + Power On + Enter Sortbootorder + ${menu}= Get Sortbootorder Menu Construction + ${state}= Get Option State ${menu} Network/PXE boot + Should Contain ${state} Disabled + +Enter Menu From Snapshot and Return sortbootorder Construction + [Documentation] Test Enter Menu From Snapshot and Return sortbootorder Construction kwd + Power On + Enter Sortbootorder + ${menu}= Get Sortbootorder Menu Construction + ${menu}= Enter Menu From Snapshot And Return Sortbootorder Construction ${menu} Network/PXE boot + List Should Not Contain Value ${menu} Boot order + List Should Contain Value ${menu} r Restore boot order defaults + List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled + List Should Contain Value ${menu} u USB boot - Currently Enabled + List Should Contain Value ${menu} t Serial console - Currently Enabled + List Should Contain Value ${menu} k Redirect console output to COM2 - Currently Disabled + List Should Contain Value ${menu} o UART C - Currently Enabled - Toggle UART C / GPIO + List Should Contain Value ${menu} p UART D - Currently Enabled - Toggle UART D / GPIO + List Should Contain Value ${menu} m Force mPCIe2 slot CLK (GPP3 PCIe) - Currently Disabled + List Should Contain Value ${menu} h EHCI0 controller - Currently Disabled + List Should Contain Value ${menu} l Core Performance Boost - Currently Enabled + List Should Contain Value ${menu} i Watchdog - Currently Disabled + List Should Contain Value ${menu} j SD 3.0 mode - Currently Disabled + List Should Contain Value ${menu} g Reverse order of PCI addresses - Currently Disabled + List Should Contain Value ${menu} v IOMMU - Currently Disabled + List Should Contain Value ${menu} y PCIe power management features - Currently Disabled + List Should Contain Value ${menu} w Enable BIOS write protect - Currently Disabled + List Should Contain Value ${menu} z Clock menu + List Should Contain Value ${menu} x Exit setup without save + List Should Contain Value ${menu} s Save configuration and exit + Menu Construction Should Not Contain Control Text ${menu} Enter TPM Configuration [Documentation] Test Enter TPM Configuration kwd @@ -61,9 +123,17 @@ Enter TPM Configuration ${out}= Read From Terminal Until reboot the machine Should Contain ${out} Clear TPM +Enable Network Boot + [Documentation] Test Enable Network/PXE boot + Power On + Enable Network/PXE Boot + Enter Sortbootorder + ${menu}= Get Sortbootorder Menu Construction + List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled + Enter iPXE [Documentation] Test Enter iPXE kwd Power On - Enter iPXE + Enter IPXE ${out}= Read From Terminal Until autoboot Should Contain ${out} ipxe shell From 9d3a4d646b5130707386feab49907d7e04be8337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Mon, 25 Nov 2024 16:39:12 +0100 Subject: [PATCH 11/33] .github/workflows/qemu-self-test-seabios.yml: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- .github/workflows/qemu-self-test-seabios.yml | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/qemu-self-test-seabios.yml diff --git a/.github/workflows/qemu-self-test-seabios.yml b/.github/workflows/qemu-self-test-seabios.yml new file mode 100644 index 0000000000..18355ac25e --- /dev/null +++ b/.github/workflows/qemu-self-test-seabios.yml @@ -0,0 +1,53 @@ +name: Keywords self-tests for Dasharo (coreboot+SeaBIOS) on QEMU Q35 + +on: [push, pull_request] + +jobs: + qemu: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository and submodules + uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Set up QEMU + run: | + sudo apt-get update + sudo apt-get install qemu-system-x86-64 swtpm + + # Based on: https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ + # It mentiones enteprise large-runners, let's see if it works + # on regular public runners as well + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Start QEMU in background + run: | + ./scripts/ci/qemu-run.sh nographic seabios & + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Start keywords self-tests with QEMU + run: | + ./scripts/ci/qemu-self-test-seabios.sh + + - name: Save artifacts + uses: actions/upload-artifact@v4 + with: + name: "qemu-logs" + path: | + ./logs/ + retention-days: 30 From 13fa3f65141f12437a113bcdf5ebef5789fddd4d Mon Sep 17 00:00:00 2001 From: Maciej Pijanowski Date: Tue, 26 Nov 2024 23:11:31 +0100 Subject: [PATCH 12/33] platform-configs/qemu: swap release and selftests configs It appers to me that the selftest config should have more menus enabled, than the "release" config, supporting only "reasonable" menus. Signed-off-by: Maciej Pijanowski --- platform-configs/qemu-selftests-uefi.robot | 100 +++++++++++++++------ platform-configs/qemu.robot | 100 ++++++--------------- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/platform-configs/qemu-selftests-uefi.robot b/platform-configs/qemu-selftests-uefi.robot index d6f62d5947..5fd7da022a 100644 --- a/platform-configs/qemu-selftests-uefi.robot +++ b/platform-configs/qemu-selftests-uefi.robot @@ -8,39 +8,81 @@ Resource include/default.robot *** Variables *** -${INITIAL_DUT_CONNECTION_METHOD}= Telnet -${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} -${RTE_S2_N_PORT}= 1234 -${FLASH_SIZE}= ${8*1024*1024} -${BOOT_MENU_KEY}= ${ESC} -${SETUP_MENU_KEY}= ${F2} -${MANUFACTURER}= QEMU -${POWER_CTRL}= RteCtrl -${FLASHING_METHOD}= none - -${DMIDECODE_SERIAL_NUMBER}= N/A -${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+UEFI) v0.2.0 -${DMIDECODE_PRODUCT_NAME}= QEMU x86 q35/ich9 -${DMIDECODE_RELEASE_DATE}= 06/21/2024 -${DMIDECODE_MANUFACTURER}= Emulation -${DMIDECODE_VENDOR}= 3mdeb -${DMIDECODE_FAMILY}= N/A -${DMIDECODE_TYPE}= Desktop +${INITIAL_DUT_CONNECTION_METHOD}= Telnet +${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} +${RTE_S2_N_PORT}= 1234 +${FLASH_SIZE}= ${8*1024*1024} +${BOOT_MENU_KEY}= ${ESC} +${SETUP_MENU_KEY}= ${F2} +${MANUFACTURER}= QEMU +${POWER_CTRL}= RteCtrl +${FLASHING_METHOD}= none + +${DMIDECODE_SERIAL_NUMBER}= N/A +${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+UEFI) v0.2.0 +${DMIDECODE_PRODUCT_NAME}= QEMU x86 q35/ich9 +${DMIDECODE_RELEASE_DATE}= 06/21/2024 +${DMIDECODE_MANUFACTURER}= Emulation +${DMIDECODE_VENDOR}= 3mdeb +${DMIDECODE_FAMILY}= N/A +${DMIDECODE_TYPE}= Desktop # Supported test environments -${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE} -${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE} -${TESTS_IN_METATB_SUPPORT}= ${TRUE} +${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE} +${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE} +${TESTS_IN_METATB_SUPPORT}= ${TRUE} # Regression test flags -${DASHARO_SECURITY_MENU_SUPPORT}= ${TRUE} -${DASHARO_USB_MENU_SUPPORT}= ${TRUE} -${DASHARO_NETWORKING_MENU_SUPPORT}= ${TRUE} -${DASHARO_INTEL_ME_MENU_SUPPORT}= ${TRUE} -${DASHARO_CHIPSET_MENU_SUPPORT}= ${TRUE} -${DASHARO_POWER_MGMT_MENU_SUPPORT}= ${TRUE} -${DASHARO_PCI_PCIE_MENU_SUPPORT}= ${TRUE} -${DASHARO_MEMORY_MENU_SUPPORT}= ${TRUE} +${DASHARO_SECURITY_MENU_SUPPORT}= ${TRUE} +${DASHARO_USB_MENU_SUPPORT}= ${TRUE} +${DASHARO_NETWORKING_MENU_SUPPORT}= ${TRUE} +${DASHARO_CHIPSET_MENU_SUPPORT}= ${TRUE} + +# Test module: dasharo-compatibility +${CUSTOM_BOOT_MENU_KEY_SUPPORT}= ${TRUE} +${CUSTOM_SETUP_MENU_KEY_SUPPORT}= ${TRUE} +${CUSTOM_NETWORK_BOOT_ENTRIES_SUPPORT}= ${TRUE} +${CUSTOM_LOGO_SUPPORT}= ${TRUE} +${USB_DISKS_DETECTION_SUPPORT}= ${TRUE} +${USB_KEYBOARD_DETECTION_SUPPORT}= ${TRUE} +${UEFI_SHELL_SUPPORT}= ${TRUE} +${IPXE_BOOT_SUPPORT}= ${TRUE} +${AUDIO_SUBSYSTEM_SUPPORT}= ${TRUE} +${FIRMWARE_NUMBER_VERIFICATION}= ${TRUE} +${PRODUCT_NAME_VERIFICATION}= ${TRUE} +${RELEASE_DATE_VERIFICATION}= ${TRUE} +${MANUFACTURER_VERIFICATION}= ${TRUE} +${VENDOR_VERIFICATION}= ${TRUE} +${TYPE_VERIFICATION}= ${TRUE} +${EMMC_SUPPORT}= ${TRUE} +${DTS_SUPPORT}= ${TRUE} +${UPLOAD_ON_USB_SUPPORT}= ${TRUE} +${RESET_TO_DEFAULTS_SUPPORT}= ${TRUE} +${ESP_SCANNING_SUPPORT}= ${TRUE} + +# Test module: dasharo-security +${TPM_SUPPORT}= ${TRUE} +${VERIFIED_BOOT_SUPPORT}= ${TRUE} +${VERIFIED_BOOT_POPUP_SUPPORT}= ${TRUE} +${MEASURED_BOOT_SUPPORT}= ${TRUE} +${SECURE_BOOT_SUPPORT}= ${TRUE} +${USB_STACK_SUPPORT}= ${TRUE} +${USB_MASS_STORAGE_SUPPORT}= ${TRUE} +${UEFI_PASSWORD_SUPPORT}= ${TRUE} + +# Test module: dasharo-performance +${SERIAL_BOOT_MEASURE}= ${TRUE} +${CPU_FREQUENCY_MEASURE}= ${TRUE} +${CPU_TEMPERATURE_MEASURE}= ${TRUE} +${PLATFORM_STABILITY_CHECKING}= ${TRUE} + +# Test module: trenchboot +${TRENCHBOOT_SUPPORT}= ${TRUE} + +${AUTO_BOOT_TIME_OUT_DEFAULT_VALUE}= 0 + +# Test module: dasharo-stability +${CAPSULE_UPDATE_SUPPORT}= ${TRUE} *** Keywords *** diff --git a/platform-configs/qemu.robot b/platform-configs/qemu.robot index dd5bdf0016..a311a3045e 100644 --- a/platform-configs/qemu.robot +++ b/platform-configs/qemu.robot @@ -8,81 +8,39 @@ Resource include/default.robot *** Variables *** -${INITIAL_DUT_CONNECTION_METHOD}= Telnet -${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} -${RTE_S2_N_PORT}= 1234 -${FLASH_SIZE}= ${8*1024*1024} -${BOOT_MENU_KEY}= ${ESC} -${SETUP_MENU_KEY}= ${F2} -${MANUFACTURER}= QEMU -${POWER_CTRL}= RteCtrl -${FLASHING_METHOD}= none - -${DMIDECODE_SERIAL_NUMBER}= N/A -${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+UEFI) v0.2.0 -${DMIDECODE_PRODUCT_NAME}= QEMU x86 q35/ich9 -${DMIDECODE_RELEASE_DATE}= 06/21/2024 -${DMIDECODE_MANUFACTURER}= Emulation -${DMIDECODE_VENDOR}= 3mdeb -${DMIDECODE_FAMILY}= N/A -${DMIDECODE_TYPE}= Desktop +${INITIAL_DUT_CONNECTION_METHOD}= Telnet +${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} +${RTE_S2_N_PORT}= 1234 +${FLASH_SIZE}= ${8*1024*1024} +${BOOT_MENU_KEY}= ${ESC} +${SETUP_MENU_KEY}= ${F2} +${MANUFACTURER}= QEMU +${POWER_CTRL}= RteCtrl +${FLASHING_METHOD}= none + +${DMIDECODE_SERIAL_NUMBER}= N/A +${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+UEFI) v0.2.0 +${DMIDECODE_PRODUCT_NAME}= QEMU x86 q35/ich9 +${DMIDECODE_RELEASE_DATE}= 06/21/2024 +${DMIDECODE_MANUFACTURER}= Emulation +${DMIDECODE_VENDOR}= 3mdeb +${DMIDECODE_FAMILY}= N/A +${DMIDECODE_TYPE}= Desktop # Supported test environments -${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE} -${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE} -${TESTS_IN_METATB_SUPPORT}= ${TRUE} +${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE} +${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE} +${TESTS_IN_METATB_SUPPORT}= ${TRUE} # Regression test flags -${DASHARO_SECURITY_MENU_SUPPORT}= ${TRUE} -${DASHARO_USB_MENU_SUPPORT}= ${TRUE} -${DASHARO_NETWORKING_MENU_SUPPORT}= ${TRUE} -${DASHARO_CHIPSET_MENU_SUPPORT}= ${TRUE} - -# Test module: dasharo-compatibility -${CUSTOM_BOOT_MENU_KEY_SUPPORT}= ${TRUE} -${CUSTOM_SETUP_MENU_KEY_SUPPORT}= ${TRUE} -${CUSTOM_NETWORK_BOOT_ENTRIES_SUPPORT}= ${TRUE} -${CUSTOM_LOGO_SUPPORT}= ${TRUE} -${USB_DISKS_DETECTION_SUPPORT}= ${TRUE} -${USB_KEYBOARD_DETECTION_SUPPORT}= ${TRUE} -${UEFI_SHELL_SUPPORT}= ${TRUE} -${IPXE_BOOT_SUPPORT}= ${TRUE} -${AUDIO_SUBSYSTEM_SUPPORT}= ${TRUE} -${FIRMWARE_NUMBER_VERIFICATION}= ${TRUE} -${PRODUCT_NAME_VERIFICATION}= ${TRUE} -${RELEASE_DATE_VERIFICATION}= ${TRUE} -${MANUFACTURER_VERIFICATION}= ${TRUE} -${VENDOR_VERIFICATION}= ${TRUE} -${TYPE_VERIFICATION}= ${TRUE} -${EMMC_SUPPORT}= ${TRUE} -${DTS_SUPPORT}= ${TRUE} -${UPLOAD_ON_USB_SUPPORT}= ${TRUE} -${RESET_TO_DEFAULTS_SUPPORT}= ${TRUE} -${ESP_SCANNING_SUPPORT}= ${TRUE} - -# Test module: dasharo-security -${TPM_SUPPORT}= ${TRUE} -${VERIFIED_BOOT_SUPPORT}= ${TRUE} -${VERIFIED_BOOT_POPUP_SUPPORT}= ${TRUE} -${MEASURED_BOOT_SUPPORT}= ${TRUE} -${SECURE_BOOT_SUPPORT}= ${TRUE} -${USB_STACK_SUPPORT}= ${TRUE} -${USB_MASS_STORAGE_SUPPORT}= ${TRUE} -${UEFI_PASSWORD_SUPPORT}= ${TRUE} - -# Test module: dasharo-performance -${SERIAL_BOOT_MEASURE}= ${TRUE} -${CPU_FREQUENCY_MEASURE}= ${TRUE} -${CPU_TEMPERATURE_MEASURE}= ${TRUE} -${PLATFORM_STABILITY_CHECKING}= ${TRUE} - -# Test module: trenchboot -${TRENCHBOOT_SUPPORT}= ${TRUE} - -${AUTO_BOOT_TIME_OUT_DEFAULT_VALUE}= 0 - -# Test module: dasharo-stability -${CAPSULE_UPDATE_SUPPORT}= ${TRUE} +${DASHARO_SECURITY_MENU_SUPPORT}= ${TRUE} +${DASHARO_USB_MENU_SUPPORT}= ${TRUE} +${DASHARO_NETWORKING_MENU_SUPPORT}= ${TRUE} +${DASHARO_INTEL_ME_MENU_SUPPORT}= ${TRUE} +${DASHARO_CHIPSET_MENU_SUPPORT}= ${TRUE} +${DASHARO_POWER_MGMT_MENU_SUPPORT}= ${TRUE} +${DASHARO_PCI_PCIE_MENU_SUPPORT}= ${TRUE} +${DASHARO_MEMORY_MENU_SUPPORT}= ${TRUE} *** Keywords *** From 329f4744050f5f3c2586e5a706469703181e2d58 Mon Sep 17 00:00:00 2001 From: Maciej Pijanowski Date: Tue, 26 Nov 2024 23:16:51 +0100 Subject: [PATCH 13/33] platform-configs/qemu-selftests-uefi.robot: use common part from qemu,robot Signed-off-by: Maciej Pijanowski --- platform-configs/qemu-selftests-uefi.robot | 44 +--------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/platform-configs/qemu-selftests-uefi.robot b/platform-configs/qemu-selftests-uefi.robot index 5fd7da022a..550e94d609 100644 --- a/platform-configs/qemu-selftests-uefi.robot +++ b/platform-configs/qemu-selftests-uefi.robot @@ -5,42 +5,10 @@ This config targets QEMU firmware with as many menus enabled as possible. *** Settings *** Library ../lib/QemuMonitor.py /tmp/qmp-socket Resource include/default.robot +Resource qemu.robot *** Variables *** -${INITIAL_DUT_CONNECTION_METHOD}= Telnet -${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} -${RTE_S2_N_PORT}= 1234 -${FLASH_SIZE}= ${8*1024*1024} -${BOOT_MENU_KEY}= ${ESC} -${SETUP_MENU_KEY}= ${F2} -${MANUFACTURER}= QEMU -${POWER_CTRL}= RteCtrl -${FLASHING_METHOD}= none - -${DMIDECODE_SERIAL_NUMBER}= N/A -${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+UEFI) v0.2.0 -${DMIDECODE_PRODUCT_NAME}= QEMU x86 q35/ich9 -${DMIDECODE_RELEASE_DATE}= 06/21/2024 -${DMIDECODE_MANUFACTURER}= Emulation -${DMIDECODE_VENDOR}= 3mdeb -${DMIDECODE_FAMILY}= N/A -${DMIDECODE_TYPE}= Desktop - -# Supported test environments -${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE} -${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE} -${TESTS_IN_METATB_SUPPORT}= ${TRUE} - -# Regression test flags -${DASHARO_SECURITY_MENU_SUPPORT}= ${TRUE} -${DASHARO_USB_MENU_SUPPORT}= ${TRUE} -${DASHARO_NETWORKING_MENU_SUPPORT}= ${TRUE} -${DASHARO_CHIPSET_MENU_SUPPORT}= ${TRUE} - -# Test module: dasharo-compatibility -${CUSTOM_BOOT_MENU_KEY_SUPPORT}= ${TRUE} -${CUSTOM_SETUP_MENU_KEY_SUPPORT}= ${TRUE} ${CUSTOM_NETWORK_BOOT_ENTRIES_SUPPORT}= ${TRUE} ${CUSTOM_LOGO_SUPPORT}= ${TRUE} ${USB_DISKS_DETECTION_SUPPORT}= ${TRUE} @@ -83,13 +51,3 @@ ${AUTO_BOOT_TIME_OUT_DEFAULT_VALUE}= 0 # Test module: dasharo-stability ${CAPSULE_UPDATE_SUPPORT}= ${TRUE} - - -*** Keywords *** -Power On - [Documentation] Keyword clears telnet buffer and sets Device Under Test - ... into Power On state using RTE OC buffers. Implementation - ... must be compatible with the theory of operation of a - ... specific platform. - Read From Terminal - Qemu Monitor.System Reset From 48a7ffef7dbc71d3ec8a11a082167f57af7f43d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Tue, 26 Nov 2024 23:47:16 +0100 Subject: [PATCH 14/33] keywords.robot: do not import lib/bios/menus.robot twice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- keywords.robot | 1 - 1 file changed, 1 deletion(-) diff --git a/keywords.robot b/keywords.robot index cec1ad086f..e3876becdf 100644 --- a/keywords.robot +++ b/keywords.robot @@ -556,7 +556,6 @@ Import BIOS Libraries [Documentation] Import BIOS libraries based on config and command ... line variables IF '${BIOS_LIB}' == 'uefi' - Import Resource ${CURDIR}/lib/bios/menus.robot Import Resource ${CURDIR}/lib/options/${OPTIONS_LIB}.robot ELSE IF '${BIOS_LIB}' == 'seabios' Import Resource ${CURDIR}/lib/bios/seabios.robot From f15c763487a5c6212ad1489c4a4ae6e5bec64667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 00:13:24 +0100 Subject: [PATCH 15/33] platform-configs/qemu-selftests-uefi.robot: fix resource order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- platform-configs/qemu-selftests-uefi.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-configs/qemu-selftests-uefi.robot b/platform-configs/qemu-selftests-uefi.robot index 550e94d609..3f1ccdb3e2 100644 --- a/platform-configs/qemu-selftests-uefi.robot +++ b/platform-configs/qemu-selftests-uefi.robot @@ -4,8 +4,8 @@ This config targets QEMU firmware with as many menus enabled as possible. *** Settings *** Library ../lib/QemuMonitor.py /tmp/qmp-socket -Resource include/default.robot Resource qemu.robot +Resource include/default.robot *** Variables *** From 3fc5a86e8961e988d60c38011c5bf1492335a451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 00:21:39 +0100 Subject: [PATCH 16/33] platform-configs,scripts: make BIOS_LIB=uefi default and override only in qemu seabios config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- platform-configs/include/default.robot | 1 + platform-configs/qemu-selftests-seabios.robot | 1 + scripts/ci/qemu-self-test-seabios.sh | 2 +- scripts/ci/qemu-self-test.sh | 14 +++++++------- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/platform-configs/include/default.robot b/platform-configs/include/default.robot index 083280cc91..4ee809abd1 100644 --- a/platform-configs/include/default.robot +++ b/platform-configs/include/default.robot @@ -38,6 +38,7 @@ ${LAPTOP_EC_SERIAL_WORKAROUND}= ${FALSE} # - uefi-setup-menu: Will set options via the UEFI Setup menu (serial) # - dcu: Will use Dasharo Configuration Utility to configure options. ${OPTIONS_LIB}= uefi-setup-menu +${BIOS_LIB}= uefi # OS config ${DEVICE_WINDOWS_USERNAME}= ${WINDOWS_USERNAME} diff --git a/platform-configs/qemu-selftests-seabios.robot b/platform-configs/qemu-selftests-seabios.robot index 674f0babee..d153fd3cde 100644 --- a/platform-configs/qemu-selftests-seabios.robot +++ b/platform-configs/qemu-selftests-seabios.robot @@ -43,6 +43,7 @@ ${DASHARO_POWER_MGMT_MENU_SUPPORT}= ${TRUE} ${DASHARO_PCI_PCIE_MENU_SUPPORT}= ${TRUE} ${DASHARO_MEMORY_MENU_SUPPORT}= ${TRUE} +${BIOS_LIB}= seabios *** Keywords *** Power On diff --git a/scripts/ci/qemu-self-test-seabios.sh b/scripts/ci/qemu-self-test-seabios.sh index a56fbc0349..73788b3677 100755 --- a/scripts/ci/qemu-self-test-seabios.sh +++ b/scripts/ci/qemu-self-test-seabios.sh @@ -2,7 +2,7 @@ # Define an array of commands commands=( - "robot -X -L TRACE -v BIOS_LIB:seabios -v config:qemu-selftests-seabios -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-seabios -v snipeit:no self-tests/setup-and-boot-seabios.robot" + "robot -X -L TRACE -v config:qemu-selftests-seabios -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-seabios -v snipeit:no self-tests/setup-and-boot-seabios.robot" ) # Initialize a variable to track overall success diff --git a/scripts/ci/qemu-self-test.sh b/scripts/ci/qemu-self-test.sh index 08fbfcfae9..5aa0c61771 100755 --- a/scripts/ci/qemu-self-test.sh +++ b/scripts/ci/qemu-self-test.sh @@ -2,13 +2,13 @@ # Define an array of commands commands=( - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no self-tests/setup-and-boot-menus.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/dasharo-system-features-menus -v snipeit:no self-tests/dasharo-system-features-menus.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/boolean-options -v snipeit:no self-tests/boolean-options.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/numerical-options -v snipeit:no self-tests/numerical-options.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/list-options -v snipeit:no self-tests/list-options.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/secure-boot -v snipeit:no self-tests/secure-boot.robot" - "robot -X -L TRACE -v BIOS_LIB:uefi -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/self-tests -v snipeit:no self-tests/terminal.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no self-tests/setup-and-boot-menus.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/dasharo-system-features-menus -v snipeit:no self-tests/dasharo-system-features-menus.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/boolean-options -v snipeit:no self-tests/boolean-options.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/numerical-options -v snipeit:no self-tests/numerical-options.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/list-options -v snipeit:no self-tests/list-options.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/secure-boot -v snipeit:no self-tests/secure-boot.robot" + "robot -X -L TRACE -v config:qemu-selftests-uefi -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/self-tests -v snipeit:no self-tests/terminal.robot" ) # Initialize a variable to track overall success From 13b687119a97a26604cd37a4df83a07bde48eb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 00:26:23 +0100 Subject: [PATCH 17/33] platform-configs/qemu-selftests-seabios.robot: import common qemu.robot resource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- platform-configs/qemu-selftests-seabios.robot | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/platform-configs/qemu-selftests-seabios.robot b/platform-configs/qemu-selftests-seabios.robot index d153fd3cde..ad721bc2b6 100644 --- a/platform-configs/qemu-selftests-seabios.robot +++ b/platform-configs/qemu-selftests-seabios.robot @@ -4,6 +4,7 @@ This config targets QEMU firmware with as many menus enabled as possible. *** Settings *** Library ../lib/QemuMonitor.py /tmp/qmp-socket +Resource qemu.robot Resource include/default.robot @@ -44,12 +45,3 @@ ${DASHARO_PCI_PCIE_MENU_SUPPORT}= ${TRUE} ${DASHARO_MEMORY_MENU_SUPPORT}= ${TRUE} ${BIOS_LIB}= seabios - -*** Keywords *** -Power On - [Documentation] Keyword clears telnet buffer and sets Device Under Test - ... into Power On state using RTE OC buffers. Implementation - ... must be compatible with the theory of operation of a - ... specific platform. - Read From Terminal - Qemu Monitor.System Reset From e84c0ea7d059807e324b039cada99e99ed206570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 00:56:08 +0100 Subject: [PATCH 18/33] docs,scripts: keep firmware option for qemu-run.sh as backward compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- docs/qemu.md | 22 +++++++++++++++++----- scripts/ci/qemu-run.sh | 7 ++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/qemu.md b/docs/qemu.md index 5baf4e105f..3158d7771b 100644 --- a/docs/qemu.md +++ b/docs/qemu.md @@ -26,16 +26,28 @@ You may also decide to not use graphics user interface for QEMU. In that case choose mode `nographic`. If you run QEMU on a remote machine you may consider to use mode `vnc` with default port for graphical output being `5900`. -Dasharo (UEFI) in QEMU can be started with: +Dasharo (coreboot+UEFI) in QEMU can be started with: ```bash -./scripts/ci/qemu-run.sh graphic firmware +./scripts/ci/qemu-run.sh graphic uefi ``` In this mode, a graphical QEMU window would popup, so you can observe the test -flow, or control it manually. The actual testing will happen over -serial, which is exposed via telnet. For more modes and options, please refer -to the script's help text. +flow, or control it manually. The actual testing will happen over serial, which +is exposed via telnet. For more modes and options, please refer to the script's +help text. + +Please note `uefi` is a machine with lower resources assigned and no disk will +be connected; suitable for Dasharo (coreboot+UEFI) validation, but not for OS +booting. The `firmware` option is the same as `uefi` and is kept for backward +compatibility. + +Instead of `uefi` you can use `seabios` option, which is a machine with lower +resources assigned and no disk will be connected; suitable for Dasharo +(coreboot+SeaBIOS) validation, but not for OS booting. + +There are some more intrinsic difference between `uefi` and `seabios` for +details please inspect the script. You may also build customized Dasharo firmware for QEMU (e.g. with some Dasharo options enabled or disabled). In such a case, please refer to: diff --git a/scripts/ci/qemu-run.sh b/scripts/ci/qemu-run.sh index 58c8b90832..0cf47a5a22 100755 --- a/scripts/ci/qemu-run.sh +++ b/scripts/ci/qemu-run.sh @@ -48,6 +48,7 @@ This is the QEMU wrapper script for the Dasharo Open Source Firmware Validation. uefi a machine with lower resources assigned will be spawned and no disk will be connected; suitable for Dasharo (coreboot+UEFI) validation, but not for OS booting + firmware same as uefi - kept for backward compatibility seabios a machine with lower resources assigned will be spawned and no disk will be connected; suitable for Dasharo (coreboot+SeaBIOS) validation, but not for OS booting @@ -183,7 +184,7 @@ esac ACTION="$2" case "${ACTION}" in - uefi) + firmware|uefi) MEMORY="1G" QEMU_UEFI_PARAMS="-global driver=cfi.pflash01,property=secure,value=on" QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_UEFI_PARAMS}" @@ -212,7 +213,7 @@ case "${ACTION}" in esac # Check for the existence of QEMU firmware file -if [ ! -f "${QEMU_FW_FILE}" ] && [ "${ACTION}" == "uefi" ]; then +if [ ! -f "${QEMU_FW_FILE}" ] && [ "${ACTION}" == "uefi" ] || [ "${ACTION}" == "firmware" ] ; then echo "The required file ${QEMU_FW_FILE} is missing." echo "Downloading from the server..." wget -O ${QEMU_FW_FILE} https://github.com/Dasharo/coreboot/releases/latest/download/qemu_q35_all_menus.rom @@ -226,7 +227,7 @@ else echo "simply remove it and let the script download the latest release." fi -if [ "${ACTION}" == "uefi" ]; then +if [ "${ACTION}" == "uefi" ] || [ "${ACTION}" == "firmware" ]; then echo "Clear UEFI variables" echo "On each run on this script, the firmware settings would be restored to default." dd if=/dev/zero of=${QEMU_FW_FILE} bs=256 count=1 conv=notrunc 2> /dev/null From c6de4d64aadf61636a0935622315204768147ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 23:17:53 +0100 Subject: [PATCH 19/33] rename lib/bios/menus.robot -> lib/bios/edk2.robot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- dasharo-compatibility/apu-configuration-menu.robot | 2 +- dasharo-compatibility/memory-profile.robot | 2 +- dasharo-compatibility/power-after-fail.robot | 2 +- dasharo-compatibility/watchdog.robot | 2 +- dasharo-security/option-rom.robot | 2 +- dasharo-security/rebar.robot | 2 +- lib/bios/{menus.robot => edk2.robot} | 0 lib/bios/seabios.robot | 2 +- lib/options/uefi-setup-menu.robot | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename lib/bios/{menus.robot => edk2.robot} (100%) diff --git a/dasharo-compatibility/apu-configuration-menu.robot b/dasharo-compatibility/apu-configuration-menu.robot index e2e2fe0bb9..9fdedaff28 100644 --- a/dasharo-compatibility/apu-configuration-menu.robot +++ b/dasharo-compatibility/apu-configuration-menu.robot @@ -8,7 +8,7 @@ Library SSHLibrary timeout=90 seconds Library RequestsLibrary # TODO: maybe have a single file to include if we need to include the same # stuff in all test cases -Resource ../lib/bios/menus.robot +Resource ../lib/bios/edk2.robot Resource ../variables.robot Resource ../keywords.robot Resource ../keys.robot diff --git a/dasharo-compatibility/memory-profile.robot b/dasharo-compatibility/memory-profile.robot index afa543149a..f3550931de 100644 --- a/dasharo-compatibility/memory-profile.robot +++ b/dasharo-compatibility/memory-profile.robot @@ -8,7 +8,7 @@ Library SSHLibrary timeout=90 seconds Library RequestsLibrary # TODO: maybe have a single file to include if we need to include the same # stuff in all test cases -Resource ../lib/bios/menus.robot +Resource ../lib/bios/edk2.robot Resource ../variables.robot Resource ../keywords.robot Resource ../keys.robot diff --git a/dasharo-compatibility/power-after-fail.robot b/dasharo-compatibility/power-after-fail.robot index 7935c88d41..9515183a9a 100644 --- a/dasharo-compatibility/power-after-fail.robot +++ b/dasharo-compatibility/power-after-fail.robot @@ -11,7 +11,7 @@ Library RequestsLibrary Resource ../variables.robot Resource ../keywords.robot Resource ../keys.robot -Resource ../lib/bios/menus.robot +Resource ../lib/bios/edk2.robot Resource ../lib/power-after-fail-lib.robot # TODO: diff --git a/dasharo-compatibility/watchdog.robot b/dasharo-compatibility/watchdog.robot index f22f8428ca..e441662d0c 100644 --- a/dasharo-compatibility/watchdog.robot +++ b/dasharo-compatibility/watchdog.robot @@ -8,7 +8,7 @@ Library SSHLibrary timeout=90 seconds Library RequestsLibrary # TODO: maybe have a single file to include if we need to include the same # stuff in all test cases -Resource ../lib/bios/menus.robot +Resource ../lib/bios/edk2.robot Resource ../variables.robot Resource ../keywords.robot Resource ../keys.robot diff --git a/dasharo-security/option-rom.robot b/dasharo-security/option-rom.robot index e426d2da84..57eaad723a 100644 --- a/dasharo-security/option-rom.robot +++ b/dasharo-security/option-rom.robot @@ -3,7 +3,7 @@ Library Telnet timeout=20 seconds connection_timeout=120 secon Library SSHLibrary timeout=90 seconds Library RequestsLibrary Resource ../keywords.robot -Resource ../lib/bios/menus.robot +Resource ../lib/bios/edk2.robot Resource ../variables.robot Resource ../keys.robot diff --git a/dasharo-security/rebar.robot b/dasharo-security/rebar.robot index c7fc0da2c3..3b3c1e2f77 100644 --- a/dasharo-security/rebar.robot +++ b/dasharo-security/rebar.robot @@ -3,7 +3,7 @@ Library Telnet timeout=20 seconds connection_timeout=120 secon Library SSHLibrary timeout=90 seconds Library RequestsLibrary Resource ../keywords.robot -Resource ../lib/bios/menus.robot +Resource ../lib/bios/edk2.robot Resource ../variables.robot Resource ../keys.robot diff --git a/lib/bios/menus.robot b/lib/bios/edk2.robot similarity index 100% rename from lib/bios/menus.robot rename to lib/bios/edk2.robot diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index cffa96ebf5..060dbe4dcd 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -1,7 +1,7 @@ *** Settings *** Documentation Collection of keywords related to SeaBIOS. -# Here is comparison of terms with lib/bios/menus.robot +# Here is comparison of terms with lib/bios/edk2.robot # Tianocore -> SeaBIOS # Setup Menu -> sortbootorder # diff --git a/lib/options/uefi-setup-menu.robot b/lib/options/uefi-setup-menu.robot index 0a5d056ee0..d12f2ee2d2 100644 --- a/lib/options/uefi-setup-menu.robot +++ b/lib/options/uefi-setup-menu.robot @@ -4,7 +4,7 @@ Documentation Library for UEFI configuration using the UEFI setup menu Library Collections Library String -Resource ../bios/menus.robot +Resource ../bios/edk2.robot Resource ../../keywords.robot Resource ../cbmem.robot From b2aeac00387f58d28793bc01dcc79da9b552b399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 23:30:53 +0100 Subject: [PATCH 20/33] use platform-defined FW_STRING instead of {SEABIOS,TIANOCORE}_STRING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- dasharo-compatibility/apu-configuration-menu.robot | 8 ++++---- dasharo-compatibility/ec-and-super-IO.robot | 2 +- dasharo-compatibility/watchdog.robot | 12 ++++++------ lib/bios/edk2.robot | 2 +- platform-configs/include/default.robot | 2 +- platform-configs/include/msi-z690-common.robot | 2 +- platform-configs/include/novacustom-common.robot | 2 +- platform-configs/include/pcengines.robot | 2 +- platform-configs/include/protectli-common.robot | 2 +- platform-configs/minnowboard-turbot.robot | 2 +- platform-configs/qemu-selftests-seabios.robot | 2 +- platform-configs/rpi-3b.robot | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dasharo-compatibility/apu-configuration-menu.robot b/dasharo-compatibility/apu-configuration-menu.robot index 9fdedaff28..09a9e75590 100644 --- a/dasharo-compatibility/apu-configuration-menu.robot +++ b/dasharo-compatibility/apu-configuration-menu.robot @@ -46,7 +46,7 @@ APU002.001 Enable apu2 watchdog # We're in the setup menu. Now just wait until the platform resets. Wait a # bit longer than the timeout to give the platform to actually reset. Set DUT Response Timeout 70s - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} APU003.001 Disable apu2 watchdog [Documentation] Disable the watchdog after enabling it to verify it does @@ -62,7 +62,7 @@ APU003.001 Disable apu2 watchdog ${platform_has_reset}= Set Variable ${TRUE} Set DUT Response Timeout 70s TRY - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} EXCEPT ${platform_has_reset}= Set Variable ${FALSE} END @@ -85,14 +85,14 @@ APU004.001 Change apu2 watchdog timeout ${platform_has_reset}= Set Variable ${TRUE} Set DUT Response Timeout 60s TRY - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} EXCEPT ${platform_has_reset}= Set Variable ${FALSE} END Should Be Equal ${platform_has_reset} ${FALSE} # Now wait another 70s to make sure the platform resets within 120s of boot. Set DUT Response Timeout 70s - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} [Teardown] Flash Firmware ${FW_FILE} APU005.001 Check if disabling CPB decreases performance diff --git a/dasharo-compatibility/ec-and-super-IO.robot b/dasharo-compatibility/ec-and-super-IO.robot index 0ad922685e..95267b89e4 100644 --- a/dasharo-compatibility/ec-and-super-IO.robot +++ b/dasharo-compatibility/ec-and-super-IO.robot @@ -321,7 +321,7 @@ ECR022.001 EC sync update with power adapter connected works correctly # Make sure EC isn't flashed second time after restart Write Into Terminal reboot - ${out}= Read From Terminal Until ${TIANOCORE_STRING} + ${out}= Read From Terminal Until ${FW_STRING} ECR023.001 EC sync doesn't update with power adapter disconnected [Documentation] This test aims to verify whether coreboot update diff --git a/dasharo-compatibility/watchdog.robot b/dasharo-compatibility/watchdog.robot index e441662d0c..f524198fe2 100644 --- a/dasharo-compatibility/watchdog.robot +++ b/dasharo-compatibility/watchdog.robot @@ -50,7 +50,7 @@ WDT002.001 Enable watchdog # We're in the setup menu. Now just wait until the platform resets. Wait a # little longer than the timeout to give the platform time to reset. Set DUT Response Timeout 320s - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} WDT003.001 Disable watchdog [Documentation] Disable the watchdog after enabling it to verify it does @@ -69,7 +69,7 @@ WDT003.001 Disable watchdog ${platform_has_reset}= Set Variable ${TRUE} Set DUT Response Timeout 360s TRY - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} EXCEPT ${platform_has_reset}= Set Variable ${FALSE} END @@ -95,7 +95,7 @@ WDT004.001 Change watchdog timeout ${platform_has_reset}= Set Variable ${TRUE} Set DUT Response Timeout 320s TRY - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} EXCEPT ${platform_has_reset}= Set Variable ${FALSE} END @@ -103,7 +103,7 @@ WDT004.001 Change watchdog timeout # Now wait another 60s to make sure the platform resets within ~360s of # boot. Set DUT Response Timeout 60s - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} WDT005.001 Watchdog is detected by OS (Ubuntu) [Documentation] Boot into an OS with the watchdog enabled and verify @@ -128,7 +128,7 @@ WDT005.001 Watchdog is detected by OS (Ubuntu) ${platform_has_reset}= Set Variable ${TRUE} Set DUT Response Timeout 300s TRY - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} EXCEPT ${platform_has_reset}= Set Variable ${FALSE} END @@ -160,7 +160,7 @@ WTD006.001 Watchdog resets platform on kernel crash (Ubuntu 22.04) ${platform_has_reset}= Set Variable ${TRUE} Set DUT Response Timeout 300s TRY - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} EXCEPT ${platform_has_reset}= Set Variable ${FALSE} END diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index 31531bd561..b2cb020b13 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -74,7 +74,7 @@ Enter Boot Menu Tianocore And Return Construction Enter Setup Menu Tianocore [Documentation] Enter Setup Menu with key specified in platform-configs. - Read From Terminal Until ${TIANOCORE_STRING} + Read From Terminal Until ${FW_STRING} IF '${DUT_CONNECTION_METHOD}' == 'pikvm' Single Key PiKVM ${SETUP_MENU_KEY} ELSE diff --git a/platform-configs/include/default.robot b/platform-configs/include/default.robot index 4ee809abd1..589f0c6005 100644 --- a/platform-configs/include/default.robot +++ b/platform-configs/include/default.robot @@ -12,7 +12,7 @@ ${PAYLOAD}= tianocore ${RTE_S2_N_PORT}= 13541 ${FLASH_SIZE}= ${TBD} ${FLASH_LENGTH}= ${TBD} -${TIANOCORE_STRING}= to boot directly +${FW_STRING}= to boot directly ${BOOT_MENU_KEY}= ${F11} ${SETUP_MENU_KEY}= Delete ${BOOT_MENU_STRING}= Please select boot device: diff --git a/platform-configs/include/msi-z690-common.robot b/platform-configs/include/msi-z690-common.robot index d7dcc8378f..0e911e74a1 100644 --- a/platform-configs/include/msi-z690-common.robot +++ b/platform-configs/include/msi-z690-common.robot @@ -12,7 +12,7 @@ ${PAYLOAD}= tianocore ${RTE_S2_N_PORT}= 13541 ${FLASH_SIZE}= ${32*1024*1024} ${FLASH_LENGTH}= ${TBD} -${TIANOCORE_STRING}= to boot directly +${FW_STRING}= to boot directly ${BOOT_MENU_KEY}= ${F11} ${SETUP_MENU_KEY}= Delete ${BOOT_MENU_STRING}= Please select boot device: diff --git a/platform-configs/include/novacustom-common.robot b/platform-configs/include/novacustom-common.robot index f1a9d46daa..a08fde8c4f 100644 --- a/platform-configs/include/novacustom-common.robot +++ b/platform-configs/include/novacustom-common.robot @@ -10,7 +10,7 @@ Resource ../../lib/novacustom-lib.robot ${INITIAL_DUT_CONNECTION_METHOD}= SSH ${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} ${PAYLOAD}= tianocore -${TIANOCORE_STRING}= to boot directly +${FW_STRING}= to boot directly ${BOOT_MENU_KEY}= ${F7} ${SETUP_MENU_KEY}= ${F2} ${BOOT_MENU_STRING}= Please select boot device: diff --git a/platform-configs/include/pcengines.robot b/platform-configs/include/pcengines.robot index 5d5dcb7929..0bfdc9086a 100644 --- a/platform-configs/include/pcengines.robot +++ b/platform-configs/include/pcengines.robot @@ -10,7 +10,7 @@ ${PAYLOAD}= tianocore ${RTE_S2_N_PORT}= 13541 ${FLASH_SIZE}= ${8*1024*1024} ${FLASH_LENGTH}= ${TBD} -${TIANOCORE_STRING}= ENTER +${FW_STRING}= ENTER ${BOOT_MENU_KEY}= ${F10} ${SETUP_MENU_KEY}= ${DELETE} ${BOOT_MENU_STRING}= Please select boot device: diff --git a/platform-configs/include/protectli-common.robot b/platform-configs/include/protectli-common.robot index 03ef611509..63739a2bab 100644 --- a/platform-configs/include/protectli-common.robot +++ b/platform-configs/include/protectli-common.robot @@ -8,7 +8,7 @@ ${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} ${PAYLOAD}= tianocore ${RTE_S2_N_PORT}= 13541 ${FLASH_LENGTH}= ${TBD} -${TIANOCORE_STRING}= to boot directly +${FW_STRING}= to boot directly ${BOOT_MENU_KEY}= ${F11} ${SETUP_MENU_KEY}= ${DELETE} ${BOOT_MENU_STRING}= Please select boot device diff --git a/platform-configs/minnowboard-turbot.robot b/platform-configs/minnowboard-turbot.robot index 7f1452743c..f768134dcf 100644 --- a/platform-configs/minnowboard-turbot.robot +++ b/platform-configs/minnowboard-turbot.robot @@ -9,7 +9,7 @@ ${PAYLOAD}= tianocore ${RTE_S2_N_PORT}= 13542 ${FLASH_SIZE}= ${8*1024*1024} ${FLASH_LENGTH}= ${TBD} -${TIANOCORE_STRING}= to enter Boot Manager Menu +${FW_STRING}= to enter Boot Manager Menu ${BOOT_MENU_STRING}= Please select boot device: ${BOOT_MENU_KEY}= ${F7} ${SETUP_MENU_KEY}= ${F2} diff --git a/platform-configs/qemu-selftests-seabios.robot b/platform-configs/qemu-selftests-seabios.robot index ad721bc2b6..2574124b77 100644 --- a/platform-configs/qemu-selftests-seabios.robot +++ b/platform-configs/qemu-selftests-seabios.robot @@ -13,7 +13,7 @@ ${INITIAL_DUT_CONNECTION_METHOD}= Telnet ${DUT_CONNECTION_METHOD}= ${INITIAL_DUT_CONNECTION_METHOD} ${RTE_S2_N_PORT}= 1234 ${FLASH_SIZE}= ${8*1024*1024} -${SEABIOS_STRING}= for boot menu +${FW_STRING}= for boot menu ${BOOT_MENU_KEY}= ${F10} ${SETUP_MENU_KEY}= ${F2} ${MANUFACTURER}= QEMU diff --git a/platform-configs/rpi-3b.robot b/platform-configs/rpi-3b.robot index 223fcec657..75d071d63b 100644 --- a/platform-configs/rpi-3b.robot +++ b/platform-configs/rpi-3b.robot @@ -4,7 +4,7 @@ ${PAYLOAD}= ${TBD} ${RTE_S2_N_PORT}= 13541 ${FLASH_SIZE}= ${TBD} ${FLASH_LENGTH}= ${TBD} -${TIANOCORE_STRING}= ${TBD} +${FW_STRING}= ${TBD} ${BOOT_MENU_KEY}= ${TBD} ${SETUP_MENU_KEY}= ${TBD} ${BOOT_MENU_STRING}= ${TBD} From 3fa1672058049a3d1a99bf1b682fdae8cefa7cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Wed, 27 Nov 2024 23:31:28 +0100 Subject: [PATCH 21/33] lib/bios/common.robot: initial support for common Enter Boot Menu kwd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- .../custom-boot-menu-key.robot | 2 +- dasharo-compatibility/usb-detect.robot | 2 +- keywords.robot | 2 +- lib/bios/common.robot | 22 +++++++++++++++++ lib/bios/edk2.robot | 18 ++------------ lib/bios/seabios.robot | 24 ++++--------------- self-tests/scrolling-boot-manager.robot | 2 +- self-tests/setup-and-boot-menus.robot | 4 ++-- self-tests/setup-and-boot-seabios.robot | 4 ++-- 9 files changed, 37 insertions(+), 43 deletions(-) create mode 100644 lib/bios/common.robot diff --git a/dasharo-compatibility/custom-boot-menu-key.robot b/dasharo-compatibility/custom-boot-menu-key.robot index 402b8b076a..3c7718a1ac 100644 --- a/dasharo-compatibility/custom-boot-menu-key.robot +++ b/dasharo-compatibility/custom-boot-menu-key.robot @@ -30,7 +30,7 @@ CBK001.001 Custom boot menu key Skip If not ${CUSTOM_BOOT_MENU_KEY_SUPPORT} CBK001.001 not supported Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} CBK001.001 not supported Power On - Enter Boot Menu Tianocore + Enter Boot Menu Read From Terminal Until ${BOOT_MENU_STRING} CBK002.001 Custom setup menu key diff --git a/dasharo-compatibility/usb-detect.robot b/dasharo-compatibility/usb-detect.robot index 1e63ae753a..533349df1b 100644 --- a/dasharo-compatibility/usb-detect.robot +++ b/dasharo-compatibility/usb-detect.robot @@ -40,7 +40,7 @@ UDT001.001 USB detection after coldboot ${usb}= Evaluate 0 Power Cycle On IF '${PAYLOAD}' == 'tianocore' - Enter Boot Menu Tianocore + Enter Boot Menu ${menu}= Read From Terminal Until ESC to exit ELSE IF '${PAYLOAD}' == 'seabios' ${menu}= Enter SeaBIOS And Return Menu diff --git a/keywords.robot b/keywords.robot index e3876becdf..664a6bd0b3 100644 --- a/keywords.robot +++ b/keywords.robot @@ -1451,7 +1451,7 @@ Boot Operating System [Arguments] ${operating_system} IF '${DUT_CONNECTION_METHOD}' == 'SSH' RETURN Set Local Variable ${is_system_installed} ${FALSE} - Enter Boot Menu Tianocore + Enter Boot Menu ${menu_construction}= Get Boot Menu Construction ${is_system_installed}= Evaluate "${operating_system}" in """${menu_construction}""" IF not ${is_system_installed} diff --git a/lib/bios/common.robot b/lib/bios/common.robot new file mode 100644 index 0000000000..78598e59df --- /dev/null +++ b/lib/bios/common.robot @@ -0,0 +1,22 @@ +*** Settings *** +Documentation Collection of keywords related to common firmware operations. + +Library Collections +Library String + + +*** Keywords *** +Enter Boot Menu + [Documentation] Enter Boot Menu with tianocore boot menu key mapped in + ... keys list. + Read From Terminal Until ${FW_STRING} + IF '${DUT_CONNECTION_METHOD}' == 'pikvm' + Single Key PiKVM ${BOOT_MENU_KEY} + ELSE + Write Bare Into Terminal ${BOOT_MENU_KEY} + END + IF ${LAPTOP_EC_SERIAL_WORKAROUND} == ${TRUE} + # FIXME: Laptop EC serial workaround + Press Key N Times 1 ${ARROW_DOWN} + Press Key N Times 1 ${ARROW_UP} + END diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index b2cb020b13..66a4c4cc89 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -4,24 +4,10 @@ Documentation Collection of keywords related to EDK2 menus Library Collections Library String Library ./menus.py +Resource common.robot *** Keywords *** -Enter Boot Menu Tianocore - [Documentation] Enter Boot Menu with tianocore boot menu key mapped in - ... keys list. - Read From Terminal Until ${TIANOCORE_STRING} - IF '${DUT_CONNECTION_METHOD}' == 'pikvm' - Single Key PiKVM ${BOOT_MENU_KEY} - ELSE - Write Bare Into Terminal ${BOOT_MENU_KEY} - END - IF ${LAPTOP_EC_SERIAL_WORKAROUND} == ${TRUE} - # FIXME: Laptop EC serial workaround - Press Key N Times 1 ${ARROW_DOWN} - Press Key N Times 1 ${ARROW_UP} - END - Get Boot Menu Construction [Documentation] Keyword allows to get and return boot menu construction. ${menu}= Read From Terminal Until exit @@ -68,7 +54,7 @@ Get Boot Menu Construction Enter Boot Menu Tianocore And Return Construction [Documentation] Enters boot menu, returning menu construction - Enter Boot Menu Tianocore + Enter Boot Menu ${menu}= Get Boot Menu Construction RETURN ${menu} diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 060dbe4dcd..668e9b69d6 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -7,24 +7,10 @@ Documentation Collection of keywords related to SeaBIOS. # Library Collections Library String +Resource common.robot *** Keywords *** -Enter Boot Menu SeaBIOS - [Documentation] Enter Boot Menu with SeaBIOS boot menu key mapped in - ... keys list. - Read From Terminal Until ${SEABIOS_STRING} - IF '${DUT_CONNECTION_METHOD}' == 'pikvm' - Single Key PiKVM ${BOOT_MENU_KEY} - ELSE - Write Bare Into Terminal ${BOOT_MENU_KEY} - END - IF ${LAPTOP_EC_SERIAL_WORKAROUND} == ${TRUE} - # FIXME: Laptop EC serial workaround - Press Key N Times 1 ${ARROW_DOWN} - Press Key N Times 1 ${ARROW_UP} - END - Get Boot Menu Construction [Documentation] Keyword allows to get and return boot menu construction. ${menu}= Read From Terminal Until TPM Configuration @@ -42,13 +28,13 @@ Get Boot Menu Construction Enter Boot Menu SeaBIOS And Return Construction [Documentation] Enters boot menu, returning menu construction - Enter Boot Menu SeaBIOS + Enter Boot Menu ${menu}= Get Boot Menu Construction RETURN ${menu} Enter Sortbootorder [Documentation] Enter sortbootorder with Boot Menu Construction. - Enter Boot Menu SeaBIOS + Enter Boot Menu ${menu}= Get Boot Menu Construction Enter Menu From Snapshot ${menu} \[setup\] @@ -293,13 +279,13 @@ Enable Network/PXE Boot Enter TPM Configuration [Documentation] Enter TPM Configuration with Boot Menu Construction. - Enter Boot Menu SeaBIOS + Enter Boot Menu ${menu}= Get Boot Menu Construction Enter Menu From Snapshot ${menu} TPM Configuration Enter IPXE [Documentation] Enter iPXE with Boot Menu Construction. Enable Network/PXE Boot - Enter Boot Menu SeaBIOS + Enter Boot Menu ${menu}= Get Boot Menu Construction Enter Menu From Snapshot ${menu} iPXE diff --git a/self-tests/scrolling-boot-manager.robot b/self-tests/scrolling-boot-manager.robot index 14dadecf58..632a6577a2 100644 --- a/self-tests/scrolling-boot-manager.robot +++ b/self-tests/scrolling-boot-manager.robot @@ -28,7 +28,7 @@ Suite Teardown Run Keyword *** Test Cases *** -Enter Boot Menu Tianocore +Enter Boot Menu [Documentation] Test Enter Boot Menu kwd Prepare EFI Partition With System Files Power On diff --git a/self-tests/setup-and-boot-menus.robot b/self-tests/setup-and-boot-menus.robot index 69bc3c7242..49f6448d30 100644 --- a/self-tests/setup-and-boot-menus.robot +++ b/self-tests/setup-and-boot-menus.robot @@ -28,10 +28,10 @@ Suite Teardown Run Keyword *** Test Cases *** -Enter Boot Menu Tianocore +Enter Boot Menu [Documentation] Test Enter Boot Menu kwd Power On - Enter Boot Menu Tianocore + Enter Boot Menu ${out}= Read From Terminal Until exit Should Contain ${out} Please select boot device: diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot index 3c48718f13..cff8b48412 100644 --- a/self-tests/setup-and-boot-seabios.robot +++ b/self-tests/setup-and-boot-seabios.robot @@ -28,10 +28,10 @@ Suite Teardown Run Keyword *** Test Cases *** -Enter Boot Menu SeaBIOS +Enter Boot Menu [Documentation] Test Enter Boot Menu kwd Power On - Enter Boot Menu SeaBIOS + Enter Boot Menu ${out}= Read From Terminal Until [memtest] Should Contain ${out} Select boot device: From ea7666403752a192596fc20bd6cfe6a3109cca2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Thu, 28 Nov 2024 00:31:02 +0100 Subject: [PATCH 22/33] add unified Enter Boot Menu and Return Construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit replace: - Enter Boot Menu Tianocore And Return Construction - Enter Boot Menu SeaBIOS And Return Construction with one keyword Enter Boot Menu and Return Construction, which is provided by lib/bios/common.robot It also move Parse Menu Snapshot Into Construction to common lib. Signed-off-by: Piotr Król --- dasharo-compatibility/esp-scanning.robot | 12 ++-- .../network-boot-utilities.robot | 14 ++--- dasharo-compatibility/network-boot.robot | 14 ++--- dasharo-compatibility/nvme-support.robot | 2 +- dasharo-compatibility/uefi-shell.robot | 2 +- .../usb-hid-and-msc-support.robot | 2 +- dasharo-performance/platform-stability.robot | 2 +- dasharo-security/network-stack.robot | 4 +- dasharo-security/usb-stack.robot | 8 +-- dasharo-stability/capsule-update.robot | 2 +- keywords.robot | 4 +- lib/bios/common.robot | 53 ++++++++++++++++++ lib/bios/edk2.robot | 55 +------------------ lib/bios/seabios.robot | 53 ------------------ lib/dts-lib.robot | 2 +- lib/options/uefi-setup-menu.robot | 2 +- lib/secure-boot-lib.robot | 2 +- self-tests/scrolling-boot-manager.robot | 2 +- self-tests/setup-and-boot-menus.robot | 4 +- self-tests/setup-and-boot-seabios.robot | 4 +- 20 files changed, 96 insertions(+), 147 deletions(-) diff --git a/dasharo-compatibility/esp-scanning.robot b/dasharo-compatibility/esp-scanning.robot index 25007989cb..f62de834fb 100644 --- a/dasharo-compatibility/esp-scanning.robot +++ b/dasharo-compatibility/esp-scanning.robot @@ -37,7 +37,7 @@ ESP001.001 ESP Scan with OS-specific .efi files added ... files will have boot menu entries created for them. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} ESP001.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction FOR ${system} IN @{SYSTEMS_FOR_ESP_TESTING} Should Contain Match ${boot_menu} ${system}* END @@ -55,7 +55,7 @@ ESP003.001 ESP Scan ignores OSes on removable media ... ${TINYCORE_URL} ... 5c0c5c7c835070f0adcaeafad540252e9dd2935c02e57de6112fb92fb5d6f9c5 Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Should Not Contain Match ${boot_menu} *CorePlus* ESP004.001 ESP Scan does not create duplicate entries @@ -64,7 +64,7 @@ ESP004.001 ESP Scan does not create duplicate entries ... are present for a single OS. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} ESP004.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction # In general, boot entries may be duplicated if created by other means. # Here we only want to test the duplicates created by the ESP scanning features. @@ -85,7 +85,7 @@ ESP005.001 ESP Scan detects Dasharo Tools Suite ... ${DTS_URL} ... f42b59633dbcc16ecbd7c98a880c582c5235c22626d7204202c922f3a7fa231b Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Should Contain Match ${boot_menu} Dasharo Tools Suite on (* ESP006.001 ESP Scan does not find non-block boot devices @@ -93,7 +93,7 @@ ESP006.001 ESP Scan does not find non-block boot devices ... find non-block boot devices Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} ESP004.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction FOR ${boot_option} IN @{boot_menu} Should Not Contain ${boot_option} on Non-Block Boot Device END @@ -107,7 +107,7 @@ ESP002.001 ESP Scan after deleting additional .efi files Power On Clear Out EFI Partition Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction FOR ${system} IN @{SYSTEMS_FOR_ESP_TESTING} Should Not Contain Match ${boot_menu} ${system}* END diff --git a/dasharo-compatibility/network-boot-utilities.robot b/dasharo-compatibility/network-boot-utilities.robot index 57b6af857a..f164c22bb1 100644 --- a/dasharo-compatibility/network-boot-utilities.robot +++ b/dasharo-compatibility/network-boot-utilities.robot @@ -36,7 +36,7 @@ NBT001.001 Netboot is available Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT001.001 not supported Power On Set DUT Response Timeout 60s - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities Set DUT Response Timeout 20s Read From Terminal Until Network Boot and Utilities @@ -48,7 +48,7 @@ NBT002.001 OS selection & utilities is available Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT002.001 not supported Power On Set DUT Response Timeout 120s - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 Enter Submenu From Snapshot ${ipxe_menu} OS Selection & Utilities @@ -59,7 +59,7 @@ NBT003.001 iPXE boot is available ... selection iPXE menu appears. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT003.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 Enter Submenu From Snapshot ${ipxe_menu} iPXE Boot @@ -72,7 +72,7 @@ NBT004.001 iPXE shell is available Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT004.001 not supported Power On Set DUT Response Timeout 60s - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 Enter Submenu From Snapshot ${ipxe_menu} iPXE Shell @@ -85,7 +85,7 @@ NBT005.001 iPXE shell works correctly Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT005.001 not supported Power On Set DUT Response Timeout 60s - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 Enter Submenu From Snapshot ${ipxe_menu} iPXE Shell @@ -105,7 +105,7 @@ NBT006.001 Advanced option is available Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT006.001 not supported Power On Set DUT Response Timeout 60s - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 Enter Submenu From Snapshot ${ipxe_menu} Advanced @@ -118,7 +118,7 @@ NBT007.001 Change netboot URL option works correctly Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} NBT007.001 not supported Power On Set DUT Response Timeout 60s - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} Network Boot and Utilities ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 Enter Submenu From Snapshot ${ipxe_menu} Advanced diff --git a/dasharo-compatibility/network-boot.robot b/dasharo-compatibility/network-boot.robot index ca82b3885a..c3e54bea45 100644 --- a/dasharo-compatibility/network-boot.robot +++ b/dasharo-compatibility/network-boot.robot @@ -34,7 +34,7 @@ PXE001.001 Dasharo Network Boot is available ... option, Dasharo Network Boot Menu is displayed. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE001.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${out}= Read From Terminal Until ${EDK2_IPXE_CHECKPOINT} Should Contain ${out} Dasharo Network Boot Menu @@ -44,7 +44,7 @@ PXE002.001 Dasharo network boot menu boot options order is correct ... contains all of the needed options which are in the correct order. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE002.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${ipxe_menu}= Get IPXE Boot Menu Construction Should Contain ${ipxe_menu}[0] Autoboot (DHCP) @@ -57,7 +57,7 @@ PXE003.001 Autoboot option is available and works correctly ... Dasharo Network Boot Menu works correctly. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE003.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${ipxe_menu}= Get IPXE Boot Menu Construction Enter Submenu From Snapshot ${ipxe_menu} Autoboot (DHCP) @@ -70,7 +70,7 @@ PXE004.001 DTS option is available and works correctly [Tags] minimal-regression Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE004.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${ipxe_menu}= Get IPXE Boot Menu Construction Enter Submenu From Snapshot ${ipxe_menu} Dasharo Tools Suite @@ -88,7 +88,7 @@ PXE005.001 OS installation option is available and works correctly ... in Dasharo Network Boot Menu allows booting into netboot.xyz server. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE005.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${ipxe_menu}= Get IPXE Boot Menu Construction Enter Submenu From Snapshot ${ipxe_menu} OS installation @@ -105,7 +105,7 @@ PXE006.001 iPXE shell option is available and works correctly ... Dasharo Network Boot Menu works correctly. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE006.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${ipxe_menu}= Get IPXE Boot Menu Construction Enter Submenu From Snapshot ${ipxe_menu} iPXE Shell @@ -117,7 +117,7 @@ PXE007.001 Dasharo Network Boot over https not http Skip If not ${IPXE_BOOT_SUPPORT} PXE007.001 not supported Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PXE007.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} ${ipxe_menu}= Get IPXE Boot Menu Construction Enter Submenu From Snapshot ${ipxe_menu} Dasharo Tools Suite diff --git a/dasharo-compatibility/nvme-support.robot b/dasharo-compatibility/nvme-support.robot index fa9a22821c..7359a3dfde 100644 --- a/dasharo-compatibility/nvme-support.robot +++ b/dasharo-compatibility/nvme-support.robot @@ -30,7 +30,7 @@ NVM001.001 NVMe support in firmware ... NVMe disk in M.2 slot. Skip If not ${NVME_DISK_SUPPORT} NVM001.001 not supported Power On - ${out}= Enter Boot Menu Tianocore And Return Construction + ${out}= Enter Boot Menu And Return Construction Should Contain ${out} ${CLEVO_DISK} NVM001.002 NVMe support in OS (Ubuntu) diff --git a/dasharo-compatibility/uefi-shell.robot b/dasharo-compatibility/uefi-shell.robot index e0b3bb4e3d..770372016e 100644 --- a/dasharo-compatibility/uefi-shell.robot +++ b/dasharo-compatibility/uefi-shell.robot @@ -30,6 +30,6 @@ USH001.001 UEFI Shell Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} USH001.001 not supported Skip If not ${UEFI_SHELL_SUPPORT} USH001.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} UEFI Shell Read From Terminal Until UEFI Interactive Shell diff --git a/dasharo-compatibility/usb-hid-and-msc-support.robot b/dasharo-compatibility/usb-hid-and-msc-support.robot index fdc3d3671a..3f95585a54 100644 --- a/dasharo-compatibility/usb-hid-and-msc-support.robot +++ b/dasharo-compatibility/usb-hid-and-msc-support.robot @@ -31,7 +31,7 @@ USB001.001 USB devices detected in FW Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} Upload And Mount DTS Flash Iso Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Check That USB Devices Are Detected ${boot_menu} USB001.002 USB devices detected by OS (Ubuntu) diff --git a/dasharo-performance/platform-stability.robot b/dasharo-performance/platform-stability.robot index 104e221b6f..3b5cda8d63 100644 --- a/dasharo-performance/platform-stability.robot +++ b/dasharo-performance/platform-stability.robot @@ -32,7 +32,7 @@ STB001.001 Verify if no reboot occurs in the firmware ... a defined time an attempt to read the same menu is repeated. Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} STB001.001 not supported Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} UEFI Shell Read From Terminal Until other key to continue Set Prompt For Terminal Shell> diff --git a/dasharo-security/network-stack.robot b/dasharo-security/network-stack.robot index d6db6802af..3646d75a17 100644 --- a/dasharo-security/network-stack.robot +++ b/dasharo-security/network-stack.robot @@ -34,7 +34,7 @@ NBA001.001 Enable Network Boot (firmware) IF '${DUT_CONNECTION_METHOD}' == 'pikvm' Remap Keys Variables To PiKVM Set UEFI Option NetworkBoot ${TRUE} - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Should Contain ${boot_menu} ${IPXE_BOOT_ENTRY} NBA002.001 Disable Network Boot (firmware) @@ -46,5 +46,5 @@ NBA002.001 Disable Network Boot (firmware) IF '${DUT_CONNECTION_METHOD}' == 'pikvm' Remap Keys Variables To PiKVM Set UEFI Option NetworkBoot ${FALSE} - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Should Not Contain ${boot_menu} ${IPXE_BOOT_ENTRY} diff --git a/dasharo-security/usb-stack.robot b/dasharo-security/usb-stack.robot index d46ed3c103..84dac438ea 100644 --- a/dasharo-security/usb-stack.robot +++ b/dasharo-security/usb-stack.robot @@ -34,7 +34,7 @@ USS001.001 Enable USB stack (firmware) Skip If "${OPTIONS_LIB}" == "dcu" Set UEFI Option UsbDriverStack ${TRUE} Set UEFI Option UsbMassStorage ${TRUE} - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Check That USB Devices Are Detected ${boot_menu} USS002.001 Disable USB stack (firmware) @@ -46,7 +46,7 @@ USS002.001 Disable USB stack (firmware) Skip If "${OPTIONS_LIB}" == "dcu" Set UEFI Option UsbMassStorage ${FALSE} Set UEFI Option UsbDriverStack ${FALSE} - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction # Check That USB Devices Are Not Detected ${boot_menu} USS003.001 Enable USB Mass Storage (firmware) @@ -70,7 +70,7 @@ USS003.001 Enable USB Mass Storage (firmware) END Set Option State ${usb_menu} Enable USB Mass Storage ${TRUE} Save Changes And Reset - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Check That USB Devices Are Detected ${boot_menu} USS004.001 Disable USB Mass Storage (firmware) @@ -95,5 +95,5 @@ USS004.001 Disable USB Mass Storage (firmware) END Set Option State ${usb_menu} Enable USB Mass Storage ${FALSE} Save Changes And Reset - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction # Check That USB Devices Are Not Detected ${boot_menu} diff --git a/dasharo-stability/capsule-update.robot b/dasharo-stability/capsule-update.robot index c7ca494422..7cd4d42a52 100644 --- a/dasharo-stability/capsule-update.robot +++ b/dasharo-stability/capsule-update.robot @@ -230,7 +230,7 @@ Get Key To Press RETURN ${digit} Select UEFI Shell Boot Option - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} UEFI Shell Read From Terminal Until Shell> diff --git a/keywords.robot b/keywords.robot index 664a6bd0b3..322c42aa50 100644 --- a/keywords.robot +++ b/keywords.robot @@ -320,7 +320,7 @@ Get Firmware Version IF '${FLASH_VERIFY_METHOD}'=='iPXE-boot' Boot Debian From IPXE ${PXE_IP} ${HTTP_PORT} ${FILENAME} ${DEBIAN_STABLE_VER} ELSE IF '${FLASH_VERIFY_METHOD}'=='tianocore-shell' - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${FLASH_VERIFY_OPTION} ELSE IF '${FLASH_VERIFY_METHOD}'=='none' No Operation @@ -1358,7 +1358,7 @@ Reboot Via OS Boot By Petitboot Reboot Via Ubuntu By Tianocore [Documentation] Reboot system with Ubuntu installed on the DUT while ... already logged into Tianocore. - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ubuntu Login To Linux Switch To Root User diff --git a/lib/bios/common.robot b/lib/bios/common.robot index 78598e59df..4689303da1 100644 --- a/lib/bios/common.robot +++ b/lib/bios/common.robot @@ -20,3 +20,56 @@ Enter Boot Menu Press Key N Times 1 ${ARROW_DOWN} Press Key N Times 1 ${ARROW_UP} END + +Enter Boot Menu And Return Construction + [Documentation] Enters boot menu, returning menu construction + Enter Boot Menu + ${menu}= Get Boot Menu Construction + RETURN ${menu} + +Parse Menu Snapshot Into Construction + [Documentation] Breaks grabbed menu data into lines. + [Arguments] ${menu} ${lines_top} ${lines_bot} + ${slice_start}= Set Variable ${lines_top} + IF ${lines_bot} == 0 + ${slice_end}= Set Variable None + ELSE + ${slice_end}= Evaluate ${lines_bot} * -1 + END + ${menu}= Remove String ${menu} \r + @{menu_lines}= Split To Lines ${menu} + @{construction}= Create List + FOR ${line} IN @{menu_lines} + # Replace multiple spaces with a single one + ${line}= Replace String Using Regexp ${line} ${SPACE}+ ${SPACE} + # Remove leading and trailing spaces + ${line}= Strip String ${line} + # Drop leading and trailing pipes (e.g. in One Time Boot Menu) + ${line}= Strip String ${line} characters=| + # Remove leading and trailing spaces + ${line}= Strip String ${line} + # Drop all remaining borders + ${line}= Remove String Using Regexp ${line} ^[\\|\\s/\\\\-]+$ + # If the resulting line is not empty, add it as a menu entry + ${length}= Get Length ${line} + IF ${length} > 0 Append To List ${construction} ${line} + END + Log ${construction} + ${construction}= Get Slice From List ${construction} ${slice_start} ${slice_end} + # TODO: Improve parsing of the menu into construction. It can probably be + # simplified, but at least we have this only in one kewyrod not in multiple + # ones. + # Make sure to remove control help text appearing in the screen if somehow + # they are still there. + Remove Values From List + ... ${construction} + ... Esc\=Exit + ... ^v\=Move High + ... \=Select Entry + ... F9\=Reset to Defaults F10\=Save + ... LCtrl+LAlt+F12\=Save screenshot + ... Toggle Checkbox + ... one adjusts to change + ... Select boot device: + ... , N for PXE boot + RETURN ${construction} diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index 66a4c4cc89..3ee873b691 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -52,12 +52,6 @@ Get Boot Menu Construction END RETURN ${construction} -Enter Boot Menu Tianocore And Return Construction - [Documentation] Enters boot menu, returning menu construction - Enter Boot Menu - ${menu}= Get Boot Menu Construction - RETURN ${menu} - Enter Setup Menu Tianocore [Documentation] Enter Setup Menu with key specified in platform-configs. Read From Terminal Until ${FW_STRING} @@ -88,51 +82,6 @@ Get Menu Construction ${menu}= Parse Menu Snapshot Into Construction ${out} ${lines_top} ${lines_bot} RETURN ${menu} -Parse Menu Snapshot Into Construction - [Documentation] Breaks grabbed menu data into lines. - [Arguments] ${menu} ${lines_top} ${lines_bot} - ${slice_start}= Set Variable ${lines_top} - IF ${lines_bot} == 0 - ${slice_end}= Set Variable None - ELSE - ${slice_end}= Evaluate ${lines_bot} * -1 - END - ${menu}= Remove String ${menu} \r - @{menu_lines}= Split To Lines ${menu} - @{construction}= Create List - FOR ${line} IN @{menu_lines} - # Replace multiple spaces with a single one - ${line}= Replace String Using Regexp ${line} ${SPACE}+ ${SPACE} - # Remove leading and trailing spaces - ${line}= Strip String ${line} - # Drop leading and trailing pipes (e.g. in One Time Boot Menu) - ${line}= Strip String ${line} characters=| - # Remove leading and trailing spaces - ${line}= Strip String ${line} - # Drop all remaining borders - ${line}= Remove String Using Regexp ${line} ^[\\|\\s/\\\\-]+$ - # If the resulting line is not empty, add it as a menu entry - ${length}= Get Length ${line} - IF ${length} > 0 Append To List ${construction} ${line} - END - Log ${construction} - ${construction}= Get Slice From List ${construction} ${slice_start} ${slice_end} - # TODO: Improve parsing of the menu into construction. It can probably be - # simplified, but at least we have this only in one kewyrod not in multiple - # ones. - # Make sure to remove control help text appearing in the screen if somehow - # they are still there. - Remove Values From List - ... ${construction} - ... Esc\=Exit - ... ^v\=Move High - ... \=Select Entry - ... F9\=Reset to Defaults F10\=Save - ... LCtrl+LAlt+F12\=Save screenshot - ... Toggle Checkbox - ... one adjusts to change - RETURN ${construction} - Enter Setup Menu Tianocore And Return Construction [Documentation] Enters Setup Menu and returns Setup Menu construction Enter Setup Menu Tianocore @@ -428,7 +377,7 @@ Reset To Defaults Tianocore Enter IPXE [Documentation] Enter iPXE after device power cutoff. # TODO: problem with iPXE string (e.g. when 3 network interfaces are available) - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY} IF ${NETBOOT_UTILITIES_SUPPORT} == ${TRUE} ${ipxe_menu}= Get IPXE Boot Menu Construction lines_top=2 @@ -580,7 +529,7 @@ Boot System Or From Connected Disk # robocop: disable=too-long-keyword Write Bare Into Terminal ${SEABIOS_BOOT_DEVICE} RETURN END - ${menu_construction}= Enter Boot Menu Tianocore And Return Construction + ${menu_construction}= Enter Boot Menu And Return Construction # With ESP scanning feature boot entries are named differently: IF ${ESP_SCANNING_SUPPORT} == ${TRUE} IF "${system_name}" == "ubuntu" diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 668e9b69d6..b4b26c8e5f 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -26,12 +26,6 @@ Get Boot Menu Construction ${construction}= Parse Menu Snapshot Into Construction ${menu} 1 0 RETURN ${construction} -Enter Boot Menu SeaBIOS And Return Construction - [Documentation] Enters boot menu, returning menu construction - Enter Boot Menu - ${menu}= Get Boot Menu Construction - RETURN ${menu} - Enter Sortbootorder [Documentation] Enter sortbootorder with Boot Menu Construction. Enter Boot Menu @@ -46,53 +40,6 @@ Get Sortbootorder Menu Construction ${menu}= Parse Menu Snapshot Into Construction ${out} 7 0 RETURN ${menu} -Parse Menu Snapshot Into Construction - [Documentation] Breaks grabbed menu data into lines. - [Arguments] ${menu} ${lines_top} ${lines_bot} - ${slice_start}= Set Variable ${lines_top} - IF ${lines_bot} == 0 - ${slice_end}= Set Variable None - ELSE - ${slice_end}= Evaluate ${lines_bot} * -1 - END - ${menu}= Remove String ${menu} \r - @{menu_lines}= Split To Lines ${menu} - @{construction}= Create List - FOR ${line} IN @{menu_lines} - # Replace multiple spaces with a single one - ${line}= Replace String Using Regexp ${line} ${SPACE}+ ${SPACE} - # Remove leading and trailing spaces - ${line}= Strip String ${line} - # Drop leading and trailing pipes (e.g. in One Time Boot Menu) - ${line}= Strip String ${line} characters=| - # Remove leading and trailing spaces - ${line}= Strip String ${line} - # Drop all remaining borders - ${line}= Remove String Using Regexp ${line} ^[\\|\\s/\\\\-]+$ - # If the resulting line is not empty, add it as a menu entry - ${length}= Get Length ${line} - IF ${length} > 0 Append To List ${construction} ${line} - END - Log ${construction} - ${construction}= Get Slice From List ${construction} ${slice_start} ${slice_end} - # TODO: Improve parsing of the menu into construction. It can probably be - # simplified, but at least we have this only in one kewyrod not in multiple - # ones. - # Make sure to remove control help text appearing in the screen if somehow - # they are still there. - Remove Values From List - ... ${construction} - ... Esc\=Exit - ... ^v\=Move High - ... \=Select Entry - ... F9\=Reset to Defaults F10\=Save - ... LCtrl+LAlt+F12\=Save screenshot - ... Toggle Checkbox - ... one adjusts to change - ... Select boot device: - ... , N for PXE boot - RETURN ${construction} - Enter Setup Menu SeaBIOS And Return Construction [Documentation] Enters Setup Menu and returns Setup Menu construction Enter Setup Menu SeaBIOS diff --git a/lib/dts-lib.robot b/lib/dts-lib.robot index eb3673a5a9..550860cc98 100644 --- a/lib/dts-lib.robot +++ b/lib/dts-lib.robot @@ -49,7 +49,7 @@ Boot Dasharo Tools Suite ... boot method (from USB or from iPXE) as parameter. [Arguments] ${dts_booting_method} IF '${dts_booting_method}'=='USB' - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction IF '${DUT_CONNECTION_METHOD}' == 'pikvm' Enter Submenu From Snapshot ${boot_menu} PiKVM Composite KVM Device ELSE IF '${MANUFACTURER}' == 'QEMU' diff --git a/lib/options/uefi-setup-menu.robot b/lib/options/uefi-setup-menu.robot index d12f2ee2d2..27c5cd2049 100644 --- a/lib/options/uefi-setup-menu.robot +++ b/lib/options/uefi-setup-menu.robot @@ -74,7 +74,7 @@ Get UEFI Boot Manager Entries Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction RETURN ${boot_menu} Measure Coldboot Time diff --git a/lib/secure-boot-lib.robot b/lib/secure-boot-lib.robot index f5e6e1a167..5f5102801e 100644 --- a/lib/secure-boot-lib.robot +++ b/lib/secure-boot-lib.robot @@ -224,7 +224,7 @@ Select File In File Explorer Enter UEFI Shell [Documentation] Boots into UEFI Shell. Should be called after Power On or ... reboot - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction Enter Submenu From Snapshot ${boot_menu} UEFI Shell Read From Terminal Until Shell> Sleep 1s diff --git a/self-tests/scrolling-boot-manager.robot b/self-tests/scrolling-boot-manager.robot index 632a6577a2..9ad108c261 100644 --- a/self-tests/scrolling-boot-manager.robot +++ b/self-tests/scrolling-boot-manager.robot @@ -32,6 +32,6 @@ Enter Boot Menu [Documentation] Test Enter Boot Menu kwd Prepare EFI Partition With System Files Power On - ${boot_menu}= Enter Boot Menu Tianocore And Return Construction + ${boot_menu}= Enter Boot Menu And Return Construction ${no_entries}= Get Length ${boot_menu} Should Be True ${no_entries} > 11 diff --git a/self-tests/setup-and-boot-menus.robot b/self-tests/setup-and-boot-menus.robot index 49f6448d30..ce92c2aa75 100644 --- a/self-tests/setup-and-boot-menus.robot +++ b/self-tests/setup-and-boot-menus.robot @@ -35,10 +35,10 @@ Enter Boot Menu ${out}= Read From Terminal Until exit Should Contain ${out} Please select boot device: -Enter Boot Menu Tianocore And Return Construction +Enter Boot Menu And Return Construction [Documentation] Test Enter Boot Menu kwd Power On - ${menu}= Enter Boot Menu Tianocore And Return Construction + ${menu}= Enter Boot Menu And Return Construction List Should Not Contain Value ${menu} Please select boot device: List Should Contain Value ${menu} Setup Menu Construction Should Not Contain Control Text ${menu} diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot index cff8b48412..b856e78101 100644 --- a/self-tests/setup-and-boot-seabios.robot +++ b/self-tests/setup-and-boot-seabios.robot @@ -35,10 +35,10 @@ Enter Boot Menu ${out}= Read From Terminal Until [memtest] Should Contain ${out} Select boot device: -Enter Boot Menu SeaBIOS And Return Construction +Enter Boot Menu And Return Construction [Documentation] Test Enter Boot Menu kwd Power On - ${menu}= Enter Boot Menu SeaBIOS And Return Construction + ${menu}= Enter Boot Menu And Return Construction List Should Not Contain Value ${menu} Select boot device: List Should Contain Value ${menu} 1. DVD/CD [AHCI/2: QEMU DVD-ROM ATAPI-4 DVD/CD] List Should Contain Value ${menu} 2. Payload [setup] From db3a1ad45ef838feab5d147b6dc79dbf52a8d8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Thu, 28 Nov 2024 01:10:07 +0100 Subject: [PATCH 23/33] lib/bios/seabios.robot: remove unused Get IPXE Boot Menu Construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/seabios.robot | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index b4b26c8e5f..afe832fa36 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -209,13 +209,6 @@ Save Sortbootorder Changes [Documentation] This keyword saves introduced changes Write Bare Into Terminal s -Get IPXE Boot Menu Construction - [Documentation] Keyword allows to get and return iPXE menu construction. - [Arguments] ${lines_top}=1 ${lines_bot}=0 ${checkpoint}=${EDK2_IPXE_CHECKPOINT} - ${menu}= Read From Terminal Until ${checkpoint} - ${construction}= Parse Menu Snapshot Into Construction ${menu} ${lines_top} ${lines_bot} - RETURN ${construction} - Enable Network/PXE Boot [Documentation] Enable Network/PXE Boot and save. Enter Sortbootorder From ced49a6711e007d8c8911dc6b138d5b59b3c707e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 29 Nov 2024 14:51:28 +0100 Subject: [PATCH 24/33] lib/bios/seabios.robot: remove unused Get RTC Clock Submenu Construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/seabios.robot | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index afe832fa36..09fb32770c 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -46,32 +46,6 @@ Enter Setup Menu SeaBIOS And Return Construction ${menu}= Get Setup Menu Construction RETURN ${menu} -Get RTC Clock Submenu Construction - [Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" - # In most cases, we need to strip two lines: - # TOP: - # Title line, such as: Dasharo System Features - # BOTTOM: - # Help line, such as: F9=Reset to Defaults Esc=Exit - ${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} - # Handling of additional exceptions appearing in submenus: - # 1. Drop unselectable strings from Device Manager - Remove Values From List ${submenu} Devices List - - IF ${opt_only} == ${TRUE} - # Handling exceptions caused by some options splitting into multiple lines. - # For Dasharo System Features options, we can assume that each entry has - # either ">", or "[ ]", or "< >". For other edk2 menus, this is not always - # the case (yet?). - FOR ${entry} IN @{submenu} - ${status}= Check If Menu Line Is An Option ${entry} - IF ${status} != ${TRUE} - Remove Values From List ${submenu} ${entry} - END - END - END - RETURN ${submenu} - Get Option State [Documentation] Gets menu construction and option name as arguments. ... Returns option state, which can be: True or False. From de96c4615519445f7b1a395f9e8e34e98774b91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 29 Nov 2024 14:53:03 +0100 Subject: [PATCH 25/33] unify Enter Setup Menu kwd for uefi and seabios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- dasharo-compatibility/cpu-cores-count.robot | 20 +++++++++---------- .../custom-boot-menu-key.robot | 2 +- .../dasharo-tools-suite.robot | 4 ++-- dasharo-compatibility/memory-profile.robot | 8 ++++---- dasharo-compatibility/power-after-fail.robot | 14 ++++++------- .../setup-menu-information.robot | 12 +++++------ dasharo-security/uefi-password.robot | 12 +++++------ lib/bios/common.robot | 13 ++++++++++++ lib/bios/edk2.robot | 13 ++---------- lib/bios/seabios.robot | 14 +------------ lib/options/uefi-setup-menu.robot | 2 +- platform-configs/qemu-selftests-seabios.robot | 2 +- self-tests/setup-and-boot-menus.robot | 8 ++++---- self-tests/setup-and-boot-seabios.robot | 16 +++++++-------- 14 files changed, 66 insertions(+), 74 deletions(-) diff --git a/dasharo-compatibility/cpu-cores-count.robot b/dasharo-compatibility/cpu-cores-count.robot index 1e508d618f..d92ccf0a14 100644 --- a/dasharo-compatibility/cpu-cores-count.robot +++ b/dasharo-compatibility/cpu-cores-count.robot @@ -55,7 +55,7 @@ CCC002.001 Check core count with HT enabled CCC003.001 Check core count (HT Enabled, P: All, E: 0) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option ActiveECores 0 @@ -72,7 +72,7 @@ CCC003.001 Check core count (HT Enabled, P: All, E: 0) (Ubuntu) CCC004.001 Check core count (HT Enabled, P: All, E: All) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option ActiveECores All active @@ -89,7 +89,7 @@ CCC004.001 Check core count (HT Enabled, P: All, E: All) (Ubuntu) CCC005.001 Check core count (HT Disabled, P: All, E: 0) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option HyperThreading ${FALSE} @@ -106,7 +106,7 @@ CCC005.001 Check core count (HT Disabled, P: All, E: 0) (Ubuntu) CCC006.001 Check core count (HT Disabled, P: All, E: 0) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option ActiveECores 0 @@ -123,7 +123,7 @@ CCC006.001 Check core count (HT Disabled, P: All, E: 0) (Ubuntu) CCC007.001 Check core count (HT Enabled, P: 1, E: A) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option ActivePCores 1 @@ -140,7 +140,7 @@ CCC007.001 Check core count (HT Enabled, P: 1, E: A) (Ubuntu) CCC008.001 Check core count (HT Disabled, P: 1, E: A) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option HyperThreading ${FALSE} @@ -157,7 +157,7 @@ CCC008.001 Check core count (HT Disabled, P: 1, E: A) (Ubuntu) CCC009.001 Check core count (HT Enabled, P: 1, E: 1) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option HyperThreading ${TRUE} @@ -176,7 +176,7 @@ CCC009.001 Check core count (HT Enabled, P: 1, E: 1) (Ubuntu) CCC010.001 Check core count (HT Disabled, P: 1, E: 1) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option HyperThreading ${FALSE} @@ -194,7 +194,7 @@ CCC010.001 Check core count (HT Disabled, P: 1, E: 1) (Ubuntu) CCC011.001 Check core count (HT Enabled, P: A, E: 1) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option HyperThreading ${TRUE} @@ -212,7 +212,7 @@ CCC011.001 Check core count (HT Enabled, P: A, E: 1) (Ubuntu) CCC012.001 Check core count (HT Disabled, P: A, E: 1) (Ubuntu) Depends On ${INTEL_HYBRID_ARCH_SUPPORT} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset Set UEFI Option HyperThreading ${FALSE} diff --git a/dasharo-compatibility/custom-boot-menu-key.robot b/dasharo-compatibility/custom-boot-menu-key.robot index 3c7718a1ac..9c29a72557 100644 --- a/dasharo-compatibility/custom-boot-menu-key.robot +++ b/dasharo-compatibility/custom-boot-menu-key.robot @@ -39,5 +39,5 @@ CBK002.001 Custom setup menu key Skip If not ${CUSTOM_SETUP_MENU_KEY_SUPPORT} CBK002.001 not supported Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} CBK002.001 not supported Power On - Enter Setup Menu Tianocore + Enter Setup Menu Read From Terminal Until ${SETUP_MENU_STRING} diff --git a/dasharo-compatibility/dasharo-tools-suite.robot b/dasharo-compatibility/dasharo-tools-suite.robot index 1a009d73e5..c8177adb1e 100644 --- a/dasharo-compatibility/dasharo-tools-suite.robot +++ b/dasharo-compatibility/dasharo-tools-suite.robot @@ -61,7 +61,7 @@ DTS003.001 DTS option reboot DUT works correctly Write Into Terminal R # Switch back to serial on PiKVM devices Restore Initial DUT Connection Method - Enter Setup Menu Tianocore + Enter Setup Menu DTS004.001 DTS accessing shell works correctly [Documentation] This test aims to verify that shell can be accessed in @@ -128,5 +128,5 @@ DTS008.001 DTS option power-off DUT works correctly Boot Dasharo Tools Suite iPXE Write Into Terminal P Set DUT Response Timeout 30s - ${status}= Run Keyword And Return Status Enter Setup Menu Tianocore + ${status}= Run Keyword And Return Status Enter Setup Menu Should Not Be True ${status} diff --git a/dasharo-compatibility/memory-profile.robot b/dasharo-compatibility/memory-profile.robot index f3550931de..c9fa732c08 100644 --- a/dasharo-compatibility/memory-profile.robot +++ b/dasharo-compatibility/memory-profile.robot @@ -40,7 +40,7 @@ MPS001.001 Switching to XMP profile Telnet.Set Timeout 5 min # Boot and remember current memory speed Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${old_speed}= Get Lines Matching Regexp ${out} .*RAM @ \\d+ MHz.* Should Not Be Empty ${old_speed} @@ -54,7 +54,7 @@ MPS001.001 Switching to XMP profile Set Option State ${memory_menu} Memory SPD Profile XMP#1 (predefined Save Changes And Reset # Verify that frequency has changed - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${new_speed}= Get Lines Matching Regexp ${out} .*RAM @ \\d+ MHz.* Should Not Be Empty ${new_speed} @@ -66,7 +66,7 @@ MPS002.001 Switching back to JEDEC profile Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} MPS002.001 not supported # Boot and remember current memory speed Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${old_speed}= Get Lines Matching Regexp ${out} .*RAM @ \\d+ MHz.* Should Not Be Empty ${old_speed} @@ -80,7 +80,7 @@ MPS002.001 Switching back to JEDEC profile Set Option State ${memory_menu} Memory SPD Profile JEDEC (safe Save Changes And Reset # Verify that frequency has changed - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${new_speed}= Get Lines Matching Regexp ${out} .*RAM @ \\d+ MHz.* Should Not Be Empty ${new_speed} diff --git a/dasharo-compatibility/power-after-fail.robot b/dasharo-compatibility/power-after-fail.robot index 9515183a9a..e71fc9e7bc 100644 --- a/dasharo-compatibility/power-after-fail.robot +++ b/dasharo-compatibility/power-after-fail.robot @@ -48,7 +48,7 @@ PSF002.001 Powered Off State Restoration Test ${pwr_menu}= Enter Dasharo Submenu ${dasharo_menu} Power Management Options Set Option State ${pwr_menu} Power state after Powered Off Save Changes And Reset - Enter Setup Menu Tianocore + Enter Setup Menu Simulate Power Failure ${output}= Run Keyword And Return Status ... Enter Setup Menu Tianocore And Return Construction @@ -64,9 +64,9 @@ PSF003.001 Powered On State Restoration Test ${pwr_menu}= Enter Dasharo Submenu ${dasharo_menu} Power Management Options Set Option State ${pwr_menu} Power state after Powered On Save Changes And Reset - Enter Setup Menu Tianocore + Enter Setup Menu Simulate Power Failure - Enter Setup Menu Tianocore + Enter Setup Menu PSF004.001 Previous Power State Restoration Test - Powered Off [Documentation] This test ensures that the feature is able to correctly @@ -79,12 +79,12 @@ PSF004.001 Previous Power State Restoration Test - Powered Off ${pwr_menu}= Enter Dasharo Submenu ${dasharo_menu} Power Management Options Set Option State ${pwr_menu} Power state after The state at the moment of power failure Save Changes And Reset - Enter Setup Menu Tianocore + Enter Setup Menu # Power button press to power off the machine Rte Power On Simulate Power Failure ${output}= Run Keyword And Return Status - ... Enter Setup Menu Tianocore + ... Enter Setup Menu Should Not Be True ${output} PSF004.002 Previous Power State Restoration Test - Powered On @@ -98,6 +98,6 @@ PSF004.002 Previous Power State Restoration Test - Powered On ${pwr_menu}= Enter Dasharo Submenu ${dasharo_menu} Power Management Options Set Option State ${pwr_menu} Power state after The state at the moment of power failure Save Changes And Reset - Enter Setup Menu Tianocore + Enter Setup Menu Simulate Power Failure - Enter Setup Menu Tianocore + Enter Setup Menu diff --git a/dasharo-compatibility/setup-menu-information.robot b/dasharo-compatibility/setup-menu-information.robot index 488ae63e33..bd23138e24 100644 --- a/dasharo-compatibility/setup-menu-information.robot +++ b/dasharo-compatibility/setup-menu-information.robot @@ -32,7 +32,7 @@ SET001.001 CPU clock speed displayed in setup menu ... correctly indicated in setup menu. Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${cpu_line}= Get Lines Matching Regexp ${out} .*GHz Should Not Be Empty ${cpu_line} CPU clock speed not found @@ -45,7 +45,7 @@ SET002.001 RAM speed displayed in setup menu ... indicated in setup menu. Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${ram_line}= Get Lines Matching Regexp ${out} .*RAM @ \\d+ MHz.* Should Not Be Empty ${ram_line} RAM speed not found @@ -58,7 +58,7 @@ SET003.001 RAM size displayed in setup menu ... indicated in setup menu. Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${ram_line}= Get Lines Matching Regexp ${out} .*MB RAM.* Should Not Be Empty ${ram_line} RAM size not found @@ -72,7 +72,7 @@ SET004.001 Expected CPU clock speed displayed in setup menu Depends On Variable \${PLATFORM_CPU_SPEED} Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${cpu_line}= Get Lines Matching Regexp ${out} .*GHz Should Not Be Empty ${cpu_line} CPU clock speed not found @@ -86,7 +86,7 @@ SET005.001 Expected RAM speed displayed in setup menu Depends On Variable \${PLATFORM_RAM_SPEED} Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${ram_line}= Get Lines Matching Regexp ${out} .*RAM @ \\d+ MHz.* Should Not Be Empty ${ram_line} RAM speed not found @@ -100,7 +100,7 @@ SET006.001 Expected RAM size displayed in setup menu Depends On Variable \${PLATFORM_RAM_SIZE} Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until =Select Entry ${ram_line}= Get Lines Matching Regexp ${out} .*MB RAM.* Should Not Be Empty ${ram_line} RAM size not found diff --git a/dasharo-security/uefi-password.robot b/dasharo-security/uefi-password.robot index fd1b19ac04..6af2831d40 100644 --- a/dasharo-security/uefi-password.robot +++ b/dasharo-security/uefi-password.robot @@ -59,7 +59,7 @@ PSW002.001 Password setting mechanism correctness checking Power On Set Password 5 Times Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${output}= Read From Terminal Until password Should Contain ${output} Please input admin password @@ -69,7 +69,7 @@ PSW003.001 Attempt to log in with a correct password Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PSW003.001 not supported Skip If not ${TESTS_IN_UBUNTU_SUPPORT} PSW003.001 not supported Power On - Enter Setup Menu Tianocore + Enter Setup Menu Read From Terminal Until password Type In The Password ${DEFAULT_PASSWORD} # "ontinue" is a string that appears both in correct password screen @@ -84,7 +84,7 @@ PSW004.001 Attempt to log in with an incorrect password Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PSW004.001 not supported Skip If not ${TESTS_IN_UBUNTU_SUPPORT} PSW004.001 not supported Power On - Enter Setup Menu Tianocore + Enter Setup Menu Read From Terminal Until password Type In The Password ${WRONG_PASSWORD} # "ontinue" is a string that appears both in correct password screen @@ -99,7 +99,7 @@ PSW005.001 Attempt to log in with an incorrect password 3 times Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PSW005.001 not supported Skip If not ${TESTS_IN_UBUNTU_SUPPORT} PSW005.001 not supported Power On - Enter Setup Menu Tianocore + Enter Setup Menu Read From Terminal Until password FOR ${counter} IN RANGE 0 2 Type In The Password ${WRONG_PASSWORD} @@ -118,7 +118,7 @@ PSW006.001 Attempt to turn off setup password functionality Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} PSW006.001 not supported Skip If not ${TESTS_IN_UBUNTU_SUPPORT} PSW006.001 not supported Power On - Enter Setup Menu Tianocore + Enter Setup Menu Read From Terminal Until password Type In The Password ${DEFAULT_PASSWORD} ${setup_menu}= Get Setup Menu Construction @@ -137,7 +137,7 @@ PSW006.001 Attempt to turn off setup password functionality Should Contain ${result} New password is updated successfully Press Key N Times 1 ${ENTER} Power On - Enter Setup Menu Tianocore + Enter Setup Menu Sleep 1s ${output}= Read From Terminal Should Not Contain ${output} Please input admin password diff --git a/lib/bios/common.robot b/lib/bios/common.robot index 4689303da1..5b1188a557 100644 --- a/lib/bios/common.robot +++ b/lib/bios/common.robot @@ -27,6 +27,19 @@ Enter Boot Menu And Return Construction ${menu}= Get Boot Menu Construction RETURN ${menu} +Enter Setup Menu + [Documentation] Enter Setup Menu with key specified in platform-configs. + Read From Terminal Until ${FW_STRING} + IF '${DUT_CONNECTION_METHOD}' == 'pikvm' + Single Key PiKVM ${SETUP_MENU_KEY} + ELSE + Write Bare Into Terminal ${SETUP_MENU_KEY} + IF '${BIOS_LIB}' == 'seabios' + ${menu}= Get Boot Menu Construction + Enter Menu From Snapshot ${menu} \[setup\] + END + END + Parse Menu Snapshot Into Construction [Documentation] Breaks grabbed menu data into lines. [Arguments] ${menu} ${lines_top} ${lines_bot} diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index 3ee873b691..896fc74b97 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -52,15 +52,6 @@ Get Boot Menu Construction END RETURN ${construction} -Enter Setup Menu Tianocore - [Documentation] Enter Setup Menu with key specified in platform-configs. - Read From Terminal Until ${FW_STRING} - IF '${DUT_CONNECTION_METHOD}' == 'pikvm' - Single Key PiKVM ${SETUP_MENU_KEY} - ELSE - Write Bare Into Terminal ${SETUP_MENU_KEY} - END - Get Setup Menu Construction [Documentation] Keyword allows to get and return setup menu construction. [Arguments] ${checkpoint}=Select Entry @@ -84,7 +75,7 @@ Get Menu Construction Enter Setup Menu Tianocore And Return Construction [Documentation] Enters Setup Menu and returns Setup Menu construction - Enter Setup Menu Tianocore + Enter Setup Menu ${menu}= Get Setup Menu Construction RETURN ${menu} @@ -578,7 +569,7 @@ Make Sure That Network Boot Is Enabled Get Firmware Version From Tianocore Setup Menu [Documentation] Keyword allows to read firmware version from Tianocore ... Setup menu header. - Enter Setup Menu Tianocore + Enter Setup Menu ${output}= Read From Terminal Until Select Entry ${firmware_line}= Get Lines Containing String ${output} Dasharo (coreboot+UEFI) ${firmware_version}= Get Regexp Matches ${firmware_line} v\\d{1,}\.\\d{1,}\.\\d{1,} diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 09fb32770c..ee63adb746 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -26,12 +26,6 @@ Get Boot Menu Construction ${construction}= Parse Menu Snapshot Into Construction ${menu} 1 0 RETURN ${construction} -Enter Sortbootorder - [Documentation] Enter sortbootorder with Boot Menu Construction. - Enter Boot Menu - ${menu}= Get Boot Menu Construction - Enter Menu From Snapshot ${menu} \[setup\] - Get Sortbootorder Menu Construction [Documentation] Keyword allows to get and return sortbootorder menu construction. [Arguments] ${checkpoint}=Save configuration and exit @@ -40,12 +34,6 @@ Get Sortbootorder Menu Construction ${menu}= Parse Menu Snapshot Into Construction ${out} 7 0 RETURN ${menu} -Enter Setup Menu SeaBIOS And Return Construction - [Documentation] Enters Setup Menu and returns Setup Menu construction - Enter Setup Menu SeaBIOS - ${menu}= Get Setup Menu Construction - RETURN ${menu} - Get Option State [Documentation] Gets menu construction and option name as arguments. ... Returns option state, which can be: True or False. @@ -185,7 +173,7 @@ Save Sortbootorder Changes Enable Network/PXE Boot [Documentation] Enable Network/PXE Boot and save. - Enter Sortbootorder + Enter Setup Menu ${menu}= Get Sortbootorder Menu Construction ${menu}= Set Option State And Return Construction ${menu} Network/PXE boot Enabled List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled diff --git a/lib/options/uefi-setup-menu.robot b/lib/options/uefi-setup-menu.robot index 27c5cd2049..19f18ef11f 100644 --- a/lib/options/uefi-setup-menu.robot +++ b/lib/options/uefi-setup-menu.robot @@ -65,7 +65,7 @@ Get UEFI Option Reset UEFI Options To Defaults [Documentation] Resets all UEFI options to defaults Power On - Enter Setup Menu Tianocore + Enter Setup Menu Reset To Defaults Tianocore Save Changes And Reset diff --git a/platform-configs/qemu-selftests-seabios.robot b/platform-configs/qemu-selftests-seabios.robot index 2574124b77..9947af93ea 100644 --- a/platform-configs/qemu-selftests-seabios.robot +++ b/platform-configs/qemu-selftests-seabios.robot @@ -15,7 +15,7 @@ ${RTE_S2_N_PORT}= 1234 ${FLASH_SIZE}= ${8*1024*1024} ${FW_STRING}= for boot menu ${BOOT_MENU_KEY}= ${F10} -${SETUP_MENU_KEY}= ${F2} +${SETUP_MENU_KEY}= ${F10} ${MANUFACTURER}= QEMU ${POWER_CTRL}= RteCtrl ${FLASHING_METHOD}= none diff --git a/self-tests/setup-and-boot-menus.robot b/self-tests/setup-and-boot-menus.robot index ce92c2aa75..e2f2b557ec 100644 --- a/self-tests/setup-and-boot-menus.robot +++ b/self-tests/setup-and-boot-menus.robot @@ -43,10 +43,10 @@ Enter Boot Menu And Return Construction List Should Contain Value ${menu} Setup Menu Construction Should Not Contain Control Text ${menu} -Enter Setup Menu Tianocore - [Documentation] Test Enter Setup Menu Tianocore kwd +Enter Setup Menu + [Documentation] Test Enter Setup Menu kwd Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${out}= Read From Terminal Until Select Entry Should Contain ${out} Select Language @@ -212,7 +212,7 @@ Get Menu Construction Stress Test FOR ${i} IN RANGE 50 Log To Console Iteration: ${i} Power On - Enter Setup Menu Tianocore + Enter Setup Menu ${menu}= Get Setup Menu Construction Run Keyword And Continue On Failure Should Not Be Empty ${menu} diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot index b856e78101..d52bc13173 100644 --- a/self-tests/setup-and-boot-seabios.robot +++ b/self-tests/setup-and-boot-seabios.robot @@ -36,7 +36,7 @@ Enter Boot Menu Should Contain ${out} Select boot device: Enter Boot Menu And Return Construction - [Documentation] Test Enter Boot Menu kwd + [Documentation] Test Enter Boot Menu And Return Construction kwd Power On ${menu}= Enter Boot Menu And Return Construction List Should Not Contain Value ${menu} Select boot device: @@ -46,17 +46,17 @@ Enter Boot Menu And Return Construction List Should Contain Value ${menu} t. TPM Configuration Menu Construction Should Not Contain Control Text ${menu} -Enter sortbootorder - [Documentation] Test Enter sortbootorder kwd +Enter Setup Menu + [Documentation] Test Enter Setup Menu kwd Power On - Enter Sortbootorder + Enter Setup Menu ${out}= Read From Terminal Until Save configuration and exit Should Contain ${out} PC Engines QEMU x86 q35/ich9 setup Get sortbootorder Menu Construction [Documentation] Get sortbootorder Menu Construction kwd Power On - Enter Sortbootorder + Enter Setup Menu ${menu}= Get Sortbootorder Menu Construction List Should Not Contain Value ${menu} Boot order List Should Contain Value ${menu} r Restore boot order defaults @@ -83,7 +83,7 @@ Get sortbootorder Menu Construction Get Option State [Documentation] Test Get Option State kwd Power On - Enter Sortbootorder + Enter Setup Menu ${menu}= Get Sortbootorder Menu Construction ${state}= Get Option State ${menu} Network/PXE boot Should Contain ${state} Disabled @@ -91,7 +91,7 @@ Get Option State Enter Menu From Snapshot and Return sortbootorder Construction [Documentation] Test Enter Menu From Snapshot and Return sortbootorder Construction kwd Power On - Enter Sortbootorder + Enter Setup Menu ${menu}= Get Sortbootorder Menu Construction ${menu}= Enter Menu From Snapshot And Return Sortbootorder Construction ${menu} Network/PXE boot List Should Not Contain Value ${menu} Boot order @@ -127,7 +127,7 @@ Enable Network Boot [Documentation] Test Enable Network/PXE boot Power On Enable Network/PXE Boot - Enter Sortbootorder + Enter Setup Menu ${menu}= Get Sortbootorder Menu Construction List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled From fcdf8fa73e32f9635082d8617dd78830ddad173b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Mon, 2 Dec 2024 14:11:29 +0100 Subject: [PATCH 26/33] lib/bios: user Get Menu Construction instead of SeaBIOS dedicated wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/common.robot | 8 ++++++++ lib/bios/seabios.robot | 12 ++---------- self-tests/setup-and-boot-seabios.robot | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/bios/common.robot b/lib/bios/common.robot index 5b1188a557..79343bd94d 100644 --- a/lib/bios/common.robot +++ b/lib/bios/common.robot @@ -86,3 +86,11 @@ Parse Menu Snapshot Into Construction ... Select boot device: ... , N for PXE boot RETURN ${construction} + +Get Menu Construction + [Documentation] Keyword allows to get and return setup menu construction. + [Arguments] ${checkpoint}=ESC=exit ${lines_top}=1 ${lines_bot}=0 + Sleep 1s + ${out}= Read From Terminal Until ${checkpoint} + ${menu}= Parse Menu Snapshot Into Construction ${out} ${lines_top} ${lines_bot} + RETURN ${menu} diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index ee63adb746..f5fa574bf9 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -26,14 +26,6 @@ Get Boot Menu Construction ${construction}= Parse Menu Snapshot Into Construction ${menu} 1 0 RETURN ${construction} -Get Sortbootorder Menu Construction - [Documentation] Keyword allows to get and return sortbootorder menu construction. - [Arguments] ${checkpoint}=Save configuration and exit - # Lines to strip: - ${out}= Read From Terminal Until ${checkpoint} - ${menu}= Parse Menu Snapshot Into Construction ${out} 7 0 - RETURN ${menu} - Get Option State [Documentation] Gets menu construction and option name as arguments. ... Returns option state, which can be: True or False. @@ -136,7 +128,7 @@ Enter Menu From Snapshot And Return Sortbootorder Construction [Arguments] ${menu} ${option} ${key}= Extract Sortbootorder Menu Key ${menu} ${option} Write Bare Into Terminal ${key} - ${menu}= Get Sortbootorder Menu Construction + ${menu}= Get Menu Construction Save configuration and exit 7 0 RETURN ${menu} Extract Menu Key @@ -174,7 +166,7 @@ Save Sortbootorder Changes Enable Network/PXE Boot [Documentation] Enable Network/PXE Boot and save. Enter Setup Menu - ${menu}= Get Sortbootorder Menu Construction + ${menu}= Get Menu Construction Save configuration and exit 7 0 ${menu}= Set Option State And Return Construction ${menu} Network/PXE boot Enabled List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled Save Sortbootorder Changes diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot index d52bc13173..6e6c303bdd 100644 --- a/self-tests/setup-and-boot-seabios.robot +++ b/self-tests/setup-and-boot-seabios.robot @@ -53,11 +53,11 @@ Enter Setup Menu ${out}= Read From Terminal Until Save configuration and exit Should Contain ${out} PC Engines QEMU x86 q35/ich9 setup -Get sortbootorder Menu Construction - [Documentation] Get sortbootorder Menu Construction kwd +Get Menu Construction + [Documentation] Get Menu Construction kwd Power On Enter Setup Menu - ${menu}= Get Sortbootorder Menu Construction + ${menu}= Get Menu Construction Save configuration and exit 7 0 List Should Not Contain Value ${menu} Boot order List Should Contain Value ${menu} r Restore boot order defaults List Should Contain Value ${menu} n Network/PXE boot - Currently Disabled @@ -84,7 +84,7 @@ Get Option State [Documentation] Test Get Option State kwd Power On Enter Setup Menu - ${menu}= Get Sortbootorder Menu Construction + ${menu}= Get Menu Construction Save configuration and exit 7 0 ${state}= Get Option State ${menu} Network/PXE boot Should Contain ${state} Disabled @@ -92,7 +92,7 @@ Enter Menu From Snapshot and Return sortbootorder Construction [Documentation] Test Enter Menu From Snapshot and Return sortbootorder Construction kwd Power On Enter Setup Menu - ${menu}= Get Sortbootorder Menu Construction + ${menu}= Get Menu Construction Save configuration and exit 7 0 ${menu}= Enter Menu From Snapshot And Return Sortbootorder Construction ${menu} Network/PXE boot List Should Not Contain Value ${menu} Boot order List Should Contain Value ${menu} r Restore boot order defaults @@ -128,7 +128,7 @@ Enable Network Boot Power On Enable Network/PXE Boot Enter Setup Menu - ${menu}= Get Sortbootorder Menu Construction + ${menu}= Get Menu Construction Save configuration and exit 7 0 List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled Enter iPXE From 57289d9c6e7148bd47c2d75c5db70e36addd2ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Mon, 2 Dec 2024 14:18:21 +0100 Subject: [PATCH 27/33] lib/bios/seabios.robot: remove unused keywords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/seabios.robot | 52 ------------------------------------------ 1 file changed, 52 deletions(-) diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index f5fa574bf9..2cd7f93422 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -65,58 +65,6 @@ Get Index Of Matching Option In Menu END RETURN ${index} -Get Hidden Security Register Submenu Construction - [Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" - # In most cases, we need to strip two lines: - # TOP: - # Title line, such as: Dasharo System Features - # BOTTOM: - # Help line, such as: F9=Reset to Defaults Esc=Exit - ${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} - # Handling of additional exceptions appearing in submenus: - # 1. Drop unselectable strings from Device Manager - Remove Values From List ${submenu} Devices List - - IF ${opt_only} == ${TRUE} - # Handling exceptions caused by some options splitting into multiple lines. - # For Dasharo System Features options, we can assume that each entry has - # either ">", or "[ ]", or "< >". For other edk2 menus, this is not always - # the case (yet?). - FOR ${entry} IN @{submenu} - ${status}= Check If Menu Line Is An Option ${entry} - IF ${status} != ${TRUE} - Remove Values From List ${submenu} ${entry} - END - END - END - RETURN ${submenu} - -Get Hidden Flash Lockdown Submenu Construction - [Arguments] ${checkpoint}=Esc=Exit ${lines_top}=1 ${lines_bot}=1 ${opt_only}="${FALSE}" - # In most cases, we need to strip two lines: - # TOP: - # Title line, such as: Dasharo System Features - # BOTTOM: - # Help line, such as: F9=Reset to Defaults Esc=Exit - ${submenu}= Get Menu Construction ${checkpoint} ${lines_top} ${lines_bot} - # Handling of additional exceptions appearing in submenus: - # 1. Drop unselectable strings from Device Manager - Remove Values From List ${submenu} Devices List - - IF ${opt_only} == ${TRUE} - # Handling exceptions caused by some options splitting into multiple lines. - # For Dasharo System Features options, we can assume that each entry has - # either ">", or "[ ]", or "< >". For other edk2 menus, this is not always - # the case (yet?). - FOR ${entry} IN @{submenu} - ${status}= Check If Menu Line Is An Option ${entry} - IF ${status} != ${TRUE} - Remove Values From List ${submenu} ${entry} - END - END - END - RETURN ${submenu} - Enter Menu From Snapshot [Documentation] Enter given Menu option [Arguments] ${menu} ${option} From 880043d93d6f35c3da6042f4b200f90cf0288417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Mon, 2 Dec 2024 14:50:27 +0100 Subject: [PATCH 28/33] lib/bios/edk2.robot: remove Get Menu Consutruction use common implmentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/edk2.robot | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index 896fc74b97..d3a41ba1b6 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -65,13 +65,6 @@ Get Setup Menu Construction ${menu}= Get Menu Construction ${checkpoint} 3 1 RETURN ${menu} -Get Menu Construction - [Documentation] Keyword allows to get and return setup menu construction. - [Arguments] ${checkpoint}=ESC=exit ${lines_top}=1 ${lines_bot}=0 - Sleep 1s - ${out}= Read From Terminal Until ${checkpoint} - ${menu}= Parse Menu Snapshot Into Construction ${out} ${lines_top} ${lines_bot} - RETURN ${menu} Enter Setup Menu Tianocore And Return Construction [Documentation] Enters Setup Menu and returns Setup Menu construction From d8b71907646288976123b46ed30c4c23dfb775e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Mon, 2 Dec 2024 14:51:02 +0100 Subject: [PATCH 29/33] lib/bios/seabios.robot: align API with edk2 lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/seabios.robot | 42 ++++++++++++------------- self-tests/setup-and-boot-seabios.robot | 5 +-- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 2cd7f93422..7372d97e9d 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -35,17 +35,18 @@ Get Option State RETURN ${value}[0] -Set Option State And Return Construction - [Documentation] Sets option to desired state and return construction. - [Arguments] ${menu} ${option} ${desired_state} +Set Option State + [Documentation] Gets menu construction option name, and desired state + ... as arguments. Return TRUE if the option was changed and FALSE if + ... option was already in target state. + [Arguments] ${menu} ${option} ${target_state} ${current_state}= Get Option State ${menu} ${option} - - IF '${current_state}' == '${desired_state}' - RETURN ${menu} + IF '${current_state}' != '${target_state}' + ${menu}= Enter Menu From Snapshot ${menu} ${option} + RETURN ${TRUE} ELSE - ${menu}= Enter Menu From Snapshot And Return Sortbootorder Construction ${menu} ${option} + RETURN ${FALSE} END - RETURN ${menu} Get Index Of Matching Option In Menu [Documentation] This keyword returns the index of element that matches @@ -65,22 +66,20 @@ Get Index Of Matching Option In Menu END RETURN ${index} -Enter Menu From Snapshot +Enter Boot Menu From Snapshot [Documentation] Enter given Menu option [Arguments] ${menu} ${option} - ${key}= Extract Menu Key ${menu} ${option} + ${key}= Extract Boot Menu Key ${menu} ${option} Write Bare Into Terminal ${key} -Enter Menu From Snapshot And Return Sortbootorder Construction - [Documentation] Enter given sortbootorder Menu option and return construction +Enter Menu From Snapshot + [Documentation] Enter given Menu option and return construction [Arguments] ${menu} ${option} - ${key}= Extract Sortbootorder Menu Key ${menu} ${option} + ${key}= Extract Menu Key ${menu} ${option} Write Bare Into Terminal ${key} - ${menu}= Get Menu Construction Save configuration and exit 7 0 - RETURN ${menu} -Extract Menu Key - [Documentation] Extract key which should be hit to enter given Menu in SeaBIOS +Extract Boot Menu Key + [Documentation] Extract boot menu which should be hit to enter given Menu in SeaBIOS [Arguments] ${menu} ${option} FOR ${item} IN @{menu} ${matches}= Run Keyword And Return Status @@ -93,7 +92,7 @@ Extract Menu Key ${key}= Set Variable ${option.split('.')[0]} RETURN ${key} -Extract Sortbootorder Menu Key +Extract Menu Key [Documentation] Extract key which should be hit to toggle given sortbootorder Menu option [Arguments] ${menu} ${option} FOR ${item} IN @{menu} @@ -107,7 +106,7 @@ Extract Sortbootorder Menu Key ${key}= Set Variable ${option.split()[0]} RETURN ${key} -Save Sortbootorder Changes +Save Changes [Documentation] This keyword saves introduced changes Write Bare Into Terminal s @@ -115,9 +114,8 @@ Enable Network/PXE Boot [Documentation] Enable Network/PXE Boot and save. Enter Setup Menu ${menu}= Get Menu Construction Save configuration and exit 7 0 - ${menu}= Set Option State And Return Construction ${menu} Network/PXE boot Enabled - List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled - Save Sortbootorder Changes + Set Option State ${menu} Network/PXE boot Enabled + Save Changes Enter TPM Configuration [Documentation] Enter TPM Configuration with Boot Menu Construction. diff --git a/self-tests/setup-and-boot-seabios.robot b/self-tests/setup-and-boot-seabios.robot index 6e6c303bdd..e6fb4d653b 100644 --- a/self-tests/setup-and-boot-seabios.robot +++ b/self-tests/setup-and-boot-seabios.robot @@ -88,12 +88,13 @@ Get Option State ${state}= Get Option State ${menu} Network/PXE boot Should Contain ${state} Disabled -Enter Menu From Snapshot and Return sortbootorder Construction +Enter Menu From Snapshot [Documentation] Test Enter Menu From Snapshot and Return sortbootorder Construction kwd Power On Enter Setup Menu ${menu}= Get Menu Construction Save configuration and exit 7 0 - ${menu}= Enter Menu From Snapshot And Return Sortbootorder Construction ${menu} Network/PXE boot + Enter Menu From Snapshot ${menu} Network/PXE boot + ${menu}= Get Menu Construction Save configuration and exit 7 0 List Should Not Contain Value ${menu} Boot order List Should Contain Value ${menu} r Restore boot order defaults List Should Contain Value ${menu} n Network/PXE boot - Currently Enabled From c7f0aeb12c4defbb9331b2dd757765ece8eb282e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Mon, 2 Dec 2024 15:02:46 +0100 Subject: [PATCH 30/33] lib/bios: move Get Index Of Matching Option In Menu to common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- lib/bios/common.robot | 18 ++++++++++++++++++ lib/bios/edk2.robot | 19 ------------------- lib/bios/seabios.robot | 18 ------------------ 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/lib/bios/common.robot b/lib/bios/common.robot index 79343bd94d..bf47199a8f 100644 --- a/lib/bios/common.robot +++ b/lib/bios/common.robot @@ -94,3 +94,21 @@ Get Menu Construction ${out}= Read From Terminal Until ${checkpoint} ${menu}= Parse Menu Snapshot Into Construction ${out} ${lines_top} ${lines_bot} RETURN ${menu} + +Get Index Of Matching Option In Menu + [Documentation] This keyword returns the index of element that matches + ... one in given menu + [Arguments] ${menu_construction} ${option} ${ignore_not_found_error}=${FALSE} + FOR ${element} IN @{menu_construction} + ${matches}= Run Keyword And Return Status + ... Should Match ${element} *${option}* + IF ${matches} + ${option}= Set Variable ${element} + BREAK + END + END + ${index}= Get Index From List ${menu_construction} ${option} + IF ${ignore_not_found_error} == ${FALSE} + Should Be True ${index} >= 0 Option ${option} not found in the list + END + RETURN ${index} diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index d3a41ba1b6..4301d7adbc 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -65,7 +65,6 @@ Get Setup Menu Construction ${menu}= Get Menu Construction ${checkpoint} 3 1 RETURN ${menu} - Enter Setup Menu Tianocore And Return Construction [Documentation] Enters Setup Menu and returns Setup Menu construction Enter Setup Menu @@ -141,24 +140,6 @@ Enter Dasharo Submenu ... opt_only=${TRUE} RETURN ${submenu} -Get Index Of Matching Option In Menu - [Documentation] This keyword returns the index of element that matches - ... one in given menu - [Arguments] ${menu_construction} ${option} ${ignore_not_found_error}=${FALSE} - FOR ${element} IN @{menu_construction} - ${matches}= Run Keyword And Return Status - ... Should Match ${element} *${option}* - IF ${matches} - ${option}= Set Variable ${element} - BREAK - END - END - ${index}= Get Index From List ${menu_construction} ${option} - IF ${ignore_not_found_error} == ${FALSE} - Should Be True ${index} >= 0 Option ${option} not found in the list - END - RETURN ${index} - Press Key N Times And Enter [Documentation] Enter specified in the first argument times the specified ... in the second argument key and then press Enter. diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 7372d97e9d..735f1cc90d 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -48,24 +48,6 @@ Set Option State RETURN ${FALSE} END -Get Index Of Matching Option In Menu - [Documentation] This keyword returns the index of element that matches - ... one in given menu - [Arguments] ${menu_construction} ${option} ${ignore_not_found_error}=${FALSE} - FOR ${element} IN @{menu_construction} - ${matches}= Run Keyword And Return Status - ... Should Match ${element} *${option}* - IF ${matches} - ${option}= Set Variable ${element} - BREAK - END - END - ${index}= Get Index From List ${menu_construction} ${option} - IF ${ignore_not_found_error} == ${FALSE} - Should Be True ${index} >= 0 Option ${option} not found in the list - END - RETURN ${index} - Enter Boot Menu From Snapshot [Documentation] Enter given Menu option [Arguments] ${menu} ${option} From 728bf25239fd19bd6b720ec1b7963a0bce54816b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Lewi=C5=84ski?= Date: Fri, 6 Dec 2024 15:46:07 +0100 Subject: [PATCH 31/33] lib/bios: move Boot System Or From Connected Disk to common lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Lewiński --- lib/bios/common.robot | 52 +++++++++++++++++++++++++++++++++++++++++++ lib/bios/edk2.robot | 52 ------------------------------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/bios/common.robot b/lib/bios/common.robot index bf47199a8f..a0a8235768 100644 --- a/lib/bios/common.robot +++ b/lib/bios/common.robot @@ -112,3 +112,55 @@ Get Index Of Matching Option In Menu Should Be True ${index} >= 0 Option ${option} not found in the list END RETURN ${index} + +Boot System Or From Connected Disk # robocop: disable=too-long-keyword + [Documentation] Tries to boot ${system_name}. If it is not possible then it tries + ... to boot from connected disk set up in config + [Arguments] ${system_name} + IF '${DUT_CONNECTION_METHOD}' == 'SSH' RETURN + + IF '''${SEABIOS_BOOT_DEVICE}''' != '' + Read From Terminal Until for boot menu + Write Bare Into Terminal ${BOOT_MENU_KEY} + Read From Terminal Until Select boot device + Write Bare Into Terminal ${SEABIOS_BOOT_DEVICE} + RETURN + END + ${menu_construction}= Enter Boot Menu And Return Construction + # With ESP scanning feature boot entries are named differently: + IF ${ESP_SCANNING_SUPPORT} == ${TRUE} + IF "${system_name}" == "ubuntu" + ${system_name}= Set Variable Ubuntu + END + IF "${system_name}" == "trenchboot" and "${MANUFACTURER}" == "QEMU" + ${system_name}= Set Variable QEMU HARDDISK + END + END + ${is_system_present}= Evaluate "${system_name}" in """${menu_construction}""" + IF not ${is_system_present} + ${ssd_list}= Get Current CONFIG List Param Storage_SSD boot_name + ${ssd_list_length}= Get Length ${ssd_list} + IF ${ssd_list_length} == 0 + ${hdd_list}= Get Current CONFIG List Param HDD_Storage boot_name + ${hdd_list_length}= Get Length ${hdd_list} + IF ${hdd_list_length} == 0 + ${mmc_list}= Get Current CONFIG List Param MMC_Storage boot_name + ${mmc_list_length}= Get Length ${mmc_list} + IF ${mmc_list_length} == 0 + FAIL "System was not found and there are no disk connected" + END + ${disk_name}= Set Variable ${mmc_list[0]} + ELSE + ${disk_name}= Set Variable ${hdd_list[0]} + END + ELSE + ${disk_name}= Set Variable ${ssd_list[0]} + END + ${system_index}= Get Index From List ${menu_construction} ${disk_name} + IF ${system_index} == -1 + Fail Disk: ${disk_name} not found in Boot Menu + END + ELSE + ${system_index}= Get Index Of Matching Option In Menu ${menu_construction} ${system_name} + END + Press Key N Times And Enter ${system_index} ${ARROW_DOWN} diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index 4301d7adbc..39c2b664d7 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -481,58 +481,6 @@ Save Changes And Reset Save Changes Tianocore Reset System -Boot System Or From Connected Disk # robocop: disable=too-long-keyword - [Documentation] Tries to boot ${system_name}. If it is not possible then it tries - ... to boot from connected disk set up in config - [Arguments] ${system_name} - IF '${DUT_CONNECTION_METHOD}' == 'SSH' RETURN - - IF '''${SEABIOS_BOOT_DEVICE}''' != '' - Read From Terminal Until Press F10 key now for boot menu - Write Bare Into Terminal ${F10} - Read From Terminal Until Select boot device - Write Bare Into Terminal ${SEABIOS_BOOT_DEVICE} - RETURN - END - ${menu_construction}= Enter Boot Menu And Return Construction - # With ESP scanning feature boot entries are named differently: - IF ${ESP_SCANNING_SUPPORT} == ${TRUE} - IF "${system_name}" == "ubuntu" - ${system_name}= Set Variable Ubuntu - END - IF "${system_name}" == "trenchboot" and "${MANUFACTURER}" == "QEMU" - ${system_name}= Set Variable QEMU HARDDISK - END - END - ${is_system_present}= Evaluate "${system_name}" in """${menu_construction}""" - IF not ${is_system_present} - ${ssd_list}= Get Current CONFIG List Param Storage_SSD boot_name - ${ssd_list_length}= Get Length ${ssd_list} - IF ${ssd_list_length} == 0 - ${hdd_list}= Get Current CONFIG List Param HDD_Storage boot_name - ${hdd_list_length}= Get Length ${hdd_list} - IF ${hdd_list_length} == 0 - ${mmc_list}= Get Current CONFIG List Param MMC_Storage boot_name - ${mmc_list_length}= Get Length ${mmc_list} - IF ${mmc_list_length} == 0 - FAIL "System was not found and there are no disk connected" - END - ${disk_name}= Set Variable ${mmc_list[0]} - ELSE - ${disk_name}= Set Variable ${hdd_list[0]} - END - ELSE - ${disk_name}= Set Variable ${ssd_list[0]} - END - ${system_index}= Get Index From List ${menu_construction} ${disk_name} - IF ${system_index} == -1 - Fail Disk: ${disk_name} not found in Boot Menu - END - ELSE - ${system_index}= Get Index Of Matching Option In Menu ${menu_construction} ${system_name} - END - Press Key N Times And Enter ${system_index} ${ARROW_DOWN} - Make Sure That Network Boot Is Enabled [Documentation] This keywords checks that "Enable network boot" in ... "Networking Options" is enabled when present, so the network From b193b254f7534595b48a55818ab378eb94f103ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Lewi=C5=84ski?= Date: Fri, 6 Dec 2024 15:47:47 +0100 Subject: [PATCH 32/33] platform-configs/optiplex-7010-seabios.robot: add MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Lewiński --- platform-configs/optiplex-7010-seabios.robot | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 platform-configs/optiplex-7010-seabios.robot diff --git a/platform-configs/optiplex-7010-seabios.robot b/platform-configs/optiplex-7010-seabios.robot new file mode 100644 index 0000000000..2d5b809347 --- /dev/null +++ b/platform-configs/optiplex-7010-seabios.robot @@ -0,0 +1,12 @@ +*** Settings *** +Resource optiplex-7010.robot + + +*** Variables *** +${BIOS_LIB}= seabios +${FW_STRING}= ESC +${SEABIOS_BOOT_DEVICE}= 2 +${BOOT_MENU_KEY}= ${ESC} +${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+SeaBIOS) v0.1.0 +${DMIDECODE_RELEASE_DATE}= 11/27/2024 +${TESTS_IN_FIRMWARE_SUPPORT}= {FALSE} From 76ccdd9bb82b6eb099053e4ca608fe24d38b90f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Lewi=C5=84ski?= Date: Fri, 6 Dec 2024 17:01:42 +0100 Subject: [PATCH 33/33] lib/bios: make Boot System Or From Connected Disk more generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Lewiński --- lib/bios/common.robot | 7 +++++-- lib/bios/edk2.robot | 5 +++++ lib/bios/seabios.robot | 12 ++++++++++++ platform-configs/optiplex-7010-seabios.robot | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/bios/common.robot b/lib/bios/common.robot index a0a8235768..48adcdf48e 100644 --- a/lib/bios/common.robot +++ b/lib/bios/common.robot @@ -156,11 +156,14 @@ Boot System Or From Connected Disk # robocop: disable=too-long-keyword ELSE ${disk_name}= Set Variable ${ssd_list[0]} END - ${system_index}= Get Index From List ${menu_construction} ${disk_name} + # Search the menu for disk name occurrence + ${system_index}= Set Variable -1 + ${system_index}= Evaluate + ... next((i for i, entry in enumerate(${menu_construction}) if "${disk_name}" in entry), -1) IF ${system_index} == -1 Fail Disk: ${disk_name} not found in Boot Menu END ELSE ${system_index}= Get Index Of Matching Option In Menu ${menu_construction} ${system_name} END - Press Key N Times And Enter ${system_index} ${ARROW_DOWN} + Select Boot Menu Option ${system_index} ${ARROW_DOWN} diff --git a/lib/bios/edk2.robot b/lib/bios/edk2.robot index 39c2b664d7..158906943e 100644 --- a/lib/bios/edk2.robot +++ b/lib/bios/edk2.robot @@ -496,3 +496,8 @@ Get Firmware Version From Tianocore Setup Menu ${firmware_line}= Get Lines Containing String ${output} Dasharo (coreboot+UEFI) ${firmware_version}= Get Regexp Matches ${firmware_line} v\\d{1,}\.\\d{1,}\.\\d{1,} RETURN ${firmware_version} + +Select Boot Menu Option + [Documentation] Select the boot menu option using the given index. + [Arguments] ${index} ${key} + Press Key N Times ${index} ${key} diff --git a/lib/bios/seabios.robot b/lib/bios/seabios.robot index 735f1cc90d..9bb864eedf 100644 --- a/lib/bios/seabios.robot +++ b/lib/bios/seabios.robot @@ -111,3 +111,15 @@ Enter IPXE Enter Boot Menu ${menu}= Get Boot Menu Construction Enter Menu From Snapshot ${menu} iPXE + +# robocop: disable=unused-argument + +Select Boot Menu Option + [Documentation] Select the boot menu option using the given index. + ... Accounts for indices counting from zero, and SeaBIOS options counting + ... from '1.'. Has to take a dummy parameter for compatibility with the + ... EDK2 version of this keyword. + [Arguments] ${index} ${dummy} + ${option}= Evaluate ${index} + 1 + Write Bare Into Terminal '${option}' +# robocop: disable=unused-argument diff --git a/platform-configs/optiplex-7010-seabios.robot b/platform-configs/optiplex-7010-seabios.robot index 2d5b809347..d99c35c419 100644 --- a/platform-configs/optiplex-7010-seabios.robot +++ b/platform-configs/optiplex-7010-seabios.robot @@ -5,7 +5,7 @@ Resource optiplex-7010.robot *** Variables *** ${BIOS_LIB}= seabios ${FW_STRING}= ESC -${SEABIOS_BOOT_DEVICE}= 2 +# ${SEABIOS_BOOT_DEVICE}= 2 ${BOOT_MENU_KEY}= ${ESC} ${DMIDECODE_FIRMWARE_VERSION}= Dasharo (coreboot+SeaBIOS) v0.1.0 ${DMIDECODE_RELEASE_DATE}= 11/27/2024