Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dts-compatibility: dasharo-tools-suite: add Dasharo update via USB & iPXE #590

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
61 changes: 61 additions & 0 deletions dasharo-compatibility/dasharo-tools-suite.robot
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Test Setup Run Keyword If ${TESTS_IN_FIRMWARE_SUPPORT}


*** Test Cases ***
# After https://github.com/Dasharo/dts-scripts/pull/42 is released
# 'Write Into Terminal' might have to be changed to 'Write Bare Into Terminal'
DTS001.001 Booting DTS from USB works correctly
[Documentation] This test aims to verify that DTS is properly booting
... from USB.
Expand Down Expand Up @@ -130,3 +132,62 @@ DTS008.001 DTS option power-off DUT works correctly
Set DUT Response Timeout 30s
${status}= Run Keyword And Return Status Enter Setup Menu Tianocore
Should Not Be True ${status}

DTS009.001 Update Dasharo firmware by using DTS via USB works correctly
[Documentation] This test aims to verify that updating Dasharo by using
... DTS built-in script works correctly when booting DTS via USB.
... Test expects FW_FILE variable to contain path to Dasharo firmware
... and DPP_LOGS_KEY, DPP_DOWNLOAD_KEY and DPP_PASSWORD to contain DPP
... subscription credentials.
Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} DTS009.001 not supported
${variables_defined}= Are FW FILE And DPP Keys Defined
Skip If not ${variables_defined}
... Test can't run without setting FW_FILE, DPP_LOGS_KEY, DPP_DOWNLOAD_KEY and DPP_PASSWORD
# Flash earlier version so update can proceed. Firmware should have serial
# redirection enabled
Flash Firmware ${FW_FILE}
Make Sure That Flash Locks Are Disabled
Power On
Boot Dasharo Tools Suite USB
# To refresh screen as next keyword expects DTS checkpoint
Press Key N Times 1 ${ESC}
Provide DPP Credentials
Go Through Update
Wait For Checkpoint Rebooting

DTS009.002 Update Dasharo firmware by using DTS via iPXE works correctly
[Documentation] This test aims to verify that updating Dasharo by using
... DTS built-in script works correctly when booting DTS via iPXE.
... Test expects FW_FILE variable to contain path to Dasharo firmware
... and DPP_LOGS_KEY, DPP_DOWNLOAD_KEY and DPP_PASSWORD to contain DPP
... subscription credentials.
Skip If not ${TESTS_IN_FIRMWARE_SUPPORT} DTS009.001 not supported
${variables_defined}= Are FW FILE And DPP Keys Defined
Skip If not ${variables_defined}
... Test can't run without setting FW_FILE, DPP_LOGS_KEY, DPP_DOWNLOAD_KEY and DPP_PASSWORD
# Flash earlier version so update can proceed. Firmware should have serial
# redirection enabled
Flash Firmware ${FW_FILE}
Make Sure That Flash Locks Are Disabled
Power On
Boot Dasharo Tools Suite iPXE
# To refresh screen as next keyword expects DTS checkpoint
Press Key N Times 1 ${ESC}
Provide DPP Credentials
Go Through Update
Wait For Checkpoint Rebooting


*** Keywords ***
Are FW FILE And DPP Keys Defined
${fw}= Run Keyword And Return Status
... Variable Should Exist $FW_FILE
${logs}= Run Keyword And Return Status
... Variable Should Exist $DPP_LOGS_KEY
${download}= Run Keyword And Return Status
... Variable Should Exist $DPP_DOWNLOAD_KEY
${password}= Run Keyword And Return Status
... Variable Should Exist $DPP_PASSWORD
${status}= Run Keyword And Return Status Should Be True
... ${fw} and ${logs} and ${download} and ${password}
RETURN ${status}
150 changes: 0 additions & 150 deletions dts/dts-e2e.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,6 @@ Suite Teardown Run Keyword
... Log Out And Close Connection


