Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
268 changes: 266 additions & 2 deletions dts/dts-e2e.robot
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,265 @@ E2E003.002 DCR UEFI Update On Msi-pro-z690-a-wifi-ddr4 With 13th Gen CPU Should
... msi-pro-z690-a-wifi-ddr4 with 13gen CPU.
Perform DCR UEFI Update On Incompatible CPU Regression Test msi-pro-z690-a-wifi-ddr4

################################################################################
# Credentials tests:
################################################################################

E2E007.001 Check credentials are being saved correctly
[Documentation] Check that credentials are saved to /etc/cloud-pass and
... to mc correctly
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot

Provide DPP Credentials
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS
${creds}= Execute Command In Terminal cat /etc/cloud-pass
@{lines}= Split To Lines ${creds}
${line_num}= Get Length ${lines}
Should Be Equal As Integers ${line_num} 2 cloud-pass file should have only 2 lines
IF "${lines}[0]" != "${DPP_EMAIL}" or "${lines}[1]" != "${DPP_PASSWORD}"
Fail E-mail or password is different from expected
END
${creds2}= Execute Command In Terminal mc alias ls premium | grep "Key" | awk '{print $3}'
Should Be Equal ${creds} ${creds2}
... /etc/cloud-pass and mc credentials differ

E2E007.002 Check old credentials are being overwritten by new
[Documentation] Make sure that entering new credentials results in old
... being overwritten. Requires 2 sets of working credentials as mc
... doesn't save credentials that do not work.
Depends On Variable \${DPP_EMAIL_FW_ONLY}
Depends On Variable \${DPP_PASSWORD_FW_ONLY}
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot

Provide DPP Credentials
VAR ${DPP_EMAIL}= ${DPP_EMAIL_FW_ONLY} scope=TEST
VAR ${DPP_PASSWORD}= ${DPP_PASSWORD_FW_ONLY} scope=TEST
Provide DPP Credentials
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS

${creds}= Execute Command In Terminal cat /etc/cloud-pass
@{lines}= Split To Lines ${creds}
${line_num}= Get Length ${lines}
Should Be Equal As Integers ${line_num} 2 cloud-pass file should have only 2 lines
IF "${lines}[0]" != "${DPP_EMAIL_FW_ONLY}" or "${lines}[1]" != "${DPP_PASSWORD_FW_ONLY}"
Fail E-mail or password is different from expected
END
${creds2}= Execute Command In Terminal mc alias ls premium | grep "Key" | awk '{print $3}'
Should Be Equal ${creds} ${creds2}
... /etc/cloud-pass and mc credentials differ

E2E007.003 Check wrong credentials should not allow to log into DPP services
[Documentation] Entering wrong credentials shouldn't allow access to DPP
... services and shouldn't be saved
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot

VAR ${DPP_EMAIL}= [email protected] scope=TEST
VAR ${DPP_PASSWORD}= test-password scope=TEST
${out}= Provide DPP Credentials
Should Contain ${out} Cannot log in to DPP server.
Should Not Contain ${out} Dasharo DPP credentials have been saved
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS
${creds}= Execute Command In Terminal cat /etc/cloud-pass
Should Not Contain Any ${creds} ${DPP_EMAIL} ${DPP_PASSWORD}
${creds2}= Execute Command In Terminal
... mc alias ls premium | grep "Key" | awk '{print $3}'
Should Not Contain Any ${creds2} ${DPP_EMAIL} ${DPP_PASSWORD}

E2E007.004 Check correct credentials should allow to log into DPP services
[Documentation] Entering correct credentials should allow access to DPP
... services
Clean Up DTS Environment
# We need to simulate supported platform
Export Shell Variables For Emulation
... UEFI Update
... DPP
... ${DTS_PLATFORM_VARIABLES}[odroid-h4-plus]
... ${DTS_CONFIG_REF}
Write Into Terminal dts-boot

