From: Frantisek Sumsal Date: Wed, 25 Oct 2023 15:40:05 +0000 (+0200) Subject: test: make the TPM event log checking a bit more robust X-Git-Tag: v255-rc1~139^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=45534eefe6b8b5acec09f26dd698350ed6648e4e;p=thirdparty%2Fsystemd.git test: make the TPM event log checking a bit more robust Don't hardcode the event number, so the test works correctly even if someone wrote to the event log before us. Also, explicitly pick the sha256 bank when checking digests, as the indexing may vary depending on current TPM's capabilities. --- diff --git a/test/units/testsuite-70.pcrextend.sh b/test/units/testsuite-70.pcrextend.sh index 0c391626c2c..cae2d28fd99 100755 --- a/test/units/testsuite-70.pcrextend.sh +++ b/test/units/testsuite-70.pcrextend.sh @@ -14,6 +14,23 @@ if [[ ! -x "${SD_PCREXTEND:?}" ]] || ! tpm_has_pcr sha256 11 || ! tpm_has_pcr sh exit 0 fi +at_exit() { + if [[ $? -ne 0 ]]; then + # Dump the event log on fail, to make debugging a bit easier + jq --seq --slurp