swtpm/tests/patches/0004-Store-and-restore-volatile-state-at-every-step.patch
Stefan Berger 9a154fa45f tests: ibmtss2: Add patch to disable x509 test with older libtpms
Older versions of libtpms need to have another patch applied that disables
x509 certificate creation (0013-Disable-x509-test-cases-part2.patch).

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-05-15 14:21:37 -04:00

59 lines
1.3 KiB
Diff

From 85c5c7576c9e10f5b7c37573311aaf96353eee07 Mon Sep 17 00:00:00 2001
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
Date: Sun, 28 Feb 2021 16:42:11 -0500
Subject: [PATCH 04/13] Store and restore volatile state at every step
---
utils/reg.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/utils/reg.sh b/utils/reg.sh
index c9d49b9..0bba17a 100755
--- a/utils/reg.sh
+++ b/utils/reg.sh
@@ -140,6 +140,16 @@ printUsage ()
echo "-51 Events"
}
+storeAndRestoreVolatileState()
+{
+ if [ ${SWTPM_TEST_STORE_VOLATILE:-0} -ne 0 ]; then
+ echo ">>> Storing and re-storing volatile state <<<"
+ ${SWTPM_IOCTL} -v --tcp ${TPM_SERVER_NAME}:${TPM_PLATFORM_PORT}
+ ${SWTPM_IOCTL} -i --tcp ${TPM_SERVER_NAME}:${TPM_PLATFORM_PORT}
+ fi
+}
+export -f storeAndRestoreVolatileState
+
checkSuccess()
{
if [ $1 -ne 0 ]; then
@@ -149,7 +159,7 @@ if [ $1 -ne 0 ]; then
else
echo " INFO:"
fi
-
+storeAndRestoreVolatileState
}
# FIXME should not increment past 254
@@ -162,6 +172,7 @@ if [ $1 -ne 0 ]; then
else
echo " INFO:"
fi
+storeAndRestoreVolatileState
}
checkFailure()
@@ -173,6 +184,7 @@ if [ $1 -eq 0 ]; then
else
echo " INFO:"
fi
+storeAndRestoreVolatileState
}
cleanup()
--
2.39.1