${out}= Provide DPP Credentials
Should Contain ${out} Dasharo Pro Package (DPP): YES
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS
${rc}= Execute Command In Terminal And Return RC mc ls premium
Should Be Equal As Integers ${rc} 0
... mc command failed to list buckets

E2E007.005 Check empty e-mail should not pass
[Documentation] Entering empty e-mail shouldn't be allowed
Clean Up DTS Environment
Write Into Terminal dts-boot
${out}= Read From Terminal Until ${DTS_CHECKPOINT}
Write Bare Into Terminal ${DTS_CREDENTIALS_OPT}
Wait For Checkpoint And Press Enter ${DPP_EMAIL_CHECKPOINT}
Set DUT Response Timeout 15s
Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS
${lines}= Execute Command In Terminal
... cat /etc/cloud-pass 2>/dev/null | wc -l
Should Be Equal As Integers ${lines} 0 cloud-pass shouldn't exist or at least be empty

E2E007.006 Check empty password should not pass
[Documentation] Entering empty password shouldn't be allowed
Clean Up DTS Environment
Write Into Terminal dts-boot
${out}= Read From Terminal Until ${DTS_CHECKPOINT}
Write Bare Into Terminal ${DTS_CREDENTIALS_OPT}
Wait For Checkpoint And Write ${DPP_EMAIL_CHECKPOINT} ${DPP_EMAIL}
Wait For Checkpoint And Press Enter ${DPP_PASSWORD_CHECKPOINT}
${out}= Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}
Should Not Contain ${out} Dasharo Pro Package (DPP):
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS
${lines}= Execute Command In Terminal
... cat /etc/cloud-pass 2>/dev/null | wc -l
Should Be Equal As Integers ${lines} 0 cloud-pass shouldn't exist or at least be empty

E2E007.008 Check DPP credentials with access to only firmware
[Documentation] Those credentials should allow access only to DPP
... firmware
Depends On Variable \${DPP_EMAIL_FW_ONLY}
Depends On Variable \${DPP_PASSWORD_FW_ONLY}
Clean Up DTS Environment
Export Shell Variables For Emulation
... UEFI Update
... DPP
... ${DTS_PLATFORM_VARIABLES}[odroid-h4-plus]
... ${DTS_CONFIG_REF}
Write Into Terminal dts-boot

VAR ${DPP_EMAIL}= ${DPP_EMAIL_FW_ONLY} scope=TEST
VAR ${DPP_PASSWORD}= ${DPP_PASSWORD_FW_ONLY} scope=TEST
${out}= Provide DPP Credentials
Should Contain ${out} Dasharo Pro Package (DPP): YES
Should Contain ${out} DTS Extensions: NO

E2E007.009 Check DPP credentials with access to only extensions
[Documentation] Those credentials should allow access only to DTS
... extensions
Depends On Variable \${DPP_EMAIL_EXTENSIONS_ONLY}
Depends On Variable \${DPP_PASSWORD_EXTENSIONS_ONLY}
Clean Up DTS Environment
Export Shell Variables For Emulation
... UEFI Update
... DPP
... ${DTS_PLATFORM_VARIABLES}[odroid-h4-plus]
... ${DTS_CONFIG_REF}
Write Into Terminal dts-boot

VAR ${DPP_EMAIL}= ${DPP_EMAIL_EXTENSIONS_ONLY} scope=TEST
VAR ${DPP_PASSWORD}= ${DPP_PASSWORD_EXTENSIONS_ONLY} scope=TEST
${out}= Provide DPP Credentials
Should Contain ${out} Dasharo Pro Package (DPP): NO
Should Contain ${out} DTS Extensions: YES

E2E007.010 Check DPP credentials without DPP access
[Documentation] Those credentials shouldn't allow access to any firmware
... or DTS extensions
Depends On Variable \${DPP_EMAIL_NO_ACCESS}
Depends On Variable \${DPP_PASSWORD_NO_ACCESS}
Clean Up DTS Environment
Export Shell Variables For Emulation
... UEFI Update
... DPP
... ${DTS_PLATFORM_VARIABLES}[odroid-h4-plus]
... ${DTS_CONFIG_REF}
Write Into Terminal dts-boot