*** Variables ***
# TODO: We should extend our keyword libs with keywords for DTS UI, these are
# first candidates. But before doing so - we need to establish some UI rules in
# DTS itself.
# DTS checkpoints:
${DTS_CHECKPOINT}= Enter an option:
${DTS_CONFIRM_CHECKPOINT}= Press Enter to continue
${HCL_REPORT_CHECKPOINT}= Please consider contributing to the "Hardware for Linux" project in the future.
${HCL_REPORT_SENDINGLOGS}=
... Do you want to support Dasharo development by sending us logs with your hardware configuration? [N/y]
${DTS_SPECIFICATION_WARN}= Does it match your actual specification? (Y|n)
${DTS_DEPLOY_WARN}= Do you want to deploy this Dasharo Firmware on your platform (Y|n)
${DTS_HW_PROBE_WARN}= Do you want to participate in this project?
${DTS_HEADS_SWITCH_QUESTION}= Would you like to switch to Dasharo heads firmware? (Y|n)
# DTS initial deployment menupoints:
${DTS_DCR_UEFI_MENUPOINT}= Community version
${DTS_DPP_UEFI_MENUPOINT}= DPP version (coreboot + UEFI)
${DTS_DPP_SEA_MENUPOINT}= DPP version (coreboot + SeaBIOS)
# Default DTS boot type, can be overwritten by CMD:
${DTS_BOOT_TYPE}= iPXE
# DTS options:
${DTS_HCL_OPT}= 1
${DTS_DEPLOY_OPT}= 2
${DTS_CREDENTIALS_OPT}= 4
${DTS_DCR_UEFI_OPT}= c
${DTS_DPP_UEFI_OPT}= d
${DTS_DPP_SEA_OPT}= s
# DTS subscription checkpoints:
${DTS_NOACCESS_DPP_UEFI}= DPP version (coreboot + UEFI) available but you don't have access
${DTS_NOACCESS_DPP_SEABIOS}= DPP version (coreboot + SeaBIOS) available but you don't have access
${DTS_NOACCESS_DPP_HEADS}= DPP version (coreboot + Heads) available but you don't have access


*** Test Cases ***
E2E001.001 HCL Report test
[Documentation] Verify that HCL Report is being executed with all
Expand Down Expand Up @@ -1125,120 +1092,3 @@ E2E006.004 Odroid H4 DPP update (Coreboot + UEFI -> Coreboot + UEFI) - with cred

# 5) The final step is rebooting:
Wait For Checkpoint Rebooting


*** Keywords ***
Power On And Enter DTS Shell
[Documentation] This KW boots DTS using the method defined by user via
... DTS_BOOT_TYPE or the default one. After booting DTS shell is being
... entered.
# 1) Boot up to DTS UI:
Power On
Boot Dasharo Tools Suite ${DTS_BOOT_TYPE}

# 2) Enter shell:
Write Into Terminal S
Set Prompt For Terminal bash-5.2#
Read From Terminal Until Prompt
Set DUT Response Timeout 90s

Provide DPP Credentials
[Documentation] This KW automatically writes DPP credentials into DTS UI.
... The credentials should be set via CMD or file.
${out}= Read From Terminal Until ${DTS_CHECKPOINT}
Write Bare Into Terminal ${DTS_CREDENTIALS_OPT}

# Enter logs key:
Variable Should Exist ${DPP_LOGS_KEY}
Write Into Terminal ${DPP_LOGS_KEY}
# Enter download key:
Variable Should Exist ${DPP_DOWNLOAD_KEY}
Write Into Terminal ${DPP_DOWNLOAD_KEY}
# Enter password:
Variable Should Exist ${DPP_PASSWORD}
Write Into Terminal ${DPP_PASSWORD}

Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}

Wait For Checkpoint
[Documentation] This KW waits for checkpoint (first argument) and logs
... everything read up to the checkpoint.
[Arguments] ${checkpoint}
${out}= Read From Terminal Until ${checkpoint}
Log ${out}

