From 7cd69000ec31862efcbae8bbbac6532ece751abb Mon Sep 17 00:00:00 2001 From: Sebastian Czapla Date: Tue, 4 Feb 2025 13:16:55 +0100 Subject: [PATCH] dasharo-security/tpm-support.robot: Clarify kwd names, fix variable gen Signed-off-by: Sebastian Czapla --- dasharo-security/tpm-support.robot | 8 ++++---- lib/tpm.robot | 4 ++-- scripts/get-robot-variables.sh | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dasharo-security/tpm-support.robot b/dasharo-security/tpm-support.robot index 99a72d16c..4778c1fe3 100644 --- a/dasharo-security/tpm-support.robot +++ b/dasharo-security/tpm-support.robot @@ -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) @@ -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) diff --git a/lib/tpm.robot b/lib/tpm.robot index 8f99d14e4..9152dce7a 100644 --- a/lib/tpm.robot +++ b/lib/tpm.robot @@ -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 diff --git a/scripts/get-robot-variables.sh b/scripts/get-robot-variables.sh index 942000f6c..82ccf911e 100755 --- a/scripts/get-robot-variables.sh +++ b/scripts/get-robot-variables.sh @@ -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 @@ -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