VAR ${DPP_EMAIL}= ${DPP_EMAIL_NO_ACCESS} scope=TEST
VAR ${DPP_PASSWORD}= ${DPP_PASSWORD_NO_ACCESS} scope=TEST
${out}= Provide DPP Credentials
Should Contain ${out} Something may be wrong with the DPP credentials
${out}= Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}
Should Contain ${out} Dasharo Pro Package (DPP): NO
Should Contain ${out} DTS Extensions: NO

E2E007.011 Check DPP credentials with both DPP firmware and DTS extensions access
[Documentation] Those credentials should allow access to both DPP
... firmware and DTS extensions
Clean Up DTS Environment
Export Shell Variables For Emulation
... UEFI Update
... DPP
... ${DTS_PLATFORM_VARIABLES}[odroid-h4-plus]
... ${DTS_CONFIG_REF}
Write Into Terminal dts-boot

${out}= Provide DPP Credentials
Should Contain ${out} Dasharo Pro Package (DPP): YES
Should Contain ${out} DTS Extensions: YES

E2E008.001 Reboot UI Option Calls Reboot Command
[Documentation] Reboot (R) UI option should call mocked reboot command
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot
Wait For Checkpoint ${DTS_CHECKPOINT}
Write Bare Into Terminal R
Wait For Checkpoint common_mock: using reboot

E2E008.002 Poweroff UI Option Calls Poweroff Command
[Documentation] Poweroff (P) UI option should call mocked poweroff
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot
Wait For Checkpoint ${DTS_CHECKPOINT}
Write Bare Into Terminal P
Wait For Checkpoint common_mock: using poweroff

E2E008.003 Launch SSH Server UI Option Enables SSH Server Command
[Documentation] Launch SSH Server (K) UI option should start sshd server
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Execute Command In Terminal systemctl stop sshd
Write Into Terminal dts-boot
${out}= Wait For Checkpoint ${DTS_CHECKPOINT}
Should Not Contain ${out} SSH status: ON
Write Bare Into Terminal K
${out}= Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}
Should Contain All ${out} Starting SSH server! Listening on IPs
${out}= Wait For Checkpoint ${DTS_CHECKPOINT}
Should Contain ${out} SSH status: ON

E2E008.004 Enable Sending Logs UI Option Should Enable DTS Log Sending
[Documentation] Enable Sending DTS Logs (L) should enable automatic log
... sending e.g. when entering shell
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot
${out}= Wait For Checkpoint ${DTS_CHECKPOINT}
Should Contain ${out} L to enable
Write Bare Into Terminal L
${out}= Wait For Checkpoint ${DTS_CHECKPOINT}
Should Contain ${out} L to disable
Write Bare Into Terminal S
SSHLibrary.Read Until Sending logs...

E2E009.001 DTS extensions are installed and can be used
[Documentation] Test that DTS extensions are installed after entering DPP
... keys with access to them and that they can be used after.
Clean Up DTS Environment
Execute Command In Terminal export DTS_TESTING="true"
Write Into Terminal dts-boot

${out}= Provide DPP Credentials
Should Contain ${out}
... Package txeconfigtool-git-r0.core2_64.rpm have been installed successfully!
Wait For Checkpoint ${DTS_CHECKPOINT}
Enter Shell In DTS
${rc}= Execute Command In Terminal And Return RC command -V txeconfigtool
Should Be Equal As Integers ${rc} 0 txeconfigtool can't be found


*** Keywords ***
# robocop: disable:0919
Expand Down Expand Up @@ -176,13 +435,19 @@ Prepare E2E Test
# TODO: needed by 'Go Through Initial Deployment' keyword for couple of
# NovaCustom boards
VAR ${DTS_TEST_BOARD_MODEL}= ${DTS_PLATFORM_VARIABLES}[${platform}][DTS_TEST_BOARD_MODEL] scope=TEST
Clean Up DTS Environment
Write Into Terminal dts-boot

