]> git.proxmox.com Git - swtpm.git/blobdiff - tests/test_tpm2_ibmtss2
tests: Patch IBM TSS2 test suite for OpenSSL 3.x
[swtpm.git] / tests / test_tpm2_ibmtss2
index 4e9df2bde5b86e789514e88a080e827b2983c6ea..6caf4fc095b2a82f3aa93b29c734d73ab25951e6 100755 (executable)
@@ -4,6 +4,11 @@ if [ ${SWTPM_TEST_EXPENSIVE:-0} -eq 0 ]; then
        exit 77
 fi
 
+if [ -z "$(type openssl)" ]; then
+       echo "Openssl command line tool is required."
+       exit 1
+fi
+
 ROOT=${abs_top_builddir:-$(pwd)/..}
 TESTDIR=${abs_top_testdir:-$(dirname "$0")}
 ABSTESTDIR=$(cd ${TESTDIR} &>/dev/null;echo ${PWD})
@@ -28,7 +33,9 @@ function cleanup() {
 trap "cleanup" EXIT
 
 source ${TESTDIR}/common
-WORKDIR=$(mktemp -d)
+skip_test_no_tpm20 "${SWTPM_EXE}"
+
+WORKDIR="$(mktemp -d)" || exit 1
 
 REGLOG=${WORKDIR}/reglog
 
@@ -49,6 +56,11 @@ if [ $? -ne 0 ]; then
        exit 1
 fi
 
+# To be able to apply the patches we need to to set some variables
+# for user that don't have this set up properly
+git config --local user.name test
+git config --local user.email test@test.test
+
 # A v1.6.0 bug work-around:
 # We cannot run the EK certificate tests since rootcerts.txt points to
 # files we do not have
@@ -60,8 +72,8 @@ git am < ${PATCHESDIR}/0002-Implement-powerup-for-swtpm.patch
 # set CRYPTOLIBRARY=openssl
 git am < ${PATCHESDIR}/0003-Set-CRYPTOLIBRARY-to-openssl.patch
 
-# Store volatile state at every step
-git am < ${PATCHESDIR}/0004-Store-volatile-state-at-every-step.patch
+# Store and restore volatile state at every step
+git am < ${PATCHESDIR}/0004-Store-and-restore-volatile-state-at-every-step.patch
 
 # Disable 'Events' test
 git am < ${PATCHESDIR}/0005-Disable-tests-related-to-events.patch
@@ -87,6 +99,10 @@ if [ $revision -lt 155 ]; then
        git am < ${PATCHESDIR}/0009-Disable-getcapability-TPM_CAP_ACT.patch
 fi
 
+if [ -n "$(openssl version | grep -E "^OpenSSL 3")" ]; then
+       git am < ${PATCHESDIR}/0010-Adjust-test-cases-for-OpenSSL-3.patch
+fi
+
 autoreconf --force --install
 unset CFLAGS LDFLAGS LIBS
 ./configure --disable-tpm-1.2
@@ -135,4 +151,4 @@ popd &>/dev/null
 
 [ $ret -eq 0 ] && echo "OK"
 
-exit $ret
\ No newline at end of file
+exit $ret