tss2/tests/runtest.sh
Štěpán Horáček d56bd7eab9 Use tests from build
Previously the tests were cloned from the upstream repo, where they also
contain tests for SHA-1. After restricting SHA-1, these tests cannot
succeed. Use updated tests from patches instead.

Resolves: rhbz#2060768

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
2022-06-29 19:50:33 +02:00

59 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# get tpm simulator code
IBMTPM_VERSION=1661
wget --no-check-certificate https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm$IBMTPM_VERSION.tar.gz
res="$?"
if [[ "$res" -ne 0 ]]; then
echo "wget failed"
exit 1
fi
# unpackage and build the source
mkdir ibmtpm
pushd ibmtpm
tar xf ../ibmtpm$IBMTPM_VERSION.tar.gz
pushd src
# fixup for openssl 3
sed -i -e "s|OPENSSL_VERSION_NUMBER >= 0x10200000L|OPENSSL_VERSION_NUMBER > 0x30000010L|" TpmToOsslMath.h
sed -i -e "s|CCFLAGS = -Wall|CCFLAGS = -Wall -Wno-error=deprecated-declarations|" makefile
make
res="$?"
if [[ "$res" -ne 0 ]]; then
echo "make of ibmtpm failed"
popd
popd
rm -rf ibmtpm ibmtpm$IBMTPM_VERSION.tar.gz
exit 1
fi
(./tpm_server)&
popd
popd
sleep 10
export TPM_INTERFACE_TYPE=socsim
# use the tss2 tests from the sources
pushd ./source/utils
# fix python calls to use rhel name for python3
sed -i -e 's/^PREFIX=\.\//PREFIX=tss/g' reg.sh
# fix paths in rootcerts.txt
c=`pwd`
sed -i -e "s|/gsa/yktgsa/home/k/g/kgold/tpm2/utils|${c}|g" certificates/rootcerts.txt
# run the tests
./reg.sh -a
res="$?"
popd
# clean up
pkill tpm_server
rm -rf ibmtpm tss
exit $res