]> git.proxmox.com Git - swtpm.git/commitdiff
tests: Have softhsm_setup use the temporary directory now
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Thu, 27 Aug 2020 23:50:30 +0000 (19:50 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Fri, 28 Aug 2020 00:26:27 +0000 (20:26 -0400)
Modify the pkcs11 related test case to set the environment variable for
softhsm_setup to use the temporary directory for config file and state
of softhsm. Also set the SOFTHSM2_CONF environment variable since
certtool also uses the pkcs11 module which in turn will look for its
config file.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
tests/test_tpm2_samples_swtpm_localca_pkcs11

index 372a6391e26d6dbe8a59327038d916f914308b2f..0af7a0f87bc5dbb6a41b20178c726e268df3fe86 100755 (executable)
@@ -10,6 +10,17 @@ TESTDIR=${abs_top_testdir:-$(dirname "$0")}
 SWTPM_LOCALCA=${TOPSRC}/samples/swtpm-localca
 
 workdir=$(mktemp -d)
+if [ $? -ne 0 ]; then
+       exit 1
+fi
+
+# Have softhsm_setup use 'workdir'.
+export SOFTHSM_SETUP_CONFIGDIR="${workdir}"
+
+# Since we will be using the pkcs11 module as well via certtool
+# we have to set the environment variable to point to its config file.
+# This has to be the same as for swtpm_setup sets it.
+export SOFTHSM2_CONF="${workdir}"/softhsm2.conf
 
 ek="80" # 2048 bit key must have highest bit set
 for ((i = 1; i < 256; i++)); do