aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-10-05 01:21:35 +0000
committerNIIBE Yutaka <[email protected]>2023-10-05 01:21:35 +0000
commit227b3b14f4be2f33ed721818c2186e7fca4cebdf (patch)
tree2a917bae317d4ea307948ddaa2a9a57c3f63f393 /tests
parenttests:tpm2dtests: Fix tests with SWTPM. (diff)
downloadgnupg-227b3b14f4be2f33ed721818c2186e7fca4cebdf.tar.gz
gnupg-227b3b14f4be2f33ed721818c2186e7fca4cebdf.zip
tests:tpm2dtests: Modify tests with SWTPM and relax the condition.
* configure.ac (SWTPM_IOCTL): Remove. (TEST_LIBTSS): Fix the condition. * tests/tpm2dtests/Makefile.am (TESTS_ENVIRONMENT): Remove SWTPM_IOCTL. * tests/tpm2dtests/start_sw_tpm.sh: Add --flags to invoke SWTPM, not requiring SWTPM_IOCTL and TSSSTARTUP any more. -- GnuPG-bug-id: 6052 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/tpm2dtests/Makefile.am1
-rwxr-xr-xtests/tpm2dtests/start_sw_tpm.sh55
2 files changed, 27 insertions, 29 deletions
diff --git a/tests/tpm2dtests/Makefile.am b/tests/tpm2dtests/Makefile.am
index 6048d201c..ceaf56420 100644
--- a/tests/tpm2dtests/Makefile.am
+++ b/tests/tpm2dtests/Makefile.am
@@ -36,7 +36,6 @@ TESTS_ENVIRONMENT = LC_ALL=C \
objdir="$(abs_top_builddir)" \
TPMSERVER="$(TPMSERVER)" TSSSTARTUP="$(TSSSTARTUP)" \
SWTPM="$(SWTPM)" \
- SWTPM_IOCTL="$(SWTPM_IOCTL)" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GNUPG_IN_TEST_SUITE=fact \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
diff --git a/tests/tpm2dtests/start_sw_tpm.sh b/tests/tpm2dtests/start_sw_tpm.sh
index fc86801e2..a44833e28 100755
--- a/tests/tpm2dtests/start_sw_tpm.sh
+++ b/tests/tpm2dtests/start_sw_tpm.sh
@@ -3,36 +3,35 @@
# remove any prior TPM contents
rm -f NVChip h*.bin *.permall
if [ -x "${SWTPM}" ]; then
- ${SWTPM} socket --tpm2 --daemon \
- --pid file=swtpm.pid \
- --server type=tcp,port=2321 \
- --ctrl type=tcp,port=2322 --tpmstate dir=`pwd`
- pid=$(cat swtpm.pid)
+ ${SWTPM} socket --tpm2 --daemon \
+ --pid file=swtpm.pid \
+ --server type=tcp,port=2321 \
+ --ctrl type=tcp,port=2322 \
+ --flags not-need-init,startup-clear \
+ --tpmstate dir=`pwd`
+ cat swtpm.pid
else
${TPMSERVER} > /dev/null 2>&1 &
pid=$!
-fi
-##
-# This powers on the tpm and starts it
-# then we derive the RSA version of the storage seed and
-# store it permanently at handle 81000001 and flush the transient
-##
-a=0; while [ $a -lt 10 ]; do
- if [ -x "${SWTPM_IOCTL}" ]; then
- ${SWTPM_IOCTL} --tcp 127.0.0.1:2322 -i > /dev/null 2>&1
- else
- tsspowerup > /dev/null 2>&1
- fi
- if [ $? -eq 0 ]; then
- break;
+ ##
+ # This powers on the tpm and starts it
+ # then we derive the RSA version of the storage seed and
+ # store it permanently at handle 81000001 and flush the transient
+ ##
+ a=0
+ while [ $a -lt 10 ]; do
+ tsspowerup > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ break;
+ fi
+ sleep 1
+ a=$[$a+1]
+ done
+ if [ $a -eq 10 ]; then
+ echo "Waited 10s for tpm_server to come up; exiting"
+ exit 1
fi
- sleep 1
- a=$[$a+1]
-done
-if [ $a -eq 10 ]; then
- echo "Waited 10s for tpm_server to come up; exiting"
- exit 1
-fi
-tssstartup || exit 1
-echo -n $pid
+ ${TSSSTARTUP} || exit 1
+ echo -n $pid
+fi