summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2023-10-04 11:30:33 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2023-10-06 02:55:36 +0200
commit0e200f2187e005d8c52d8efb5ef89e4709eabcc1 (patch)
tree6eb2f07556f3a6b0815501ff0d18a3151d37cfeb
parentbuild: Simplify detecting a TPM emulator. (diff)
downloadgnupg2-0e200f2187e005d8c52d8efb5ef89e4709eabcc1.tar.xz
gnupg2-0e200f2187e005d8c52d8efb5ef89e4709eabcc1.zip
tests:tpm2dtests: Fix tests with SWTPM.
* configure.ac (TEST_LIBTSS): Fix the condition with SWTPM. * tests/tpm2dtests/start_sw_tpm.sh: Use --daemon and --pid to run SWTPM. -- Cherry-picked from master commit of: 98dd6f7af6aa3dcce19f20c22e3f825676e6b184 GnuPG-bug-id: 6052 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--configure.ac2
-rwxr-xr-xtests/tpm2dtests/start_sw_tpm.sh9
2 files changed, 7 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 6536810f1..72c99b1be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1625,7 +1625,7 @@ fi
AC_SUBST(LIBTSS_LIBS)
AC_SUBST(LIBTSS_CFLAGS)
AM_CONDITIONAL(HAVE_LIBTSS, test "$have_libtss" != no)
-AM_CONDITIONAL(TEST_LIBTSS, test -n "$TPMSERVER" || test -n "$SWTPM" && test -n "$TSSSTARTUP")
+AM_CONDITIONAL(TEST_LIBTSS, test -n "$TPMSERVER" -o -n "$SWTPM" -a -n "$TSSSTARTUP" -a -n "$SWTPM_IOCTL")
AC_SUBST(HAVE_LIBTSS)
#
diff --git a/tests/tpm2dtests/start_sw_tpm.sh b/tests/tpm2dtests/start_sw_tpm.sh
index 36e1a806e..fc86801e2 100755
--- a/tests/tpm2dtests/start_sw_tpm.sh
+++ b/tests/tpm2dtests/start_sw_tpm.sh
@@ -3,12 +3,15 @@
# remove any prior TPM contents
rm -f NVChip h*.bin *.permall
if [ -x "${SWTPM}" ]; then
- ${SWTPM} socket --tpm2 --server type=tcp,port=2321 \
- --ctrl type=tcp,port=2322 --tpmstate dir=`pwd` &
+ ${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)
else
${TPMSERVER} > /dev/null 2>&1 &
+ pid=$!
fi
-pid=$!
##
# This powers on the tpm and starts it
# then we derive the RSA version of the storage seed and