Wait For Checkpoint And Write
[Documentation] This KW waits for checkpoint (first argument)
... and writes specified answer (second argument), with logging all
... output before the checkpoint.
[Arguments] ${checkpoint} ${to_write}
Wait For Checkpoint ${checkpoint}
Sleep 1s
Write Into Terminal ${to_write}

Wait For Checkpoint And Press Enter
[Documentation] This KW waits for checkpoint (first argument)
... and preses enter, with logging all output before the checkpoint.
[Arguments] ${checkpoint}
Wait For Checkpoint ${checkpoint}
Sleep 1s
Write Bare Into Terminal \r\n

Go Through Initial Deployment
[Documentation] This KW goes through standard Dasharo initial deployment
... choosing all needed menu options and answering all questions. The
... only thing which needs to be specified - the Dasharo version to
... deploy (first argument), available versions: DCR UEFI, DPP UEFI, DPP
... SeaBIOS.
[Arguments] ${dasharo_version}
# 1) Select initial deployment:
Wait For Checkpoint And Write ${DTS_CHECKPOINT} ${DTS_DEPLOY_OPT}

# 2) Wait for HCL report to do its work, might take some time:
Set DUT Response Timeout 5m
# Accept hw-probe question from HCL report:
Wait For Checkpoint And Write ${DTS_HW_PROBE_WARN} Y
Set DUT Response Timeout 30s

# 3) Choose version to install:
IF '${dasharo_version}' == 'DCR UEFI'
Wait For Checkpoint ${DTS_DCR_UEFI_OPT}) ${DTS_DCR_UEFI_MENUPOINT}
Wait For Checkpoint And Write ${DTS_CHECKPOINT} ${DTS_DCR_UEFI_OPT}
ELSE IF '${dasharo_version}' == 'DPP UEFI'
Wait For Checkpoint ${DTS_DPP_UEFI_OPT}) ${DTS_DPP_UEFI_MENUPOINT}
Wait For Checkpoint And Write ${DTS_CHECKPOINT} ${DTS_DPP_UEFI_OPT}
ELSE IF '${dasharo_version}' == 'DPP SeaBIOS'
Wait For Checkpoint ${DTS_DPP_SEA_OPT}) ${DTS_DPP_SEA_MENUPOINT}
Wait For Checkpoint And Write ${DTS_CHECKPOINT} ${DTS_DPP_SEA_OPT}
ELSE
Fail No Dasharo version for initial deployment provided!
END

# 4) Check out all warnings:
Wait For Checkpoint And Write ${DTS_SPECIFICATION_WARN} Y
Wait For Checkpoint And Write ${DTS_DEPLOY_WARN} Y

Go Through Update
[Documentation] This KW goes through standard Dasharo update workflow
... choosing all needed menu options and answering all questions.
# 1) Select initial deployment:
Wait For Checkpoint And Write ${DTS_CHECKPOINT} ${DTS_DEPLOY_OPT}

# 2) Check out all warnings:
Wait For Checkpoint And Write ${DTS_SPECIFICATION_WARN} Y
Wait For Checkpoint And Write ${DTS_DEPLOY_WARN} Y

Go Through Heads Transition
[Documentation] This KW goes through transition to Dasharo Heads choosing
... all needed menu options and answering all questions.
# 1) Start update:
Wait For Checkpoint And Write ${DTS_CHECKPOINT} ${DTS_DEPLOY_OPT}

# 2) Check out all warnings:
Wait For Checkpoint And Write ${DTS_HEADS_SWITCH_QUESTION} Y
Wait For Checkpoint And Write ${DTS_SPECIFICATION_WARN} Y
Wait For Checkpoint And Write ${DTS_DEPLOY_WARN} Y

# 3) Check for Heads firmware deployment success:
Wait For Checkpoint Successfully switched to Dasharo Heads firmware
Wait For Checkpoint And Write ${DTS_CONFIRM_CHECKPOINT} 1
Loading
Loading