Skip to content

Commit

Permalink
dasharo-security/tpm-support.robot: Clarify kwd names, fix variable gen
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Czapla <[email protected]>
  • Loading branch information
SebastianCzapla committed Feb 4, 2025
1 parent 034ccfe commit 7cd6900
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dasharo-security/tpm-support.robot
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ TPM001.001 TPM Support (firmware)
... detected and logged correctly by FW via cbmem, directly in Ubuntu
Skip If not ${TESTS_IN_UBUNTU_SUPPORT} TPM001.001 not supported
Prepare TPM Test On Ubuntu
${result}= Run Keyword And Ignore Error Validate Expected TPM Chip Via Cbmem
${result}= Run Keyword And Ignore Error Validate Expected TPM Chip Via Cbmem Console Log
IF '${result}[0]' == 'FAIL'
Log To Console \nChip detection failed, attempting cbmem log detection\n
Validate Expected TPM Version Via Cbmem Log
Validate Expected TPM Version Via Cbmem TPM Eventlog
END

TPM001.002 TPM Support (Ubuntu)
Expand Down Expand Up @@ -63,10 +63,10 @@ TPM002.001 Verify TPM version (firmware)
... correctly recognized by the firmware.
Skip If not ${TESTS_IN_UBUNTU_SUPPORT} TPM002.001 not supported
Prepare TPM Test On Ubuntu
${result}= Run Keyword And Ignore Error Validate Expected TPM Chip Via Cbmem
${result}= Run Keyword And Ignore Error Validate Expected TPM Chip Via Cbmem Console Log
IF '${result}[0]' == 'FAIL'
Log To Console \nChip detection failed, attempting cbmem log detection\n
Validate Expected TPM Version Via Cbmem Log
Validate Expected TPM Version Via Cbmem TPM Eventlog
END

TPM002.002 Verify TPM version (Ubuntu)
Expand Down
4 changes: 2 additions & 2 deletions lib/tpm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ Validate Expected TPM Version Via Sysfs
Fail Platform TPM version mismatch
END

Validate Expected TPM Chip Via Cbmem
Validate Expected TPM Chip Via Cbmem Console Log
[Documentation] Check that correct TPM chip is found while FW boots
Get Cbmem From Cloud
${tpm_chip_found}= Execute Command In Terminal cbmem -1 | grep -i "Found TPM"
Should Contain ${tpm_chip_found} ${TPM_EXPECTED_CHIP}

Validate Expected TPM Version Via Cbmem Log
Validate Expected TPM Version Via Cbmem TPM Eventlog
[Documentation] Check if appropriate log is created by FW
Get Cbmem From Cloud
${out}= Execute Command In Terminal cbmem -L
Expand Down
6 changes: 3 additions & 3 deletions scripts/get-robot-variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ else
TPM_SUPPORTED_VERSION=\$\{None\}
fi

if [ -f /usr/local/bin/cbmem ]; then
TPM_EXPECTED_CHIP=$(sudo /usr/local/bin/cbmem -1 | grep "Found TPM" | awk 'NR==1{print $6}');
if [ -f ${CBMEM_BINARY_PATH} ]; then
TPM_EXPECTED_CHIP=$(sudo ${CBMEM_BINARY_PATH} -1 | grep "Found TPM" | awk 'NR==1{print $6}');
else
TPM_EXPECTED_CHIP="Unknown"
fi
Expand Down Expand Up @@ -314,7 +314,7 @@ fi
[[ -n "$DEF_CORES_PER_SOCKET" ]] && echo "\${DEF_CORES_PER_SOCKET}= $DEF_CORES_PER_SOCKET"
[[ -n "$DEF_SOCKETS" ]] && echo "\${DEF_SOCKETS}= $DEF_SOCKETS"
[[ -n "$DEF_ONLINE_CPU" ]] && echo "\${DEF_ONLINE_CPU}= $DEF_ONLINE_CPU"
[[ -n "$TPM_SUPPORTED_VERSION" ]] && echo "\${TPM_SUPPORTED_VERSION}= $TPM_SUPPORTED_VERSION"
[[ -n "$TPM_SUPPORTED_VERSION" ]] && echo "\${TPM_SUPPORTED_VERSION}= $TPM_SUPPORTED_VERSION"
[[ -n "$TPM_EXPECTED_CHIP" ]] && echo "\${TPM_EXPECTED_CHIP}= $TPM_EXPECTED_CHIP"

for i in $(seq 1 $counter); do
Expand Down

0 comments on commit 7cd6900

Please sign in to comment.