From d2bb93565cb5cc752992e0d0ab82f57f11b69273 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Mon, 29 Apr 2024 14:34:25 +0200 Subject: [PATCH] pcrlock: skip make-policy tests if environment lacks TPM support make-policy needs to write into an NVindex. For that we need an actual TPM. Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com> --- test/units/TEST-70-TPM2.pcrlock.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/units/TEST-70-TPM2.pcrlock.sh b/test/units/TEST-70-TPM2.pcrlock.sh index ae809be6712..25f1a2537ed 100755 --- a/test/units/TEST-70-TPM2.pcrlock.sh +++ b/test/units/TEST-70-TPM2.pcrlock.sh @@ -117,10 +117,12 @@ if [[ -n "$SD_STUB" ]]; then [[ "$uki_stdin" == "$uki_pipe" ]] fi -PIN=huhu "$SD_PCRLOCK" make-policy --pcr="$PCRS" --recovery-pin=query -# Repeat immediately (this call will have to reuse the nvindex, rather than create it) -"$SD_PCRLOCK" make-policy --pcr="$PCRS" -"$SD_PCRLOCK" make-policy --pcr="$PCRS" --force +if "$SD_PCRLOCK" is-supported; then + PIN=huhu "$SD_PCRLOCK" make-policy --pcr="$PCRS" --recovery-pin=query + # Repeat immediately (this call will have to reuse the nvindex, rather than create it) + "$SD_PCRLOCK" make-policy --pcr="$PCRS" + "$SD_PCRLOCK" make-policy --pcr="$PCRS" --force +fi img="/tmp/pcrlock.img" truncate -s 20M "$img"