From 83f4e9604551966d4132a5caa281625ca0a4f3af Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 27 Aug 2020 19:50:30 -0400 Subject: [PATCH] tests: Have softhsm_setup use the temporary directory now 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 --- tests/test_tpm2_samples_swtpm_localca_pkcs11 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_tpm2_samples_swtpm_localca_pkcs11 b/tests/test_tpm2_samples_swtpm_localca_pkcs11 index 372a639..0af7a0f 100755 --- a/tests/test_tpm2_samples_swtpm_localca_pkcs11 +++ b/tests/test_tpm2_samples_swtpm_localca_pkcs11 @@ -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 -- 2.39.5