From b34da36cdec997a41247b8df8ddbfe678c1d7923 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 22 Feb 2022 07:46:26 -0500 Subject: [PATCH] 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 --- tests/test_swtpm_setup_create_cert | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_swtpm_setup_create_cert b/tests/test_swtpm_setup_create_cert index e806403a..2c445c11 100755 --- a/tests/test_swtpm_setup_create_cert +++ b/tests/test_swtpm_setup_create_cert @@ -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 \