Clean Up DTS Environment
[Documentation] Remove and clean up everything that might affect tests.
... Should be run in DTS shell
Execute Command In Terminal
... rm -rf /etc/cloud-pass /root/.mc /*.tar.gz /root/*.tar.gz /tmp/logs/*profile /tmp/dts-temp-files
Write Into Terminal dts-boot

Prepare DTS Test
[Documentation] Used as test setup. Starts new SSH session so we start
... with clean shell environment for each test
Execute Command In Terminal systemctl start sshd
Start New DTS SSH Session In QEMU

Teardown Template E2E DTS Test
Expand Down Expand Up @@ -259,7 +524,6 @@ Prepare DTS E2E Test Suite
VAR ${DEVICE_OS_PASSWORD}= ${EMPTY} scope=SUITE
Power On And Enter DTS Shell
Set Prompt For Terminal bash-5.2#
Execute Command In Terminal systemctl start sshd

Perform DCR Initial Deployment On Incompatible CPU Regression Test
[Documentation] Given a board with DCR-incompatible CPU, expect an error
Expand Down
9 changes: 6 additions & 3 deletions lib/dts-lib.robot
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ ${DTS_ME_WARN}=
... Skip ME flashing and proceed with BIOS/firmware flashing/updating? (Y|n)
${DTS_BOARD_QUESTION}= Choose your board model:
${DTS_13_GEN_REGRESSION}= Aborting deployment...
${DPP_EMAIL_CHECKPOINT}= Enter DPP email:
${DPP_PASSWORD_CHECKPOINT}= Enter password:
# DTS initial deployment menupoints:
${DTS_DCR_UEFI_MENUPOINT}= Community version
${DTS_DPP_UEFI_MENUPOINT}= DPP version (coreboot + UEFI)
Expand Down Expand Up @@ -223,12 +225,13 @@ Provide DPP Credentials

# Enter email:
Variable Should Exist ${DPP_EMAIL}
Write Into Terminal ${DPP_EMAIL}
Wait For Checkpoint And Write ${DPP_EMAIL_CHECKPOINT} ${DPP_EMAIL}
# Enter password:
Variable Should Exist ${DPP_PASSWORD}
Write Into Terminal ${DPP_PASSWORD}
Wait For Checkpoint And Write ${DPP_PASSWORD_CHECKPOINT} ${DPP_PASSWORD}

Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}
${out}= Wait For Checkpoint And Press Enter ${DTS_CONFIRM_CHECKPOINT}
RETURN ${out}

Provide DPP Credentials Without Packages
[Documentation] This KW automatically writes DPP credentials that do not
Expand Down
24 changes: 24 additions & 0 deletions lib/terminal.robot
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,30 @@ Execute Command In Terminal
${output}= Strip String ${output} mode=right characters=\n\r
RETURN ${output}

Execute Command In Terminal And Return RC
[Documentation] Universal keyword to execute command regardless of the
... used method of connection to the DUT (Telnet or SSH). The DUT Response
... Timeout is changed to ``${timeout}`` and not restored.
...
... === Requirements ===
... The command prompt has to be set using ``Set Prompt For Terminal``
...
... === Arguments ===
... - ``${command}``: ``string`` - The command to execute
... - ``${timeout}``: ``string`` = ``30s`` - The DUT Response Timeout for
... \ executing the command
...
... === Return Value ===
... ``string`` - Return code of the executed function (as returned by $?)
...
... === Effects ===
... The ``${command}`` is written to the terminal and the keyword waits
... until the execution ends or ``${timeout}`` passes.
[Arguments] ${command} ${timeout}=30s
Execute Command In Terminal ${command} ${timeout}
${rc}= Execute Command In Terminal echo $? ${timeout}
RETURN ${rc}

Execute UEFI Shell Command
[Documentation]
... Executes a command in UEFI Shell. For some reason, text longer than
Expand Down
Loading