tests: Use ${WORKDIR} in config files to test env. var replacement

To test the replacement of environment variables with their values
use ${WORKDIR} in the test case config files.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2022-02-22 07:46:26 -05:00 committed by Stefan Berger
parent 00eb426004
commit b34da36cde

View File

@ -28,13 +28,14 @@ function cleanup()
# We want swtpm_cert to use the local CA and see that the
# local CA script automatically creates a signingkey and
# self-signed certificate
# self-signed certificate; use ${WORKDIR} in the config files
# to test env variable resolution
cat <<_EOF_ > ${workdir}/swtpm-localca.conf
statedir=${workdir}
signingkey = ${SIGNINGKEY}
issuercert = ${ISSUERCERT}
certserial = ${CERTSERIAL}
statedir=\${WORKDIR}
signingkey = \${WORKDIR}/signingkey.pem
issuercert = \${WORKDIR}/issuercert.pem
certserial = \${WORKDIR}/certserial
_EOF_
cat <<_EOF_ > ${workdir}/swtpm-localca.options
@ -48,8 +49,8 @@ _EOF_
cat <<_EOF_ > ${workdir}/swtpm_setup.conf
create_certs_tool=${SWTPM_LOCALCA}
create_certs_tool_config=${workdir}/swtpm-localca.conf
create_certs_tool_options=${workdir}/swtpm-localca.options
create_certs_tool_config=\${WORKDIR}/swtpm-localca.conf
create_certs_tool_options=\${WORKDIR}/swtpm-localca.options
_EOF_
# We need to adapt the PATH so the correct swtpm_cert is picked
@ -59,7 +60,8 @@ export PATH=${ROOT}/src/swtpm_cert:${PATH}
export SWTPM_ROOTCA_PASSWORD=password
# we need to create at least one cert: --create-ek-cert
$SWTPM_SETUP \
WORKDIR=${workdir} \
$SWTPM_SETUP \
--tpm-state ${workdir} \
--create-ek-cert \
--config ${workdir}/swtpm_setup.conf \